Theme Mode #2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
/*import 'package:flutter/material.dart';
|
||||
import 'theme_type.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
@@ -36,4 +36,54 @@ class AppThemes {
|
||||
),
|
||||
);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';import 'theme_type.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
class AppThemes {
|
||||
static ThemeData getLightTheme(ThemeType type) {
|
||||
final Color seedColor = _getSeedColor(type);
|
||||
final colorScheme = ColorScheme.fromSeed(
|
||||
seedColor: seedColor,
|
||||
brightness: Brightness.light,
|
||||
);
|
||||
return ThemeData.from(
|
||||
colorScheme: colorScheme,
|
||||
useMaterial3: true,
|
||||
textTheme: GoogleFonts.rubikTextTheme(),
|
||||
).copyWith(
|
||||
scaffoldBackgroundColor: Colors.white,
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||
backgroundColor: colorScheme.surface,
|
||||
),
|
||||
);
|
||||
}
|
||||
static ThemeData getDarkTheme(ThemeType type) {
|
||||
final Color seedColor = _getSeedColor(type);
|
||||
final colorScheme = ColorScheme.fromSeed(
|
||||
seedColor: seedColor,
|
||||
brightness: Brightness.dark, // Use dark brightness
|
||||
);
|
||||
return ThemeData.from(
|
||||
colorScheme: colorScheme,
|
||||
useMaterial3: true,
|
||||
textTheme: GoogleFonts.rubikTextTheme(
|
||||
ThemeData(brightness: Brightness.dark).textTheme,
|
||||
),
|
||||
);
|
||||
}
|
||||
static Color _getSeedColor(ThemeType type) {
|
||||
switch (type) {
|
||||
case ThemeType.green:
|
||||
return Colors.green;
|
||||
case ThemeType.orange:
|
||||
return Colors.orange;
|
||||
case ThemeType.blue:
|
||||
return Colors.blue;
|
||||
case ThemeType.violet:
|
||||
default:
|
||||
return Colors.deepPurple;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user