-
Notifications
You must be signed in to change notification settings - Fork 6
/
themes.dart
60 lines (54 loc) · 2.13 KB
/
themes.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//Applying dark & light themes in flutter
//code snippet taken from abuanwar072 (applied some of my own changes too)
import 'package:colorCode.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
// let's add light theme on our app
ThemeData lightThemeData(BuildContext context) {
return ThemeData.light().copyWith(
primaryColor: kPrimaryColor,
scaffoldBackgroundColor: Colors.white,
appBarTheme: appBarTheme,
iconTheme: IconThemeData(color: kContentColorLightTheme),
textTheme: GoogleFonts.interTextTheme(Theme.of(context).textTheme)
.apply(bodyColor: kContentColorLightTheme),
colorScheme: ColorScheme.light(
primary: kPrimaryColor,
secondary: kSecondaryColor,
error: kErrorColor,
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Colors.white,
selectedItemColor: kContentColorLightTheme.withOpacity(0.7),
unselectedItemColor: kContentColorLightTheme.withOpacity(0.32),
selectedIconTheme: IconThemeData(color: kPrimaryColor),
showUnselectedLabels: true,
),
);
}
// Let's apply dark theme on our app
ThemeData darkThemeData(BuildContext context) {
// Bydefault flutter provie us light and dark theme
// we just modify it as our need
return ThemeData.dark().copyWith(
primaryColor: kPrimaryColor,
scaffoldBackgroundColor: kContentColorLightTheme,
appBarTheme: appBarTheme,
iconTheme: IconThemeData(color: kContentColorDarkTheme),
textTheme: GoogleFonts.interTextTheme(Theme.of(context).textTheme)
.apply(bodyColor: kContentColorDarkTheme),
colorScheme: ColorScheme.dark().copyWith(
primary: kPrimaryColor,
secondary: kSecondaryColor,
error: kErrorColor,
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: kContentColorLightTheme,
selectedItemColor: Colors.white70,
unselectedItemColor: kContentColorDarkTheme.withOpacity(0.32),
selectedIconTheme: IconThemeData(color: kPrimaryColor),
showUnselectedLabels: true,
),
);
}
final appBarTheme = AppBarTheme(centerTitle: false, elevation: 0);