diff --git a/open_earable/lib/apps_tab/apps_tab.dart b/open_earable/lib/apps_tab/apps_tab.dart index b58aea3..9cfd341 100644 --- a/open_earable/lib/apps_tab/apps_tab.dart +++ b/open_earable/lib/apps_tab/apps_tab.dart @@ -30,7 +30,7 @@ class AppsTab extends StatelessWidget { const AppsTab(this._openEarable, {super.key}); - List sampleApps(BuildContext context) { + static List sampleApps(BuildContext context, OpenEarable openEarable) { return [ AppInfo( logoPath: "lib/apps_tab/recorder/assets/logo.png", @@ -43,7 +43,7 @@ class AppsTab extends StatelessWidget { builder: (context) => Material( child: Theme( data: materialTheme, - child: Recorder(_openEarable), + child: Recorder(openEarable), ), ), ), @@ -63,8 +63,8 @@ class AppsTab extends StatelessWidget { child: Theme( data: materialTheme, child: PostureTrackerView( - EarableAttitudeTracker(_openEarable), - _openEarable, + EarableAttitudeTracker(openEarable), + openEarable, ), ), ), @@ -85,7 +85,7 @@ class AppsTab extends StatelessWidget { child: Theme( data: materialTheme, child: Material( - child: JumpHeightTest(_openEarable), + child: JumpHeightTest(openEarable), ), ), ), @@ -105,7 +105,7 @@ class AppsTab extends StatelessWidget { builder: (context) => Material( child: Theme( data: materialTheme, - child: JumpRopeCounter(_openEarable), + child: JumpRopeCounter(openEarable), ), ), ), @@ -123,7 +123,7 @@ class AppsTab extends StatelessWidget { builder: (context) => Material( child: Theme( data: materialTheme, - child: StepCounter(_openEarable), + child: StepCounter(openEarable), ), ), ), @@ -142,7 +142,7 @@ class AppsTab extends StatelessWidget { builder: (context) => Material( child: Theme( data: materialTheme, - child: SleepHomeScreen(_openEarable), + child: SleepHomeScreen(openEarable), ), ), ), @@ -161,7 +161,7 @@ class AppsTab extends StatelessWidget { builder: (context) => Material( child: Theme( data: materialTheme, - child: TightnessMeter(_openEarable), + child: TightnessMeter(openEarable), ), ), ), @@ -180,8 +180,8 @@ class AppsTab extends StatelessWidget { child: Theme( data: materialTheme, child: StretchAppView( - EarableAttitudeTracker(_openEarable), - _openEarable, + EarableAttitudeTracker(openEarable), + openEarable, ), ), ), @@ -195,7 +195,7 @@ class AppsTab extends StatelessWidget { @override Widget build(BuildContext context) { - List apps = sampleApps(context); + List apps = sampleApps(context, _openEarable); return Padding( padding: const EdgeInsets.only(top: 5), diff --git a/open_earable/lib/grid_home_page.dart b/open_earable/lib/grid_home_page.dart index 3d804d1..7872533 100644 --- a/open_earable/lib/grid_home_page.dart +++ b/open_earable/lib/grid_home_page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:open_earable/apps_tab/apps_tab.dart'; import 'package:open_earable/ble/ble_controller.dart'; import 'package:open_earable/ble/ble_tab_bar_page.dart'; import 'package:open_earable/controls_tab/models/open_earable_settings_v2.dart'; @@ -53,9 +54,21 @@ class _InternalGridHomePage extends StatelessWidget { @override Widget build(BuildContext context) { + List sampleApps = AppsTab.sampleApps(context, openEarable); + return Scaffold( backgroundColor: Theme.of(context).colorScheme.surface, appBar: AppBar( + leading: Builder( + builder: (context) { + return IconButton( + icon: const Icon(Icons.menu), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ); + }, + ), title: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -89,6 +102,33 @@ class _InternalGridHomePage extends StatelessWidget { ), ], ), + drawer: Drawer( + child: ListView( + padding: EdgeInsets.zero, + children: sampleApps.map((appInfo) { + return ListTile( + leading: SizedBox( + height: 30.0, + width: 30.0, + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Image.asset( + appInfo.logoPath, + fit: BoxFit.cover, + ), + ), + ), + title: Text(appInfo.title), + subtitle: Text(appInfo.description), + onTap: () { + // Close the drawer before launching the app + Navigator.of(context).pop(); + appInfo.onTap(); + }, + ); + }).toList(), + ), + ), body: SquareChildrenGrid( precalculatedRows: precalculatedRows, precalculatedColumns: precalculatedColumns,