Skip to content

Commit 54fe2cd

Browse files
committed
fixed linting errors
1 parent fb03469 commit 54fe2cd

File tree

2 files changed

+132
-132
lines changed

2 files changed

+132
-132
lines changed

lib/config/theme_switcher_clipper.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: library_private_types_in_public_api
2+
13
import 'package:flutter/material.dart';
24

35
class ThemeSwitcherClipper extends StatefulWidget {
@@ -7,7 +9,8 @@ class ThemeSwitcherClipper extends StatefulWidget {
79
const ThemeSwitcherClipper({
810
Key? key,
911
required this.isDarkMode,
10-
required this.onTap, required Icon child,
12+
required this.onTap,
13+
required Icon child,
1114
}) : super(key: key);
1215

1316
@override
@@ -23,13 +26,13 @@ class _ThemeSwitcherClipperState extends State<ThemeSwitcherClipper> {
2326
},
2427
child: ClipOval(
2528
child: Hero(
26-
tag: 'theme_switcher',
27-
child: Container(
28-
width: 60,
29-
height: 60,
29+
tag: 'theme_switcher',
30+
child: SizedBox(
31+
width: 60,
32+
height: 60,
3033
child: Center(
3134
child: AnimatedSwitcher(
32-
duration: Duration(seconds: 2),
35+
duration: const Duration(seconds: 2),
3336
child: Icon(
3437
widget.isDarkMode ? Icons.dark_mode : Icons.light_mode,
3538
key: ValueKey<bool>(widget.isDarkMode),
@@ -44,5 +47,3 @@ class _ThemeSwitcherClipperState extends State<ThemeSwitcherClipper> {
4447
);
4548
}
4649
}
47-
48-

lib/drawer/nav_drawer.dart

Lines changed: 123 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,158 @@
1+
// ignore_for_file: library_private_types_in_public_api
2+
13
import 'package:flutter/material.dart';
2-
import 'package:google_fonts/google_fonts.dart';
34

45
import 'package:taskwarrior/config/app_settings.dart';
56
import 'package:taskwarrior/model/storage/storage_widget.dart';
67
import 'package:taskwarrior/routes/pageroute.dart';
78
import 'package:taskwarrior/views/about/about.dart';
89
import 'package:taskwarrior/views/reports/reports_home.dart';
910
import 'package:taskwarrior/config/theme_switcher_clipper.dart';
11+
import 'package:taskwarrior/views/settings/settings.dart';
1012

1113
class NavDrawer extends StatefulWidget {
1214
final InheritedStorage storageWidget;
1315
final Function() notifyParent;
1416

15-
const NavDrawer(
16-
{Key? key, required this.storageWidget, required this.notifyParent})
17-
: super(key: key);
17+
const NavDrawer({
18+
Key? key,
19+
required this.storageWidget,
20+
required this.notifyParent,
21+
}) : super(key: key);
1822

1923
@override
20-
// ignore: library_private_types_in_public_api
2124
_NavDrawerState createState() => _NavDrawerState();
2225
}
2326

2427
class _NavDrawerState extends State<NavDrawer> {
25-
late InheritedStorage storageWidget = widget.storageWidget;
26-
2728
@override
2829
Widget build(BuildContext context) {
2930
return Drawer(
30-
backgroundColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
31-
child: ListView(
32-
padding: EdgeInsets.zero,
33-
children: [
34-
ListTile(
35-
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
36-
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
37-
contentPadding: const EdgeInsets.only(top: 40, left: 10),
38-
title: Row(
39-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
40-
children: [
41-
Text(
42-
'Menu',
43-
style: TextStyle(
44-
fontSize: 25,
45-
fontWeight: FontWeight.bold,
46-
),
47-
),
48-
Padding(
49-
padding: EdgeInsets.only(right: 10),
50-
child: ThemeSwitcherClipper(
51-
isDarkMode: AppSettings.isDarkMode,
52-
onTap: (bool newMode) async {
53-
AppSettings.isDarkMode = newMode;
31+
backgroundColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
32+
child: ListView(
33+
padding: EdgeInsets.zero,
34+
children: [
35+
ListTile(
36+
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
37+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
38+
contentPadding: const EdgeInsets.only(top: 40, left: 10),
39+
title: Row(
40+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
41+
children: [
42+
const Text(
43+
'Menu',
44+
style: TextStyle(
45+
fontSize: 25,
46+
fontWeight: FontWeight.bold,
47+
),
48+
),
49+
Padding(
50+
padding: const EdgeInsets.only(right: 10),
51+
child: ThemeSwitcherClipper(
52+
isDarkMode: AppSettings.isDarkMode,
53+
onTap: (bool newMode) async {
54+
AppSettings.isDarkMode = newMode;
55+
setState(() {});
56+
await SelectedTheme.saveMode(AppSettings.isDarkMode);
57+
widget.notifyParent();
58+
},
59+
child: Icon(
60+
AppSettings.isDarkMode
61+
? Icons.dark_mode
62+
: Icons.light_mode,
63+
color:
64+
AppSettings.isDarkMode ? Colors.white : Colors.black,
65+
size: 15,
66+
),
67+
),
68+
),
69+
],
70+
),
71+
onTap: () async {
72+
AppSettings.isDarkMode = !AppSettings.isDarkMode;
5473
setState(() {});
5574
await SelectedTheme.saveMode(AppSettings.isDarkMode);
5675
widget.notifyParent();
5776
},
58-
child: Icon(
59-
AppSettings.isDarkMode ? Icons.dark_mode : Icons.light_mode,
77+
),
78+
ListTile(
79+
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
80+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
81+
leading: Icon(
82+
Icons.person_rounded,
6083
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
61-
size: 15,
62-
children: [
63-
ListTile(
64-
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
65-
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
66-
contentPadding: const EdgeInsets.only(top: 40, left: 10),
67-
title: Text(
68-
'Menu',
69-
style: GoogleFonts.poppins(
70-
fontSize: 25,
71-
fontWeight: FontWeight.bold,
72-
),
73-
),
74-
onTap: () => Navigator.pop(context),
7584
),
85+
title: const Text('Profile'),
86+
onTap: () {
87+
Navigator.pushNamed(context, PageRoutes.profile);
88+
},
7689
),
77-
),
78-
],
79-
),
80-
onTap: () async {
81-
AppSettings.isDarkMode = !AppSettings.isDarkMode;
82-
setState(() {});
83-
await SelectedTheme.saveMode(AppSettings.isDarkMode);
84-
widget.notifyParent();
85-
},
86-
),
87-
ListTile(
88-
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
89-
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
90-
leading: Icon(
91-
Icons.person_rounded,
92-
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
93-
),
94-
title: const Text('Profile'),
95-
onTap: () {
96-
// Update the state of the app
97-
// ...
98-
Navigator.pushNamed(context, PageRoutes.profile);
99-
// Then close the drawer
100-
// Navigator.pop(context);
101-
},
90+
// Uncomment the following ListTile if you want to enable the "Refresh" button
91+
/*
92+
ListTile(
93+
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
94+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
95+
leading: Icon(
96+
Icons.refresh,
97+
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
10298
),
103-
//We dont need 2 sync buttons
104-
// ListTile(
105-
// tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
106-
// textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
107-
// leading: Icon(
108-
// Icons.refresh,
109-
// color: AppSettings.isDarkMode ? Colors.white : Colors.black,
110-
// ),
111-
// onTap: () {
112-
// Navigator.pop(context);
113-
// storageWidget.synchronize(context, true);
114-
// },
115-
// title: const Text("Refresh"),
116-
// ),
117-
ListTile(
118-
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
119-
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
120-
leading: Icon(
121-
Icons.summarize,
122-
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
123-
),
124-
onTap: () {
125-
Navigator.of(context).push(MaterialPageRoute(
126-
builder: (context) => const ReportsHome()));
127-
},
128-
title: const Text("Reports"),
99+
onTap: () {
100+
Navigator.pop(context);
101+
widget.storageWidget.synchronize(context, true);
102+
},
103+
title: const Text("Refresh"),
104+
),
105+
*/
106+
ListTile(
107+
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
108+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
109+
leading: Icon(
110+
Icons.summarize,
111+
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
129112
),
130-
ListTile(
131-
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
132-
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
133-
leading: Icon(
134-
Icons.info,
135-
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
136-
),
137-
onTap: () {
138-
Navigator.of(context).push(
139-
MaterialPageRoute(builder: (context) => const AboutPage()));
140-
},
141-
title: const Text("About"),
113+
onTap: () {
114+
Navigator.of(context).push(
115+
MaterialPageRoute(
116+
builder: (context) => const ReportsHome(),
117+
),
118+
);
119+
},
120+
title: const Text("Reports"),
121+
),
122+
ListTile(
123+
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
124+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
125+
leading: Icon(
126+
Icons.info,
127+
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
142128
),
143-
ListTile(
144-
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
145-
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
146-
leading: Icon(
147-
Icons.settings,
148-
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
149-
),
150-
onTap: () {
151-
Navigator.of(context).push(MaterialPageRoute(
152-
builder: (context) => const SettingsPage()));
153-
},
154-
title: const Text("Settings"),
129+
onTap: () {
130+
Navigator.of(context).push(
131+
MaterialPageRoute(
132+
builder: (context) => const AboutPage(),
133+
),
134+
);
135+
},
136+
title: const Text("About"),
137+
),
138+
ListTile(
139+
tileColor: AppSettings.isDarkMode ? Colors.black : Colors.white,
140+
textColor: AppSettings.isDarkMode ? Colors.white : Colors.black,
141+
leading: Icon(
142+
Icons.settings,
143+
color: AppSettings.isDarkMode ? Colors.white : Colors.black,
155144
),
156-
],
157-
));
145+
onTap: () {
146+
Navigator.of(context).push(
147+
MaterialPageRoute(
148+
builder: (context) => const SettingsPage(),
149+
),
150+
);
151+
},
152+
title: const Text("Settings"),
153+
),
154+
],
155+
),
156+
);
158157
}
159158
}

0 commit comments

Comments
 (0)