Added more intelligent color distribution based on system theme

This commit is contained in:
2024-01-05 20:57:26 +02:00
parent f17e540f68
commit f20a6ccd46
3 changed files with 18 additions and 7 deletions

3
.vscode/launch.json vendored
View File

@ -8,7 +8,8 @@
"name": "inpus_touch",
"cwd": "inpus_touch",
"request": "launch",
"type": "dart"
"type": "dart",
"flutterMode": "debug"
},
{
"name": "inpus_touch (profile mode)",

View File

@ -17,19 +17,28 @@ class MainApp extends StatelessWidget {
final Brightness brightness =
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)
: (lightDynamic?.primary ?? Colors.grey.shade200));
Color secondaryColor = (!isDark
? (darkDynamic?.secondary ?? Colors.red.shade800)
: (lightDynamic?.secondary ?? Colors.blue.shade200));
return Scaffold(
appBar: AppBar(
title: const Text('Inpu\'s Touch'),
backgroundColor: secondaryColor,
foregroundColor: isDark ? Colors.white : Colors.black),
backgroundColor: accentColor,
body:
Container(
decoration: const BoxDecoration(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/clock icon light.png')))));
image: AssetImage(!isDark
? 'assets/clock icon dark.png'
: 'assets/clock icon light.png')))));
}));
}
}

View File

@ -21,3 +21,4 @@ flutter:
assets:
- assets/clock icon light.png
- assets/clock icon dark.png