From 3ad62745af3a23170635ace1c7e29e0df7a8ac13 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 2 Jun 2020 23:15:57 +0530 Subject: Creates dialog menu with dummy optios --- TODO.md | 2 ++ lib/pages/Apps.dart | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index f98087f..b1c79d9 100644 --- a/TODO.md +++ b/TODO.md @@ -4,6 +4,8 @@ - [X] Start writing tests - [X] Transision between pages between pages - [X] Find a way to preload both pages and stop from "loading" + - [ ] Figure out the importance of keys and add them as required + - [ ] Dark/List themes ## HomePage - [X] Create statusbar diff --git a/lib/pages/Apps.dart b/lib/pages/Apps.dart index 7252aae..d267f10 100644 --- a/lib/pages/Apps.dart +++ b/lib/pages/Apps.dart @@ -4,6 +4,30 @@ import 'package:device_apps/device_apps.dart'; import '../components/FixedContainer.dart'; import '../components/SearchableAppList.dart'; +class Option extends StatelessWidget { + void Function() onTap; + Widget child; + + Option({ this.child, this.onTap }): super(); + + @override + build(BuildContext ctx) { + return Column( + children: [ + ListTile( + contentPadding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 16.0), + title: child, + onTap: () { + onTap(); + Navigator.pop(ctx); + }, + ), + Divider(height: 1.0), + ], + ); + } +} + class AppsView extends StatelessWidget { Future> appListF = DeviceApps.getInstalledApplications( includeSystemApps: false, @@ -14,8 +38,29 @@ class AppsView extends StatelessWidget { DeviceApps.openApp(app.packageName); } - void openOptionsMenu(Application app) { - debugPrint('Wow'); + void openOptionsMenu(BuildContext ctx, Application app) { + showDialog(context: ctx, builder: (BuildContext ctx) => buildOptionsMenu(ctx, app)); + } + + Widget buildOptionsMenu(BuildContext ctx, Application app) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20.0), + ), + height: 300.0, + width: 300.0, + child: ListView( + children: [ + Option(child: Text('Cool'), onTap: () { debugPrint('Cool'); }), + Option(child: Text('Wow'), onTap: () { debugPrint('Wow'); }), + ], + ), + ), + ); } @override @@ -25,7 +70,7 @@ class AppsView extends StatelessWidget { child: SearchableAppList( appListF: appListF, openApp: openApp, - openOptionsMenu: openOptionsMenu, + openOptionsMenu: (app) => openOptionsMenu(ctx, app), ), ); } -- cgit v1.3.1