fix: Material you improvements (#60)

This commit is contained in:
Aunali321 2022-09-06 18:07:23 +01:00 committed by Alberto Ponces
parent 27ef74b561
commit 10fbbe845e
3 changed files with 49 additions and 3 deletions

View File

@ -7,6 +7,13 @@ var lightCustomTheme = ThemeData(
seedColor: Colors.blue, seedColor: Colors.blue,
brightness: Brightness.light, brightness: Brightness.light,
), ),
navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all(
const TextStyle(
fontWeight: FontWeight.w500,
),
),
),
textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme), textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme),
); );
@ -18,6 +25,13 @@ var darkCustomTheme = ThemeData(
primary: const Color(0xff7792BA), primary: const Color(0xff7792BA),
surface: const Color(0xff0A0D11), surface: const Color(0xff0A0D11),
), ),
navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all(
const TextStyle(
fontWeight: FontWeight.w500,
),
),
),
canvasColor: const Color(0xff0A0D11), canvasColor: const Color(0xff0A0D11),
scaffoldBackgroundColor: const Color(0xff0A0D11), scaffoldBackgroundColor: const Color(0xff0A0D11),
toggleableActiveColor: const Color(0xff7792BA), toggleableActiveColor: const Color(0xff7792BA),

View File

@ -24,12 +24,39 @@ class DynamicThemeBuilder extends StatelessWidget {
builder: (lightColorScheme, darkColorScheme) { builder: (lightColorScheme, darkColorScheme) {
ThemeData lightDynamicTheme = ThemeData( ThemeData lightDynamicTheme = ThemeData(
useMaterial3: true, useMaterial3: true,
canvasColor: lightColorScheme?.background,
navigationBarTheme: NavigationBarThemeData(
backgroundColor: lightColorScheme?.background,
indicatorColor: lightColorScheme?.primary.withAlpha(150),
labelTextStyle: MaterialStateProperty.all(
const TextStyle(
fontWeight: FontWeight.w500,
),
),
),
scaffoldBackgroundColor: lightColorScheme?.background,
colorScheme: lightColorScheme?.harmonized(), colorScheme: lightColorScheme?.harmonized(),
toggleableActiveColor: lightColorScheme?.primary, toggleableActiveColor: lightColorScheme?.primary,
textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme), textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme),
); );
ThemeData darkDynamicTheme = ThemeData( ThemeData darkDynamicTheme = ThemeData(
useMaterial3: true, useMaterial3: true,
canvasColor: darkColorScheme?.background,
navigationBarTheme: NavigationBarThemeData(
backgroundColor: darkColorScheme?.background,
indicatorColor: darkColorScheme?.primary.withOpacity(0.4),
labelTextStyle: MaterialStateProperty.all(
const TextStyle(
fontWeight: FontWeight.w500,
),
),
iconTheme: MaterialStateProperty.all(
const IconThemeData(
color: Colors.white,
),
),
),
scaffoldBackgroundColor: darkColorScheme?.background,
colorScheme: darkColorScheme?.harmonized(), colorScheme: darkColorScheme?.harmonized(),
toggleableActiveColor: darkColorScheme?.primary, toggleableActiveColor: darkColorScheme?.primary,
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme), textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
@ -42,7 +69,7 @@ class DynamicThemeBuilder extends StatelessWidget {
2: lightDynamicTheme, 2: lightDynamicTheme,
3: darkDynamicTheme, 3: darkDynamicTheme,
}, },
fallbackTheme: lightCustomTheme, fallbackTheme: darkCustomTheme,
), ),
builder: (context, theme) => MaterialApp( builder: (context, theme) => MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,

View File

@ -52,13 +52,18 @@ class OptionsFilePicker extends StatelessWidget {
ElevatedButton( ElevatedButton(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.all( backgroundColor: MaterialStateProperty.all(
Theme.of(context).colorScheme.secondary, Theme.of(context).colorScheme.primary,
), ),
), ),
onPressed: () { onPressed: () {
// pick files // pick files
}, },
child: const Text('Select File'), child: Text(
'Select File',
style: TextStyle(
color: Theme.of(context).textTheme.bodyText1?.color,
),
),
), ),
], ],
), ),