From b129c7643190a9f58005ede3edd41d7ed111281e Mon Sep 17 00:00:00 2001 From: Bruce Liu Date: Thu, 21 Jan 2021 12:43:24 +0800 Subject: [PATCH] fix tab bar localization update --- android/app/build.gradle | 19 +++++- lib/components/cupertino_toolbar.dart | 3 +- lib/pages/home_page.dart | 92 ++++++++++++++------------- 3 files changed, 65 insertions(+), 49 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 0d6442d..6e96e57 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,6 +25,12 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { compileSdkVersion 29 @@ -45,11 +51,18 @@ android { versionName flutterVersionName } + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } } } diff --git a/lib/components/cupertino_toolbar.dart b/lib/components/cupertino_toolbar.dart index eb59831..c4f2652 100644 --- a/lib/components/cupertino_toolbar.dart +++ b/lib/components/cupertino_toolbar.dart @@ -5,6 +5,7 @@ */ import 'package:fluent_reader_lite/utils/colors.dart'; +import 'package:fluent_reader_lite/utils/global.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/widgets.dart'; @@ -78,7 +79,7 @@ class CupertinoToolbar extends StatelessWidget { child: SafeArea( top: false, child: SizedBox( - height: 44.0, + height: Global.isTablet ? 50.0 : 44.0, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: _createButtons() diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index b9b0e98..54ee025 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -46,59 +46,61 @@ class _HomePageState extends State { ); } + Widget buildLeft(BuildContext context, {isMobile: true}) { + final leftTabs = CupertinoTabScaffold( + controller: _controller, + backgroundColor: CupertinoColors.systemBackground, + tabBar: CupertinoTabBar( + backgroundColor: CupertinoColors.systemBackground, + onTap: _scrollTopNotifier.onTap, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.timeline), + label: S.of(context).feed, + ), + BottomNavigationBarItem( + icon: Icon(Icons.list), + label: S.of(context).subscriptions, + ), + ], + ), + tabBuilder: (context, index) { + return CupertinoTabView( + navigatorKey: _tabNavigatorKeys[index], + routes: { + '/feed': (context) { + Widget page = ItemListPage(_scrollTopNotifier); + return _constructPage(page, isMobile); + }, + }, + builder: (context) { + Widget page = index == 0 + ? ItemListPage(_scrollTopNotifier) + : SubscriptionListPage(_scrollTopNotifier); + return _constructPage(page, isMobile); + }, + ); + }, + ); + return WillPopScope( + child: leftTabs, + onWillPop: () async { + return !(await _tabNavigatorKeys[_controller.index].currentState.maybePop()); + }, + ); + } + @override Widget build(BuildContext context) { return Selector( selector: (context, syncModel) => syncModel.hasService, builder: (context, hasService, child) { if (!hasService) return SetupPage(); - var isMobile = true; - final leftTabs = CupertinoTabScaffold( - controller: _controller, - backgroundColor: CupertinoColors.systemBackground, - tabBar: CupertinoTabBar( - backgroundColor: CupertinoColors.systemBackground, - onTap: _scrollTopNotifier.onTap, - items: [ - BottomNavigationBarItem( - icon: Icon(Icons.timeline), - label: S.of(context).feed, - ), - BottomNavigationBarItem( - icon: Icon(Icons.list), - label: S.of(context).subscriptions, - ), - ], - ), - tabBuilder: (context, index) { - return CupertinoTabView( - navigatorKey: _tabNavigatorKeys[index], - routes: { - '/feed': (context) { - Widget page = ItemListPage(_scrollTopNotifier); - return _constructPage(page, isMobile); - }, - }, - builder: (context) { - Widget page = index == 0 - ? ItemListPage(_scrollTopNotifier) - : SubscriptionListPage(_scrollTopNotifier); - return _constructPage(page, isMobile); - }, - ); - }, - ); - final left = WillPopScope( - child: leftTabs, - onWillPop: () async { - return !(await _tabNavigatorKeys[_controller.index].currentState.maybePop()); - }, - ); return ScreenTypeLayout.builder( - mobile: (context) => left, + mobile: (context) => buildLeft(context), tablet: (context) { - isMobile = false; - var right = Container( + final left = buildLeft(context, isMobile: false); + final right = Container( decoration: BoxDecoration(), clipBehavior: Clip.hardEdge, child: CupertinoTabView( -- 2.38.5