Skip to content

Commit

Permalink
add focus node check
Browse files Browse the repository at this point in the history
  • Loading branch information
kidozh committed Dec 1, 2024
1 parent 1bafdd0 commit 57e8db8
Show file tree
Hide file tree
Showing 13 changed files with 422 additions and 305 deletions.
2 changes: 2 additions & 0 deletions lib/app/MainApp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,8 @@ class MainTwoPaneState extends State<MainTwoPaneStatefulWidget>
navigatorKey: this.navigatorKey,
);
}


double paneProportion = 0.35;
// directly give
return OrientationBuilder(builder: (context, orientation) {
Expand Down
1 change: 1 addition & 0 deletions lib/client/SteamApiClient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ abstract class SteamApiClient {
@GET("/api/appdetails")
Future<String> getSteamGameResultByAppId(
@Query("appids") String appId,
@Query("l") String language
);
}
10 changes: 8 additions & 2 deletions lib/client/SteamApiClient.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 67 additions & 64 deletions lib/generated/intl/messages_en.dart

Large diffs are not rendered by default.

131 changes: 67 additions & 64 deletions lib/generated/intl/messages_zh_CN.dart

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -867,5 +867,11 @@
},
"openGameInSteam": "View in Steam",
"gameFreeOfCharge": "Free",
"gameComingSoon": "Coming Soon"
"gameComingSoon": "Coming Soon",
"gameLanguageNotSupported": "Not support {language}",
"@gameLanguageNotSupported": {
"placeholders": {
"language": {}
}
}
}
8 changes: 7 additions & 1 deletion lib/l10n/intl_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,12 @@
},
"openGameInSteam": "在Steam中打开",
"gameFreeOfCharge": "免费",
"gameComingSoon": "即将发售"
"gameComingSoon": "即将发售",
"gameLanguageNotSupported": "不支持{language}",
"@gameLanguageNotSupported": {
"placeholders": {
"language": {}
}
}

}
1 change: 1 addition & 0 deletions lib/page/TestFlightBannerPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';

import '../provider/ThemeNotifierProvider.dart';
import '../provider/UserPreferenceNotifierProvider.dart';
import '../utility/PostTextFieldUtils.dart';

Expand Down
7 changes: 4 additions & 3 deletions lib/page/ViewThreadSliverPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class _ViewThreadSliverState extends State<ViewThreadStatefulSliverWidget> {
ButtonState _sendReplyStatus = ButtonState.idle;
ViewThreadQuery viewThreadQuery = ViewThreadQuery();
Map<String, List<Comment>> postCommentList = {};
final FocusNode _focusNode = FocusNode();
final FocusNode _focusNode = FocusNode(debugLabel: "view_thread_textfield");

// smiley=1, extra=2 or none = 0
int dialogStatus = 0;
Expand Down Expand Up @@ -176,7 +176,7 @@ class _ViewThreadSliverState extends State<ViewThreadStatefulSliverWidget> {

void bindFocusNode() {
_focusNode.addListener(() {
//print("In focus node");
debugDumpFocusTree();
if (_focusNode.hasFocus) {
setState(() {
dialogStatus = SHOW_NONE_DIALOG;
Expand All @@ -190,9 +190,10 @@ class _ViewThreadSliverState extends State<ViewThreadStatefulSliverWidget> {

_scrollController.addListener(() {
// remove focus when

if (_focusNode.hasFocus) {
DateTime now = DateTime.now();
if(now.difference(lastFocusAt).inSeconds > 10){
if(now.difference(lastFocusAt).inSeconds > 1){
print("Unfocus node due to scroll ${now.difference(lastFocusAt).inSeconds}");
_focusNode.unfocus();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utility/NetworkUtils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class NetworkUtils{
static Dio getDio(){
return Dio(BaseOptions(
headers: {
'Accept-Language': LanguageCode.code.code
'Accept-Language': "zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.6"
}
));
}
Expand Down
5 changes: 3 additions & 2 deletions lib/widget/DiscuzHtmlWidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ class DiscuzHtmlWidget extends StatelessWidget {
};
} else if(element.className == "reply_wrap"){
return {
"background-color": "#${Theme.of(context).colorScheme.primaryContainer.value.toRadixString(16).substring(2)}",
"padding" : "0.1em",
"border": "0.4rem dashed #${Theme.of(context).colorScheme.primary.value.toRadixString(16).substring(2)}",
"background-color" : "#${Theme.of(context).colorScheme.primaryContainer.value.toRadixString(16).substring(2)}",
"padding" : "0.5em",
"margin-bottom": "0.1em"
};
}
Expand Down
Loading

0 comments on commit 57e8db8

Please sign in to comment.