From adcd5f9b9241dd9f46f884e47dd09258bef92fcf Mon Sep 17 00:00:00 2001 From: Yannick Mauray Date: Mon, 8 Nov 2021 00:39:48 +0100 Subject: [PATCH] New hamburger menu --- lib/src/pages/main_page.dart | 8 ++------ lib/src/widgets/left_menu.dart | 21 +++++++++++++++++++++ pubspec.yaml | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 lib/src/widgets/left_menu.dart diff --git a/lib/src/pages/main_page.dart b/lib/src/pages/main_page.dart index 097e493..0eeb772 100644 --- a/lib/src/pages/main_page.dart +++ b/lib/src/pages/main_page.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:quickgui/src/widgets/home_page/logo.dart'; import 'package:quickgui/src/widgets/home_page/main_menu.dart'; +import 'package:quickgui/src/widgets/left_menu.dart'; class MainPage extends StatefulWidget { const MainPage({Key? key, required this.title}) : super(key: key); @@ -19,13 +20,8 @@ class _MainPageState extends State { return Scaffold( appBar: AppBar( title: const Text('Main menu'), - leading: IconButton( - onPressed: () { - exit(0); - }, - icon: const Icon(Icons.exit_to_app), - ), ), + drawer: const LeftMenu(), body: Column( children: const [ Logo(), diff --git a/lib/src/widgets/left_menu.dart b/lib/src/widgets/left_menu.dart new file mode 100644 index 0000000..ae49130 --- /dev/null +++ b/lib/src/widgets/left_menu.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; +import 'package:quickgui/src/mixins/version_mixin.dart'; + +class LeftMenu extends StatelessWidget with VersionMixin { + const LeftMenu({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + var _version = version + ' (' + buildNumber + ')'; + return Drawer( + child: ListView( + children: [ + ListTile( + title: Text("quickgui $_version", style: Theme.of(context).textTheme.headline6), + ), + const Divider(), + ], + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index b846e2d..92c17f5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,6 +43,7 @@ dependencies: tuple: ^2.0.0 file_picker: ^4.1.6 shared_preferences: ^2.0.8 + package_info_plus: ^1.3.0 dev_dependencies: flutter_test: