Skip to content

Commit

Permalink
Merge pull request #70 from andychucs/dev
Browse files Browse the repository at this point in the history
move bottom-up to tools_page & UI fix
  • Loading branch information
andychucs authored Jan 7, 2023
2 parents 223a2e9 + a777393 commit 9b64fc5
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 59 deletions.
17 changes: 8 additions & 9 deletions lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
Expand All @@ -23,10 +22,10 @@ import 'messages_zh-Hant.dart' as messages_zh_hant;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new SynchronousFuture(null),
'ja': () => new SynchronousFuture(null),
'zh_Hans': () => new SynchronousFuture(null),
'zh_Hant': () => new SynchronousFuture(null),
'en': () => new Future.value(null),
'ja': () => new Future.value(null),
'zh_Hans': () => new Future.value(null),
'zh_Hant': () => new Future.value(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
Expand All @@ -45,18 +44,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) {
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new SynchronousFuture(false);
return new Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
lib == null ? new SynchronousFuture(false) : lib();
await (lib == null ? new Future.value(false) : lib());
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new SynchronousFuture(true);
return new Future.value(true);
}

bool _messagesExistFor(String locale) {
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class AboutPage extends StatelessWidget {
];
},
body: SafeArea(
top: false,
bottom: false,
child: CustomScrollView(
slivers: <Widget>[
SliverPadding(
Expand Down
26 changes: 10 additions & 16 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class HomePageState extends State<HomePage> {
});

_initPackageInfo();

home = Uri.parse(kGameUrl);
_initWebviewController();
}

Expand Down Expand Up @@ -287,7 +287,7 @@ Page resource error:
_showNotify = (prefs.getBool('showNotify') ?? true);
_showIosNotify = (prefs.getBool('showIosNotify') ?? true);
_enableAutoProcess = (prefs.getBool('enableAutoProcess') ?? true);
home = (Uri.parse(prefs.getString('homeUrl') ?? kGameUrl));
// home = Uri.parse(prefs.getString('homeUrl') ?? kGameUrl);
});
}

Expand Down Expand Up @@ -317,20 +317,14 @@ Page resource error:
return Scaffold(
resizeToAvoidBottomInset: false,
bottomNavigationBar: orientation == Orientation.portrait
? SingleChildScrollView(
controller: ScrollController(),
scrollDirection: Axis.horizontal,
child: IntrinsicWidth(
child: Controls(
_controller,
widget.cookieManager,
notifyParent: () {
setState(() {});
},
orientation: orientation,
),
),
)
? Controls(
_controller,
widget.cookieManager,
notifyParent: () {
setState(() {});
},
orientation: orientation,
)
: null,
body: SafeArea(
top: false,
Expand Down
18 changes: 10 additions & 8 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ class SettingsPageState extends State<SettingsPage> {
];
},
body: SafeArea(
top: false,
bottom: false,
child: SettingsList(
// shrinkWrap: true,
sections: [
SettingsSection(
title: Text(S.of(context).AppName),
tiles: <SettingsTile>[
SettingsTile.navigation(
leading: const Icon(
CupertinoIcons.home,
),
title: Text(S.of(context).AppHome),
onPressed: (context) {
},
),
// SettingsTile.navigation(
// leading: const Icon(
// CupertinoIcons.home,
// ),
// title: Text(S.of(context).AppHome),
// onPressed: (context) {
// },
// ),
SettingsTile.switchTile(
onToggle: (value) async {
HapticFeedback.heavyImpact();
Expand Down
18 changes: 18 additions & 0 deletions lib/pages/tools_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ class ToolsPage extends StatelessWidget {
"kcs_options=vol_bgm%3D30%3Bvol_se%3D40%3Bvol_voice%3D60%3Bv_be_left%3D1%3Bv_duty%3D1;expires=Thu, 1-Jan-2099 00:00:00 GMT;path=/;domain=dmm.com"''');
Fluttertoast.showToast(msg: S.current.MsgUnmuteGame);
}
void _onBottomUp() {
if (bottomPadding) {
bottomPadding = false;
} else {
bottomPadding = true;
}
notifyParent();
}

@override
Widget build(BuildContext context) {
Expand All @@ -110,6 +118,8 @@ class ToolsPage extends StatelessWidget {
];
},
body: SafeArea(
top: false,
bottom: false,
child: SettingsList(
sections: [
SettingsSection(
Expand Down Expand Up @@ -173,6 +183,14 @@ class ToolsPage extends StatelessWidget {
_onAdjustWindow(controller);
},
),
SettingsTile.navigation(
leading: const Icon(CupertinoIcons.rectangle_dock),
title: Text(S.of(context).AppBottomSafe),
onPressed: (context) {
HapticFeedback.heavyImpact();
_onBottomUp();
},
),
],
),
],
Expand Down
24 changes: 8 additions & 16 deletions lib/widgets/controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class Controls extends StatelessWidget {
0: ConFunc.loadHome,
// 1: ConFunc.httpRedirect,
1: ConFunc.navi2Tool,
2: ConFunc.bottomUp,
3: ConFunc.refresh,
// 2: ConFunc.bottomUp,
2: ConFunc.refresh,
// 4: ConFunc.scrollUp,
// 5: ConFunc.scrollDown,
4: ConFunc.goBack,
5: ConFunc.goForward,
6: ConFunc.navi2Settings,
7: ConFunc.navi2About,
3: ConFunc.goBack,
4: ConFunc.goForward,
5: ConFunc.navi2Settings,
6: ConFunc.navi2About,
// 1: ConFunc.adjustWindow,
// 8: ConFunc.clearCookies,
// 9: ConFunc.clearCache
Expand All @@ -61,8 +61,8 @@ class Controls extends StatelessWidget {
final Map naviItems = {
0: 0, //loadHome
1: 1, //navi2Tool
2: 6, //navi2Settings
3: 7, //navi2About
2: 5, //navi2Settings
3: 6, //navi2About
};

@override
Expand All @@ -86,10 +86,6 @@ class Controls extends StatelessWidget {
icon: const Icon(CupertinoIcons.game_controller),
label: S.of(context).ToolsButton,
),
BottomNavigationBarItem(
icon: const Icon(CupertinoIcons.rectangle_dock),
label: S.of(context).AppBottomSafe,
),
BottomNavigationBarItem(
icon: const Icon(
CupertinoIcons.refresh,
Expand Down Expand Up @@ -138,10 +134,6 @@ class Controls extends StatelessWidget {
icon: const Icon(CupertinoIcons.game_controller),
label: Text(S.of(context).ToolsButton),
),
NavigationRailDestination(
icon: const Icon(CupertinoIcons.rectangle_dock),
label: Text(S.of(context).AppBottomSafe),
),
NavigationRailDestination(
icon: const Icon(
CupertinoIcons.refresh,
Expand Down
24 changes: 14 additions & 10 deletions lib/widgets/dailog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,17 @@ class CustomAlertDialog extends StatelessWidget {
}
}

class DialogWithInput extends StatelessWidget {
const DialogWithInput({super.key});

@override
Widget build(BuildContext context) {
// TODO: implement build
throw UnimplementedError();
}

}
// class DialogWithInput extends StatelessWidget {
// const DialogWithInput({super.key});
//
// @override
// Widget build(BuildContext context) {
// if (Platform.isIOS || Platform.isMacOS){
// return CupertinoAlertDialog(
// content: Card(),
// );
// }
// return AlertDialog();
// }
//
// }

0 comments on commit 9b64fc5

Please sign in to comment.