fix: Status bar and system navigation bar theme

This commit is contained in:
Christian Pauly 2021-05-16 16:44:21 +02:00
parent 6d7c52c61f
commit d986986c97
2 changed files with 30 additions and 36 deletions

View File

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:flutter/services.dart';
import 'app_config.dart'; import 'app_config.dart';
@ -98,6 +99,11 @@ abstract class FluffyThemes {
appBarTheme: AppBarTheme( appBarTheme: AppBarTheme(
brightness: Brightness.light, brightness: Brightness.light,
color: Colors.white, color: Colors.white,
systemOverlayStyle: SystemUiOverlayStyle(
systemNavigationBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.dark,
statusBarColor: Colors.transparent,
),
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle( headline6: TextStyle(
color: Colors.black, color: Colors.black,
@ -176,6 +182,11 @@ abstract class FluffyThemes {
appBarTheme: AppBarTheme( appBarTheme: AppBarTheme(
brightness: Brightness.dark, brightness: Brightness.dark,
color: Color(0xff1D1D1D), color: Color(0xff1D1D1D),
systemOverlayStyle: SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black,
systemNavigationBarIconBrightness: Brightness.light,
statusBarColor: Colors.transparent,
),
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle( headline6: TextStyle(
color: Colors.white, color: Colors.white,

View File

@ -10,7 +10,6 @@ import 'package:fluffychat/utils/sentry_controller.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app_lock/flutter_app_lock.dart'; import 'package:flutter_app_lock/flutter_app_lock.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
@ -82,41 +81,25 @@ class FluffyChatApp extends StatelessWidget {
apl: _apl, apl: _apl,
testClient: testClient, testClient: testClient,
child: Builder( child: Builder(
builder: (context) { builder: (context) => AdaptivePageLayout(
final darkMode = key: _apl,
Theme.of(context).brightness == Brightness.dark; safeAreaOnColumnView: false,
final brightness = onGenerateRoute: testWidget == null
darkMode ? Brightness.light : Brightness.dark; ? FluffyRoutes(context).onGenerateRoute
WidgetsBinding.instance.addPostFrameCallback((_) { : (_) => ViewData(mainView: (_) => testWidget),
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( dividerColor: Theme.of(context).dividerColor,
systemNavigationBarColor: columnWidth: FluffyThemes.columnWidth,
Theme.of(context).scaffoldBackgroundColor, dividerWidth: 1.0,
statusBarColor: Colors.transparent, routeBuilder: (builder, settings) =>
statusBarBrightness: brightness, Matrix.of(context).loginState == LoginState.logged &&
statusBarIconBrightness: brightness, !{
systemNavigationBarIconBrightness: brightness, '/',
)); '/search',
}); '/contacts',
return AdaptivePageLayout( }.contains(settings.name)
key: _apl, ? MaterialPageRoute(builder: builder)
safeAreaOnColumnView: false, : FadeRoute(page: builder(context)),
onGenerateRoute: testWidget == null ),
? FluffyRoutes(context).onGenerateRoute
: (_) => ViewData(mainView: (_) => testWidget),
dividerColor: Theme.of(context).dividerColor,
columnWidth: FluffyThemes.columnWidth,
dividerWidth: 1.0,
routeBuilder: (builder, settings) =>
Matrix.of(context).loginState == LoginState.logged &&
!{
'/',
'/search',
'/contacts',
}.contains(settings.name)
? MaterialPageRoute(builder: builder)
: FadeRoute(page: builder(context)),
);
},
), ),
), ),
), ),