Compare commits
2 Commits
f5635d6120
...
d77e732551
Author | SHA1 | Date | |
---|---|---|---|
d77e732551 | |||
cc33458457 |
@ -7,10 +7,7 @@ import 'package:path/path.dart';
|
|||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
// Local
|
// Local
|
||||||
import '/models/frequency.dart';
|
|
||||||
import '/models/expense.dart';
|
import '/models/expense.dart';
|
||||||
|
|
||||||
// Leaned on this example:
|
// Leaned on this example:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Flutter
|
// Flutter
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
// Local
|
// Local
|
||||||
import '/pages/expense.dart';
|
import '/pages/expense.dart';
|
||||||
@ -67,51 +68,71 @@ class _HomePageState extends State<HomePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget navigation = NavigationRail(
|
||||||
|
extended: true,
|
||||||
|
destinations: [
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(Icons.payment),
|
||||||
|
label: Text('Expenses'),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(Icons.account_balance),
|
||||||
|
label: Text('Income'),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(Icons.attach_money),
|
||||||
|
label: Text('Liquid Assets'),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(Icons.bar_chart),
|
||||||
|
label: Text('Reports'),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(Icons.settings),
|
||||||
|
label: Text('Settings'),
|
||||||
|
),
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Icon(Icons.help),
|
||||||
|
label: Text('Help'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
selectedIndex: pageSelected,
|
||||||
|
onDestinationSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
pageSelected = value;
|
||||||
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget main = Container(
|
||||||
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
|
child: Center(child: page),
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget? drawer, body;
|
||||||
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
|
drawer = navigation;
|
||||||
|
body = main;
|
||||||
|
} else {
|
||||||
|
drawer = null;
|
||||||
|
body = Row(
|
||||||
|
children: [
|
||||||
|
SafeArea(child: navigation),
|
||||||
|
Expanded(child: main),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return LayoutBuilder(builder: (context, constraints) {
|
return LayoutBuilder(builder: (context, constraints) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Expense Tracker"),
|
title: Text("Expense Tracker"),
|
||||||
),
|
),
|
||||||
drawer: NavigationRail(
|
drawer: drawer,
|
||||||
extended: true,
|
body: body,
|
||||||
destinations: [
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(Icons.payment),
|
|
||||||
label: Text('Expenses'),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(Icons.account_balance),
|
|
||||||
label: Text('Income'),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(Icons.attach_money),
|
|
||||||
label: Text('Liquid Assets'),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(Icons.bar_chart),
|
|
||||||
label: Text('Reports'),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(Icons.settings),
|
|
||||||
label: Text('Settings'),
|
|
||||||
),
|
|
||||||
NavigationRailDestination(
|
|
||||||
icon: Icon(Icons.help),
|
|
||||||
label: Text('Help'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
selectedIndex: pageSelected,
|
|
||||||
onDestinationSelected: (value) {
|
|
||||||
setState(() {
|
|
||||||
pageSelected = value;
|
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
body: Container(
|
|
||||||
color: Theme.of(context).colorScheme.primaryContainer,
|
|
||||||
child: Center(child: page),
|
|
||||||
),
|
|
||||||
floatingActionButton: floatingButton,
|
floatingActionButton: floatingButton,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user