Skip to content

Commit

Permalink
Change readme
Browse files Browse the repository at this point in the history
  • Loading branch information
arianneorpilla committed Mar 5, 2021
1 parent 02fdf47 commit d9da825
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h3 align="center">jidoujisho</h3>
<p align="center">A mobile video player tailored for Japanese language learners.</p>

<p align="center"><b>Latest Release: <a href="https://github.com/lrorpilla/jidoujisho/releases/">0.5.0</a></p></b><br>
<p align="center"><b>Latest Release: <a href="https://github.com/lrorpilla/jidoujisho/releases/">0.5.1-beta</a></p></b><br>

# 📚 Uninterrupted language immersion at your fingertips

Expand Down
19 changes: 17 additions & 2 deletions lib/player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ class _VideoPlayerState extends State<VideoPlayer> {
ChewieController _chewieController;
SubTitleWrapper _subTitleWrapper;
SubtitleController _subTitleController;
bool _isSelectionVolatile = false;
String _volatileText = "";
FocusNode _subtitleFocusNode = new FocusNode();

File _videoFile;
List<File> _internalSubs;
Expand Down Expand Up @@ -398,6 +401,7 @@ class _VideoPlayerState extends State<VideoPlayer> {
hasBorder: true,
fontSize: 24,
),
focusNode: _subtitleFocusNode,
videoChild: FutureBuilder(
future: getVideoPlayerController().initialize(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
Expand Down Expand Up @@ -496,6 +500,7 @@ class _VideoPlayerState extends State<VideoPlayer> {
_currentWord.value = "";
_currentDefinition.value = "";
_currentReading.value = "";
_subtitleFocusNode.unfocus();
},
child: Container(
padding: EdgeInsets.all(16.0),
Expand Down Expand Up @@ -524,6 +529,7 @@ class _VideoPlayerState extends State<VideoPlayer> {
_currentWord.value = "";
_currentReading.value = "";
_currentDefinition.value = "";
_subtitleFocusNode.unfocus();
},
child: SingleChildScrollView(
child: Container(
Expand Down Expand Up @@ -603,8 +609,17 @@ class _VideoPlayerState extends State<VideoPlayer> {
}

void onClipboardText(String text) {
_clipboard.value = text;
print("CLIPBOARD CHANGED: $text");
_volatileText = text;

Future.delayed(
text.length == 1
? Duration(milliseconds: 1000)
: Duration(milliseconds: 500), () {
if (_volatileText == text) {
print("CLIPBOARD CHANGED: $text");
_clipboard.value = text;
}
});
}

void stopAllClipboardMonitoring() {
Expand Down
3 changes: 2 additions & 1 deletion lib/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ Future<List<String>> getWordDetails(String searchTerm) async {
}
}

if (exportReadings == searchTerm || bestResult.slug == exportReadings) {
if (exportReadings == "null" ||
exportReadings == searchTerm && bestResult.slug == exportReadings) {
exportReadings = "";
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A mobile video player tailored for Japanese language learners.

publish_to: none

version: 0.5.0+beta
version: 0.5.1+beta

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down
19 changes: 16 additions & 3 deletions subtitle_wrapper_package-1.0.4/lib/subtitle_text_view.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:subtitle_wrapper_package/bloc/subtitle/subtitle_bloc.dart';
import 'package:subtitle_wrapper_package/data/constants/view_keys.dart';
import 'package:subtitle_wrapper_package/data/models/style/subtitle_style.dart';

class SubtitleTextView extends StatelessWidget {
final SubtitleStyle subtitleStyle;
final FocusNode focusNode;

const SubtitleTextView({Key key, @required this.subtitleStyle})
: super(key: key);
const SubtitleTextView({
Key key,
@required this.subtitleStyle,
@required this.focusNode,
}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -47,12 +52,20 @@ class SubtitleTextView extends StatelessWidget {
state.subtitle.text,
key: ViewKeys.SUBTITLE_TEXT_CONTENT,
textAlign: TextAlign.center,
onSelectionChanged: (selection, cause) {
Clipboard.setData(ClipboardData(
text: selection.textInside(state.subtitle.text)));
},
style: TextStyle(
fontSize: subtitleStyle.fontSize,
color: subtitleStyle.textColor,
),
focusNode: focusNode,
toolbarOptions: ToolbarOptions(
copy: true, cut: false, selectAll: false, paste: false),
copy: false,
cut: false,
selectAll: false,
paste: false),
),
),
],
Expand Down
15 changes: 9 additions & 6 deletions subtitle_wrapper_package-1.0.4/lib/subtitle_wrapper_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import 'package:subtitle_wrapper_package/subtitle_controller.dart';
import 'package:subtitle_wrapper_package/subtitle_text_view.dart';

class SubTitleWrapper extends StatelessWidget {
final Widget videoChild;
final SubtitleController subtitleController;
final dynamic videoPlayerController;
final SubtitleStyle subtitleStyle;
final ValueNotifier<Subtitle> subtitleNotifier;

SubTitleWrapper({
Key key,
@required this.videoChild,
@required this.subtitleController,
@required this.videoPlayerController,
@required this.subtitleNotifier,
@required this.focusNode,
this.subtitleStyle = const SubtitleStyle(),
}) : super(key: key);

final Widget videoChild;
final SubtitleController subtitleController;
final dynamic videoPlayerController;
final SubtitleStyle subtitleStyle;
final ValueNotifier<Subtitle> subtitleNotifier;
final FocusNode focusNode;

@override
Widget build(BuildContext context) {
return Stack(
Expand All @@ -51,6 +53,7 @@ class SubTitleWrapper extends StatelessWidget {
),
child: SubtitleTextView(
subtitleStyle: subtitleStyle,
focusNode: focusNode,
),
),
)
Expand Down

0 comments on commit d9da825

Please sign in to comment.