From f0d508c37aa6892b7392d631bda9c1f5e5127747 Mon Sep 17 00:00:00 2001 From: shilangyu Date: Tue, 8 Sep 2020 16:31:04 +0200 Subject: [PATCH] added black color to background and canvas --- lib/main.dart | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 07ba3b8..61ec66e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -34,18 +34,24 @@ Future main() async { class MyApp extends StatelessWidget { @override Widget build(BuildContext context) => Observer( - builder: (ctx) => MaterialApp( - title: 'Flutter Demo', - themeMode: ctx.watch().theme, - darkTheme: ThemeData.dark().copyWith( - scaffoldBackgroundColor: ctx.watch().amoledDarkMode - ? Colors.black - : null), - theme: ThemeData( - visualDensity: VisualDensity.adaptivePlatformDensity, - ), - home: MyHomePage(title: 'Flutter hello world'), - ), + builder: (ctx) { + var maybeAmoledColor = + ctx.watch().amoledDarkMode ? Colors.black : null; + + return MaterialApp( + title: 'Flutter Demo', + themeMode: ctx.watch().theme, + darkTheme: ThemeData.dark().copyWith( + scaffoldBackgroundColor: maybeAmoledColor, + backgroundColor: maybeAmoledColor, + canvasColor: maybeAmoledColor, + ), + theme: ThemeData( + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: MyHomePage(title: 'Flutter hello world'), + ); + }, ); }