Skip to content

Commit 102edf4

Browse files
hrideshmgmdmohsin7
andcommitted
fix: migrate navigation rail to built in package
Co-authored-by: Mohammed Mohsin <[email protected]>
1 parent 9ef6930 commit 102edf4

File tree

3 files changed

+60
-68
lines changed

3 files changed

+60
-68
lines changed

lib/screens/home.dart

Lines changed: 59 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
66
import 'package:flutter_markdown/flutter_markdown.dart';
77
import 'package:flutter_svg/flutter_svg.dart';
8-
import 'package:navigation_rail/navigation_rail.dart';
98

109
import 'package:ccxgui/bloc/process_bloc/process_bloc.dart';
1110
import 'package:ccxgui/bloc/updater_bloc/updater_bloc.dart';
@@ -75,66 +74,71 @@ class _HomeState extends State<Home> {
7574
context, 'You are already on the latest version');
7675
}
7776
},
78-
child: NavRail(
79-
desktopBreakpoint: 1150,
80-
hideTitleBar: true,
81-
drawerHeaderBuilder: (context) {
82-
return Column(
83-
mainAxisAlignment: MainAxisAlignment.center,
84-
children: <Widget>[
85-
DrawerHeader(
86-
child: SvgPicture.asset(
77+
child: Row(
78+
children: <Widget>[
79+
NavigationRail(
80+
extended: true,
81+
selectedIndex: _currentIndex,
82+
onDestinationSelected: (int index) {
83+
setState(() {
84+
_currentIndex = index;
85+
});
86+
},
87+
selectedLabelTextStyle: TextStyle(
88+
color: Theme.of(context).colorScheme.secondary,
89+
),
90+
unselectedIconTheme: IconThemeData(color: Colors.white54),
91+
unselectedLabelTextStyle: TextStyle(color: Colors.white54),
92+
leading: Column(
93+
children: [
94+
SizedBox(height: 20),
95+
SvgPicture.asset(
8796
logo,
8897
semanticsLabel: 'CCExtractor Logo',
98+
height: 120,
8999
),
100+
_CheckForUpdatesButton(),
101+
],
102+
),
103+
destinations: const <NavigationRailDestination>[
104+
NavigationRailDestination(
105+
icon: Icon(Icons.dashboard),
106+
label: Text('Dashboard'),
107+
),
108+
NavigationRailDestination(
109+
icon: Icon(Icons.settings),
110+
label: Text('Basic Settings'),
111+
),
112+
NavigationRailDestination(
113+
icon: Icon(Icons.input),
114+
label: Text('Input Settings'),
115+
),
116+
NavigationRailDestination(
117+
icon: Icon(Icons.dvr_outlined),
118+
label: Text('Output Settings'),
119+
),
120+
NavigationRailDestination(
121+
icon: Icon(Icons.search),
122+
label: Text('HardSubx Settings'),
123+
),
124+
NavigationRailDestination(
125+
icon: Icon(Icons.extension),
126+
label: Text('Obscure Settings'),
90127
),
91-
_CheckForUpdatesButton()
92128
],
93-
);
94-
},
95-
currentIndex: _currentIndex,
96-
onTap: (val) {
97-
if (mounted && _currentIndex != val) {
98-
setState(() {
99-
_currentIndex = val;
100-
});
101-
}
102-
},
103-
body: IndexedStack(
104-
index: _currentIndex,
105-
children: <Widget>[
106-
Dashboard(),
107-
BasicSettingsScreen(),
108-
InputSettingsScreen(),
109-
OutputSettingsScreen(),
110-
HardSubxSettingsScreen(),
111-
ObscureSettingsScreen(),
112-
],
113-
),
114-
tabs: <BottomNavigationBarItem>[
115-
BottomNavigationBarItem(
116-
label: 'Dashboard',
117-
icon: Icon(Icons.dashboard),
118-
),
119-
BottomNavigationBarItem(
120-
label: 'Basic Settings',
121-
icon: Icon(Icons.settings),
122-
),
123-
BottomNavigationBarItem(
124-
label: 'Input Settings',
125-
icon: Icon(Icons.input),
126129
),
127-
BottomNavigationBarItem(
128-
label: 'Output Settings',
129-
icon: Icon(Icons.dvr_outlined),
130-
),
131-
BottomNavigationBarItem(
132-
label: 'HardSubx Settings',
133-
icon: Icon(Icons.search),
134-
),
135-
BottomNavigationBarItem(
136-
label: 'Obscure Settings',
137-
icon: Icon(Icons.do_disturb_alt_rounded),
130+
Expanded(
131+
child: IndexedStack(
132+
index: _currentIndex,
133+
children: <Widget>[
134+
Dashboard(),
135+
BasicSettingsScreen(),
136+
InputSettingsScreen(),
137+
OutputSettingsScreen(),
138+
HardSubxSettingsScreen(),
139+
ObscureSettingsScreen(),
140+
],
141+
),
138142
),
139143
],
140144
),

pubspec.lock

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,7 @@ packages:
520520
sha256: ac49ddf0aff89cde42f60cac9959a682e8a035de7c3fe4f2626c31d15b6c9809
521521
url: "https://pub.dev"
522522
source: hosted
523-
version: "0.1.4"
524-
navigation_rail:
525-
dependency: "direct main"
526-
description:
527-
path: "."
528-
ref: HEAD
529-
resolved-ref: b3a0b2372366b0dd99c61446b331200f0af90962
530-
url: "https://[email protected]/Techno-Disaster/navigation_rail.git"
531-
source: git
532-
version: "1.6.0-dev.1"
523+
version: "0.2.0"
533524
nested:
534525
dependency: transitive
535526
description:

pubspec.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ dependencies:
2626
localstorage:
2727
git:
2828
url: https://[email protected]/Techno-Disaster/flutter_localstorage.git
29-
navigation_rail:
30-
git:
31-
url: https://[email protected]/Techno-Disaster/navigation_rail.git
3229
path_provider: ^2.0.2
3330
percent_indicator: ^3.0.1
3431
url_launcher: ^6.0.9

0 commit comments

Comments
 (0)