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

View File

@ -10,7 +10,6 @@ import 'package:fluffychat/utils/sentry_controller.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app_lock/flutter_app_lock.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:universal_html/html.dart' as html;
@ -82,41 +81,25 @@ class FluffyChatApp extends StatelessWidget {
apl: _apl,
testClient: testClient,
child: Builder(
builder: (context) {
final darkMode =
Theme.of(context).brightness == Brightness.dark;
final brightness =
darkMode ? Brightness.light : Brightness.dark;
WidgetsBinding.instance.addPostFrameCallback((_) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor:
Theme.of(context).scaffoldBackgroundColor,
statusBarColor: Colors.transparent,
statusBarBrightness: brightness,
statusBarIconBrightness: brightness,
systemNavigationBarIconBrightness: brightness,
));
});
return AdaptivePageLayout(
key: _apl,
safeAreaOnColumnView: false,
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)),
);
},
builder: (context) => AdaptivePageLayout(
key: _apl,
safeAreaOnColumnView: false,
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)),
),
),
),
),