Skip to content

Commit

Permalink
make collapsible
Browse files Browse the repository at this point in the history
  • Loading branch information
praslnx8 committed Dec 31, 2023
1 parent ef26e8e commit 68aadc5
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions lib/ui/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MainPage extends StatefulWidget {

class _MainPageState extends State<MainPage> {
var _selectedIndex = 0;
var _isExtended = true;

@override
Widget build(BuildContext context) {
Expand All @@ -25,23 +26,31 @@ class _MainPageState extends State<MainPage> {
body: SafeArea(
child: Row(
children: [
NavigationRail(
extended: true,
onDestinationSelected: (value) {
GestureDetector(
onTap: () {
setState(() {
_selectedIndex = value;
_isExtended = !_isExtended;
});
},
destinations: const [
NavigationRailDestination(
icon: Icon(Icons.bookmark), label: Text('Goals')),
NavigationRailDestination(
icon: Icon(Icons.monetization_on),
label: Text('Investment')),
NavigationRailDestination(
icon: Icon(Icons.local_offer), label: Text('Baskets')),
],
selectedIndex: _selectedIndex),
child: NavigationRail(
extended: _isExtended,
onDestinationSelected: (value) {
setState(() {
_selectedIndex = value;
});
},
destinations: const [
NavigationRailDestination(
icon: Icon(Icons.bookmark), label: Text('Goals')),
NavigationRailDestination(
icon: Icon(Icons.monetization_on),
label: Text('Investment')),
NavigationRailDestination(
icon: Icon(Icons.local_offer),
label: Text('Baskets')),
],
selectedIndex: _selectedIndex)
),
const VerticalDivider(thickness: 1, width: 1),
Expanded(
child: Builder(
Expand Down

0 comments on commit 68aadc5

Please sign in to comment.