Skip to content

Commit 661f60e

Browse files
committed
Dark mode v1
1 parent 5a12065 commit 661f60e

File tree

4 files changed

+12
-26
lines changed

4 files changed

+12
-26
lines changed

assets/icons/menu_dark.svg

+1
Loading

lib/samples/home_screen.dart

+11-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ class _HomeScreenState extends State<HomeScreen> {
1414
double scaleFactor = 1;
1515
bool isDrawerOpen = false;
1616
double borderRadius = 0;
17+
bool isDark = false;
1718

1819
@override
1920
Widget build(BuildContext context) {
2021
return AnimatedContainer(
2122
decoration: BoxDecoration(
2223
borderRadius: BorderRadius.circular(borderRadius),
23-
color: Colors.white,
24+
color: isDark ? Color(0xff373a40) : Colors.white,
2425
boxShadow: [kDefaultShadow],
2526
),
2627
transform: Matrix4.translationValues(xOffset, yOffset, 0)
@@ -38,7 +39,10 @@ class _HomeScreenState extends State<HomeScreen> {
3839
children: [
3940
isDrawerOpen
4041
? IconButton(
41-
icon: Icon(Icons.arrow_back_ios),
42+
icon: Icon(
43+
Icons.arrow_back_ios,
44+
color: isDark ? Colors.white : Colors.black,
45+
),
4246
onPressed: () {
4347
setState(() {
4448
xOffset = 0;
@@ -50,7 +54,9 @@ class _HomeScreenState extends State<HomeScreen> {
5054
},
5155
)
5256
: IconButton(
53-
icon: SvgPicture.asset('assets/icons/menu.svg'),
57+
icon: isDark
58+
? SvgPicture.asset('assets/icons/menu_dark.svg')
59+
: SvgPicture.asset('assets/icons/menu.svg'),
5460
onPressed: () {
5561
setState(() {
5662
xOffset = 230;
@@ -64,14 +70,14 @@ class _HomeScreenState extends State<HomeScreen> {
6470
'Title101',
6571
style: TextStyle(
6672
fontSize: 20,
67-
color: Colors.black,
73+
color: isDark ? Colors.white : Colors.black,
6874
fontWeight: FontWeight.bold,
6975
),
7076
),
7177
IconButton(
7278
icon: Icon(
7379
Icons.search,
74-
color: Colors.black,
80+
color: isDark ? Colors.white : Colors.black,
7581
size: 30,
7682
),
7783
onPressed: null,

lib/samples/top_app_bar_drawer.dart

-20
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@ class TopBar extends StatelessWidget {
1212
return Scaffold(
1313
key: _scaffoldKey,
1414
backgroundColor: kBackgroundColor,
15-
// appBar: AppBar(
16-
// backgroundColor: Colors.transparent,
17-
// elevation: 0,
18-
// leading: IconButton(
19-
// icon: SvgPicture.asset('assets/icons/menu.svg'),
20-
// onPressed: () => _scaffoldKey.currentState.openDrawer(),
21-
// ),
22-
// actions: [
23-
// Padding(
24-
// padding: EdgeInsets.only(right: 8.0),
25-
// child: IconButton(
26-
// icon: Icon(
27-
// Icons.search,
28-
// color: Colors.black,
29-
// ),
30-
// onPressed: null,
31-
// ),
32-
// ),
33-
// ],
34-
// ),
3515
body: Stack(
3616
children: [
3717
DrawerScreen(),

pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ flutter:
2626

2727
uses-material-design: true
2828

29-
# To add assets to your application, add an assets section, like this:
3029
assets:
3130
- assets/icons/
3231
- assets/lottie/

0 commit comments

Comments
 (0)