Skip to content

Commit

Permalink
feat: fix material3
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 committed Apr 29, 2024
1 parent 66b72ed commit 815b231
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 118 deletions.
1 change: 1 addition & 0 deletions lib/screens/onboarding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class OnboardingScreen extends StatelessWidget {
data: Themes.darkTheme,
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.black,
body: SafeArea(
child: Center(
child: Padding(
Expand Down
135 changes: 17 additions & 118 deletions lib/themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,80 +38,26 @@ final primarySwatch = generateMaterialColor(accentColor);

class Themes {
static final lightTheme = ThemeData(
fontFamily: GoogleFonts.poppins().fontFamily,
brightness: Brightness.light,
colorScheme: ColorScheme.fromSwatch(
primarySwatch: primarySwatch,
accentColor: lightAccentColor,
).copyWith(
primary: lightAccentColor,
secondary: lightAccentColor,
tertiary: detailColor,
background: Colors.white,
),
indicatorColor: lightAccentColor,
inputDecorationTheme: const InputDecorationTheme(
fillColor: lightTextFieldColor,
),
appBarTheme: const AppBarTheme(
color: detailColor,
titleTextStyle: TextStyle(color: Colors.white, fontSize: 20),
iconTheme: IconThemeData(
color: Colors.white,
)),
tabBarTheme: const TabBarTheme(labelColor: lightAccentColor),
checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return lightAccentColor;
}
return null;
}),
),
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return lightAccentColor;
}
return null;
}),
),
switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return lightAccentColor;
}
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return lightAccentColor;
}
return null;
}),
));
fontFamily: GoogleFonts.poppins().fontFamily,
brightness: Brightness.light,
colorScheme: ColorScheme.fromSwatch(
primarySwatch: primarySwatch,
accentColor: lightAccentColor,
).copyWith(
primary: lightAccentColor,
secondary: lightAccentColor,
tertiary: detailColor,
background: Colors.white,
),
indicatorColor: lightAccentColor,
inputDecorationTheme: const InputDecorationTheme(
fillColor: lightTextFieldColor,
),
);

static final darkTheme = ThemeData(
useMaterial3: false,
useMaterial3: true,
fontFamily: GoogleFonts.poppins().fontFamily,
canvasColor: Colors.black,
cardColor: Colors.black,
appBarTheme: const AppBarTheme(
color: detailColor,
titleTextStyle: TextStyle(color: Colors.white, fontSize: 20),
Expand All @@ -131,52 +77,5 @@ class Themes {
inputDecorationTheme: const InputDecorationTheme(
fillColor: textFieldColor,
),
textTheme: const TextTheme(headlineMedium: TextStyle(color: Colors.white)),
checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return accentColor;
}
return null;
}),
),
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return accentColor;
}
return null;
}),
),
switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return accentColor;
}
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return accentColor;
}
return null;
}),
),
);
}

0 comments on commit 815b231

Please sign in to comment.