Skip to content

Commit 937ff0c

Browse files
committed
Reduced by 48 lines
1 parent 3da7fca commit 937ff0c

1 file changed

Lines changed: 15 additions & 64 deletions

File tree

lib/ui_elements/my_navigation_bar.dart

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ class MyNavigationBar extends StatelessWidget {
3131
width: 200,
3232
decoration: BoxDecoration(
3333
color: theme.colorScheme.surface,
34-
boxShadow: [
35-
BoxShadow(
36-
blurRadius: 12,
37-
spreadRadius: 2,
38-
)
39-
],
34+
boxShadow: [BoxShadow(blurRadius: 12, spreadRadius: 2)],
4035
),
4136
child: Column(
4237
children: [
@@ -50,11 +45,7 @@ class MyNavigationBar extends StatelessWidget {
5045
const Spacer(),
5146
Padding(
5247
padding: EdgeInsetsGeometry.only(bottom: 4),
53-
child: Divider(
54-
thickness: 1,
55-
height: 1,
56-
color: theme.colorScheme.primary,
57-
),
48+
child: Divider(thickness: 1, height: 1, color: theme.colorScheme.primary),
5849
),
5950
MyNavigationBarItem(
6051
icon: items.last.icon,
@@ -65,11 +56,7 @@ class MyNavigationBar extends StatelessWidget {
6556
],
6657
),
6758
),
68-
VerticalDivider(
69-
thickness: 1,
70-
width: 1,
71-
color: theme.colorScheme.primary,
72-
),
59+
VerticalDivider(thickness: 1, width: 1, color: theme.colorScheme.primary),
7360
Expanded(child: body),
7461
],
7562
),
@@ -82,47 +69,24 @@ class MyNavigationBar extends StatelessWidget {
8269
backgroundColor: theme.colorScheme.surface,
8370
selectedIndex: selectedIndex,
8471
labelType: NavigationRailLabelType.all,
85-
selectedIconTheme: IconThemeData(
86-
color: theme.colorScheme.primary,
87-
size: 30,
88-
),
89-
unselectedIconTheme: IconThemeData(
90-
color: theme.colorScheme.outline,
91-
size: 25,
92-
),
93-
selectedLabelTextStyle: TextStyle(
94-
color: theme.colorScheme.primary,
95-
fontWeight: FontWeight.bold,
96-
),
97-
unselectedLabelTextStyle: TextStyle(
98-
color: theme.colorScheme.outline,
99-
),
72+
selectedIconTheme: IconThemeData(color: theme.colorScheme.primary, size: 30),
73+
unselectedIconTheme: IconThemeData(color: theme.colorScheme.outline, size: 25),
74+
selectedLabelTextStyle: TextStyle(color: theme.colorScheme.primary, fontWeight: FontWeight.bold),
75+
unselectedLabelTextStyle: TextStyle(color: theme.colorScheme.outline),
10076
onDestinationSelected: onItemSelected,
10177
destinations: [
10278
for (final item in items)
103-
NavigationRailDestination(
104-
icon: Icon(item.icon),
105-
label: Text(item.label),
106-
),
79+
NavigationRailDestination(icon: Icon(item.icon), label: Text(item.label)),
10780
],
10881
),
109-
VerticalDivider(
110-
thickness: 1,
111-
width: 1,
112-
color: theme.colorScheme.primary,
113-
),
82+
VerticalDivider(thickness: 1, width: 1, color: theme.colorScheme.primary),
11483
Expanded(child: body),
11584
],
11685
),
11786
);
11887
} else {
11988
return Scaffold(
120-
appBar: AppBar(
121-
title: Text(
122-
title,
123-
),
124-
backgroundColor: theme.colorScheme.primaryContainer,
125-
),
89+
appBar: AppBar(title: Text(title), backgroundColor: theme.colorScheme.primaryContainer),
12690
drawer: Drawer(
12791
backgroundColor: theme.colorScheme.surface,
12892
child: Column(
@@ -132,11 +96,7 @@ class MyNavigationBar extends StatelessWidget {
13296
alignment: Alignment.centerLeft,
13397
child: Text(
13498
'CodeJudge',
135-
style: TextStyle(
136-
fontSize: 30,
137-
fontWeight: FontWeight.bold,
138-
color: theme.colorScheme.primary,
139-
),
99+
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold, color: theme.colorScheme.primary)
140100
),
141101
),
142102
),
@@ -151,10 +111,7 @@ class MyNavigationBar extends StatelessWidget {
151111
onTap: () => onItemSelected(i),
152112
),
153113
const Spacer(),
154-
Divider(
155-
thickness: 1,
156-
height: 1,
157-
),
114+
Divider(thickness: 1, height: 1),
158115
MyNavigationBarItem(
159116
icon: items.last.icon,
160117
label: items.last.label,
@@ -205,9 +162,7 @@ class MyNavigationBarItem extends StatelessWidget {
205162
duration: const Duration(milliseconds: 180),
206163
curve: Curves.easeOut,
207164
decoration: BoxDecoration(
208-
color: selected
209-
? theme.colorScheme.primary.withOpacity(0.12)
210-
: Colors.transparent,
165+
color: selected ? theme.colorScheme.primary.withOpacity(0.12) : Colors.transparent,
211166
borderRadius: BorderRadius.circular(8),
212167
),
213168
child: InkWell(
@@ -220,9 +175,7 @@ class MyNavigationBarItem extends StatelessWidget {
220175
Icon(
221176
icon,
222177
size: 24,
223-
color: selected
224-
? theme.colorScheme.primary
225-
: theme.colorScheme.onSurface.withOpacity(0.8),
178+
color: selected ? theme.colorScheme.primary : theme.colorScheme.onSurface.withOpacity(0.8),
226179
),
227180
const SizedBox(width: 12),
228181
Text(
@@ -231,9 +184,7 @@ class MyNavigationBarItem extends StatelessWidget {
231184
fontFamily: "SourceCodePro",
232185
fontSize: 15,
233186
fontWeight: selected ? FontWeight.bold : FontWeight.normal,
234-
color: selected
235-
? theme.colorScheme.primary
236-
: theme.colorScheme.onSurface.withOpacity(0.8),
187+
color: selected ? theme.colorScheme.primary : theme.colorScheme.onSurface.withOpacity(0.8),
237188
),
238189
),
239190
],

0 commit comments

Comments
 (0)