aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-06-05 21:33:12 +0530
committerAkshay Nair <phenax5@gmail.com>2020-06-05 21:33:12 +0530
commit83be047e15efd91a26ac27da1710b0e273706b19 (patch)
treecfa6e1b5ad78261a4bdf6e579447c242e55873e4
parentb66b37d3f6ccd1438077ecb67439365d080066ba (diff)
downloaddaft-launcher-83be047e15efd91a26ac27da1710b0e273706b19.tar.gz
daft-launcher-83be047e15efd91a26ac27da1710b0e273706b19.zip
Adds options menu with dummy refresh buttton
Diffstat (limited to '')
-rw-r--r--lib/components/AppContextMenu.dart29
-rw-r--r--lib/components/Option.dart30
-rw-r--r--lib/data/config.dart2
-rw-r--r--lib/pages/Home.dart69
4 files changed, 87 insertions, 43 deletions
diff --git a/lib/components/AppContextMenu.dart b/lib/components/AppContextMenu.dart
index 72d67aa..d648d0c 100644
--- a/lib/components/AppContextMenu.dart
+++ b/lib/components/AppContextMenu.dart
@@ -5,34 +5,7 @@ import 'package:android_intent/flag.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../data/favorites.dart';
-
-class Option extends StatelessWidget {
- void Function() onTap;
- Widget icon;
- Widget child;
-
- Option({ this.child, this.icon, this.onTap }): super();
-
- @override
- build(BuildContext ctx) {
- return Column(
- children: [
- ListTile(
- contentPadding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 16.0),
- title: Row(children: [
- Container(width: 36.0, padding: EdgeInsets.only(right: 16.0), child: icon),
- child,
- ]),
- onTap: () {
- onTap();
- Navigator.pop(ctx);
- },
- ),
- Divider(height: 1.0),
- ],
- );
- }
-}
+import 'Option.dart';
class AppContextMenu extends StatelessWidget {
final Application app;
diff --git a/lib/components/Option.dart b/lib/components/Option.dart
new file mode 100644
index 0000000..3460c8a
--- /dev/null
+++ b/lib/components/Option.dart
@@ -0,0 +1,30 @@
+import 'package:flutter/material.dart';
+
+class Option extends StatelessWidget {
+ void Function() onTap;
+ Widget icon;
+ Widget child;
+
+ Option({ this.child, this.icon, this.onTap }): super();
+
+ @override
+ build(BuildContext ctx) {
+ return Column(
+ children: [
+ ListTile(
+ contentPadding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 16.0),
+ title: Row(children: [
+ Container(width: 36.0, padding: EdgeInsets.only(right: 16.0), child: icon),
+ child,
+ ]),
+ onTap: () {
+ onTap();
+ Navigator.pop(ctx);
+ },
+ ),
+ Divider(height: 1.0),
+ ],
+ );
+ }
+}
+
diff --git a/lib/data/config.dart b/lib/data/config.dart
index 6bfd57f..01625d2 100644
--- a/lib/data/config.dart
+++ b/lib/data/config.dart
@@ -8,7 +8,7 @@ class Config {
Config({ this.isDark }) {}
bool isDarkMode() {
- return isDark;
+ return isDark == null ? defaultDarkMode : isDark;
}
}
diff --git a/lib/pages/Home.dart b/lib/pages/Home.dart
index b812288..1ce6d01 100644
--- a/lib/pages/Home.dart
+++ b/lib/pages/Home.dart
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:device_apps/device_apps.dart';
+import '../components/Option.dart';
import '../components/AppList.dart';
import '../components/FixedContainer.dart';
import '../data/config.dart';
@@ -15,6 +16,47 @@ class StatusInfoCard extends StatelessWidget {
final timeFormat = DateFormat('h:mm a'); // H fr 24 hrs
final dateFormat = DateFormat('EEEE, d MMM');
+ Widget buildOptionsMenu(BuildContext ctx) {
+ var theme = Theme.of(ctx);
+
+ return Dialog(
+ child: Container(
+ decoration: BoxDecoration(
+ color: theme.backgroundColor,
+ ),
+ height: 120.0,
+ child: ListView(
+ children: [
+ Option(
+ icon: Icon(
+ Icons.brightness_4,
+ color: theme.primaryColor,
+ size: 16.0,
+ semanticLabel: 'Toggle dark mode',
+ ),
+ child: Text('Toggle dark mode'),
+ onTap: toggleTheme,
+ ),
+ Option(
+ icon: Icon(
+ Icons.refresh,
+ color: theme.primaryColor,
+ size: 16.0,
+ semanticLabel: 'Refresh',
+ ),
+ child: Text('Refresh'),
+ onTap: () {},
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ void showOptions(BuildContext ctx) {
+ showDialog(context: ctx, builder: buildOptionsMenu);
+ }
+
@override
Widget build(BuildContext ctx) {
ThemeData theme = Theme.of(ctx);
@@ -53,20 +95,19 @@ class StatusInfoCard extends StatelessWidget {
Container(
width: 40,
height: 30,
- child: Text(''),
- //child: IconButton(
- //padding: const EdgeInsets.all(0.0),
- //visualDensity: const VisualDensity(vertical: 0.0, horizontal: 0.0),
- //icon: Icon(
- //Icons.brightness_4,
- //color: theme.primaryColor,
- //size: 16.0,
- //semanticLabel: 'Toggle dark mode',
- //),
- //tooltip: 'Toggle dark mode',
- //enableFeedback: true,
- //onPressed: () { toggleTheme(); }
- //),
+ child: IconButton(
+ padding: const EdgeInsets.all(0.0),
+ visualDensity: const VisualDensity(vertical: 0.0, horizontal: 0.0),
+ icon: Icon(
+ Icons.more_vert,
+ color: theme.primaryColor,
+ size: 20.0,
+ semanticLabel: 'Options',
+ ),
+ tooltip: 'Options',
+ enableFeedback: true,
+ onPressed: () => showOptions(ctx),
+ ),
),
],
),