44 lines
1.4 KiB
Dart
44 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
import 'package:prasule/pw/platformroute.dart';
|
|
import 'package:prasule/views/graph_view.dart';
|
|
import 'package:prasule/views/home.dart';
|
|
|
|
/// Makes the drawer because I won't enter the same code in every view
|
|
Drawer makeDrawer(BuildContext context, int page) => Drawer(
|
|
child: ListView(
|
|
children: [
|
|
const DrawerHeader(child: Text("Prašule")),
|
|
ListTile(
|
|
leading: const Icon(Icons.home),
|
|
title: Text(
|
|
AppLocalizations.of(context).home,
|
|
),
|
|
selected: page == 1,
|
|
onTap: () {
|
|
if (page == 1) {
|
|
Navigator.of(context).pop();
|
|
return;
|
|
}
|
|
Navigator.of(context)
|
|
.pushReplacement(platformRoute((p0) => const HomeView()));
|
|
},
|
|
),
|
|
ListTile(
|
|
leading: const Icon(Icons.bar_chart),
|
|
title: Text(
|
|
AppLocalizations.of(context).graphs,
|
|
),
|
|
selected: page == 2,
|
|
onTap: () {
|
|
if (page == 2) {
|
|
Navigator.of(context).pop();
|
|
return;
|
|
}
|
|
Navigator.of(context)
|
|
.pushReplacement(platformRoute((p0) => const GraphView()));
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|