2023-03-18 16:55:08 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2023-04-06 22:46:40 +02:00
|
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
|
|
|
import 'package:voyagehandbook/views/downloads.dart';
|
2023-03-18 16:55:08 +01:00
|
|
|
import 'package:voyagehandbook/views/home.dart';
|
|
|
|
|
2023-04-06 22:46:40 +02:00
|
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
2023-03-18 16:55:08 +01:00
|
|
|
import '../views/search.dart';
|
|
|
|
|
2023-03-28 18:08:26 +02:00
|
|
|
/*
|
|
|
|
Voyage Handbook - The open-source WikiVoyage reader
|
|
|
|
Copyright (C) 2023 Matyáš Caras
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
2023-03-28 20:10:46 +02:00
|
|
|
it under the terms of the GNU General Public License version 3 as published by
|
|
|
|
the Free Software Foundation.
|
2023-03-28 18:08:26 +02:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-03-24 23:48:55 +01:00
|
|
|
/// Used to generate the drawer
|
|
|
|
///
|
|
|
|
/// Use `0` in `page` if you don't want any tile selected
|
2023-03-18 16:55:08 +01:00
|
|
|
Drawer genDrawer(int page, BuildContext context) => Drawer(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
|
|
|
DrawerHeader(
|
2023-03-24 23:48:55 +01:00
|
|
|
child: Column(
|
2023-04-06 22:46:40 +02:00
|
|
|
children: [
|
|
|
|
const Text(
|
2023-03-24 23:48:55 +01:00
|
|
|
"Voyage Handbook",
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
|
|
|
),
|
2023-04-06 22:46:40 +02:00
|
|
|
Text(AppLocalizations.of(context)!.creditsCreatedBy),
|
|
|
|
Text(AppLocalizations.of(context)!.creditsAffiliation)
|
2023-03-24 23:48:55 +01:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2023-03-18 16:55:08 +01:00
|
|
|
ListTile(
|
|
|
|
selected: page == 1,
|
|
|
|
title: const Text("Home"),
|
|
|
|
leading: const Icon(Icons.home),
|
|
|
|
onTap: () => page == 1
|
|
|
|
? Navigator.of(context).pop()
|
|
|
|
: Navigator.of(context).push(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (_) => const HomeView(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
selected: page == 2,
|
2023-04-06 22:46:40 +02:00
|
|
|
title: Text(AppLocalizations.of(context)!.search),
|
2023-03-18 16:55:08 +01:00
|
|
|
leading: const Icon(Icons.search),
|
|
|
|
onTap: () => page == 2
|
|
|
|
? Navigator.of(context).pop()
|
|
|
|
: Navigator.of(context).push(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (_) => const SearchView(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-04-03 15:47:53 +02:00
|
|
|
ListTile(
|
|
|
|
selected: page == 3,
|
2023-04-06 22:46:40 +02:00
|
|
|
title: Text(AppLocalizations.of(context)!.downloadsTitle),
|
|
|
|
leading: const Icon(Icons.search),
|
2023-04-03 15:47:53 +02:00
|
|
|
onTap: () => page == 3
|
2023-04-06 22:46:40 +02:00
|
|
|
? Navigator.of(context).pop()
|
|
|
|
: Navigator.of(context).push(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (_) => const DownloadsView(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
selected: page == 99,
|
|
|
|
title: Text(AppLocalizations.of(context)!.about),
|
|
|
|
leading: const Icon(Icons.info_outline),
|
|
|
|
onTap: () => page == 99
|
2023-04-03 15:47:53 +02:00
|
|
|
? Navigator.of(context).pop()
|
|
|
|
: Navigator.of(context).push(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (_) => const LicensePage(
|
|
|
|
applicationName: "Voyage Handbook",
|
|
|
|
applicationLegalese:
|
|
|
|
"Copyright ©️ 2023 Matyáš Caras,\nReleased under the GNU GPL version 3",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-04-06 22:46:40 +02:00
|
|
|
ListTile(
|
|
|
|
selected: page == 99,
|
|
|
|
title: Text(AppLocalizations.of(context)!.sourceCode),
|
|
|
|
leading: const Icon(Icons.code),
|
|
|
|
onTap: () => page == 99
|
|
|
|
? Navigator.of(context).pop()
|
|
|
|
: launchUrlString("https://git.mnau.xyz/hernik/voyagehandbook",
|
|
|
|
mode: LaunchMode.externalApplication),
|
|
|
|
),
|
2023-03-18 16:55:08 +01:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|