~cytrogen/fluent-reader-mobile

b129c7643190a9f58005ede3edd41d7ed111281e — Bruce Liu 5 years ago c87a419
fix tab bar localization update
3 files changed, 65 insertions(+), 49 deletions(-)

M android/app/build.gradle
M lib/components/cupertino_toolbar.dart
M lib/pages/home_page.dart
M android/app/build.gradle => android/app/build.gradle +16 -3
@@ 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
        }
    }
}

M lib/components/cupertino_toolbar.dart => lib/components/cupertino_toolbar.dart +2 -1
@@ 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()

M lib/pages/home_page.dart => lib/pages/home_page.dart +47 -45
@@ 46,59 46,61 @@ class _HomePageState extends State<HomePage> {
      );
  }

  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<SyncModel, bool>(
      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(