Added more intelligent color distribution based on system theme
This commit is contained in:
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
@ -8,7 +8,8 @@
|
|||||||
"name": "inpus_touch",
|
"name": "inpus_touch",
|
||||||
"cwd": "inpus_touch",
|
"cwd": "inpus_touch",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart"
|
"type": "dart",
|
||||||
|
"flutterMode": "debug"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "inpus_touch (profile mode)",
|
"name": "inpus_touch (profile mode)",
|
||||||
|
@ -17,19 +17,28 @@ class MainApp extends StatelessWidget {
|
|||||||
final Brightness brightness =
|
final Brightness brightness =
|
||||||
SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||||
|
|
||||||
bool isDark = brightness == Brightness.dark;
|
final bool isDark = brightness == Brightness.dark;
|
||||||
|
|
||||||
Color accentColor = (isDark == true
|
Color accentColor = (isDark
|
||||||
? (darkDynamic?.primary ?? Colors.grey.shade800)
|
? (darkDynamic?.primary ?? Colors.grey.shade800)
|
||||||
: (lightDynamic?.primary ?? Colors.grey.shade200));
|
: (lightDynamic?.primary ?? Colors.grey.shade200));
|
||||||
|
|
||||||
|
Color secondaryColor = (!isDark
|
||||||
|
? (darkDynamic?.secondary ?? Colors.red.shade800)
|
||||||
|
: (lightDynamic?.secondary ?? Colors.blue.shade200));
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Inpu\'s Touch'),
|
||||||
|
backgroundColor: secondaryColor,
|
||||||
|
foregroundColor: isDark ? Colors.white : Colors.black),
|
||||||
backgroundColor: accentColor,
|
backgroundColor: accentColor,
|
||||||
body:
|
body: Container(
|
||||||
Container(
|
decoration: BoxDecoration(
|
||||||
decoration: const BoxDecoration(
|
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('assets/clock icon light.png')))));
|
image: AssetImage(!isDark
|
||||||
|
? 'assets/clock icon dark.png'
|
||||||
|
: 'assets/clock icon light.png')))));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,3 +21,4 @@ flutter:
|
|||||||
|
|
||||||
assets:
|
assets:
|
||||||
- assets/clock icon light.png
|
- assets/clock icon light.png
|
||||||
|
- assets/clock icon dark.png
|
||||||
|
Reference in New Issue
Block a user