Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile/record sleep scaffold #54

Merged
merged 40 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
80675bb
Adding NavDrawer base
Oct 16, 2020
bb32cca
Fixing conflicts with bluetooth merge
Oct 16, 2020
9324a60
Adding auto_route
Oct 16, 2020
12f76b0
Adding .workspace to gitignore
Oct 16, 2020
c56840e
End of navdrawer base
Oct 16, 2020
8973d4c
Record sleep sample page
Oct 16, 2020
1d9399a
added assets directory
Oct 22, 2020
46201f2
auto_route code generated class
Oct 22, 2020
8cce627
App icon exports
Oct 22, 2020
52e42bd
record sleep pages
Oct 22, 2020
499dd6e
navigation drawer page & bloc
Oct 22, 2020
03fe21c
renaming bluetooth stuff
Oct 22, 2020
f505f6e
blocs barrel file for exports
Oct 22, 2020
e7f35f7
adding dashboard page
Oct 22, 2020
cd46f17
adding assets and app icon to pubspect file
Oct 22, 2020
16bbe80
unused import
Oct 22, 2020
45679e8
NavDrawer with selection
mateobelanger Oct 29, 2020
06311d6
added pageView slider to sleep guide
mateobelanger Oct 29, 2020
626b1a2
adding sliverbar to dashboard
mateobelanger Oct 29, 2020
1b7e7bf
removed unused file
mateobelanger Oct 29, 2020
f3d696b
adding mock chart
mateobelanger Oct 29, 2020
39e4b47
Merge remote-tracking branch 'origin/master' into mobile/record-sleep…
Nov 3, 2020
1fdf509
Various lint fixes
Nov 3, 2020
a117972
Update .gitignore
mateobelanger Nov 3, 2020
92e68ea
Update .gitignore
mateobelanger Nov 3, 2020
4fbeabe
Update mobile/lib/src/application/navdrawer/navdrawer_bloc.dart
mateobelanger Nov 3, 2020
d2cb47c
Nit fixes for pull request
Nov 3, 2020
aaa10ab
NavDrawer fix to respect stateless widget coherence
Nov 3, 2020
be75b77
typo in workflow file
Nov 3, 2020
acb8494
Update router.dart
mateobelanger Nov 3, 2020
930a148
Revert "adding mock chart"
Nov 3, 2020
54fd08e
Merge remote-tracking branch 'origin/mobile/record-sleep-scaffold' in…
Nov 3, 2020
21d85e1
Fixes to temporarily remove Charts package
Nov 3, 2020
9a99b06
Removed polydodo-mobile.workspace and moved to private settings file
Nov 3, 2020
496ef2f
Keeping launch.json mobile config file
Nov 3, 2020
9e69354
Fix git bug
abelfodil Nov 3, 2020
d788a79
Delete .gitignore
abelfodil Nov 4, 2020
aa21ee2
Smoother animations for Navdrawer
Nov 5, 2020
35d50b0
Navdrawer without bloc
Nov 5, 2020
6c29255
Update README.md
mateobelanger Nov 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
mobile/pubspec.lock
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved

mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
mobile/polydodo-mobile.code-workspace
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
Binary file modified mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/common/assets/img/Material-Wallpaper.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/common/assets/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/common/assets/img/logo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions mobile/lib/src/app.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:polydodo/src/presentation/bluetooth_route/bluetoothSelector_route.dart';

import 'locator.dart';
import 'presentation/navigation/routes/router.gr.dart' as auto_router;
import 'theme.dart';

class App extends StatelessWidget {
Expand All @@ -18,10 +19,14 @@ class App extends StatelessWidget {
child: MaterialApp(
title: 'PolyDodo',
theme: theme,
initialRoute: BluetoothSelectorRoute.name,
builder: ExtendedNavigator.builder<auto_router.Router>(
router: auto_router.Router()),
/*home: WalletsRoute(),
initialRoute: WalletsRoute.name,
routes: {
BluetoothSelectorRoute.name: (context) => BluetoothSelectorRoute(),
},
WalletsRoute.name: (context) => WalletsRoute(),
}, */
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
),
);
}
Expand Down
3 changes: 3 additions & 0 deletions mobile/lib/src/application/blocs.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export './device/device_selector_cubit.dart';
export './eeg_data/data_cubit.dart';
export './navdrawer/navdrawer_bloc.dart';
abelfodil marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 2 additions & 1 deletion mobile/lib/src/application/eeg_data/data_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:polydodo/src/domain/acquisition_device/i_acquisition_device_repository.dart';
import 'package:polydodo/src/domain/eeg_data/i_eeg_data_repository.dart';

import 'data_states.dart';
import 'package:bloc/bloc.dart';
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
import 'package:flutter_bloc/flutter_bloc.dart';

part './data_states.dart';

class DataCubit extends Cubit<DataState> {
final IAcquisitionDeviceRepository _deviceRepository;
final IEEGDataRepository _eegDataRepository;
Expand Down
2 changes: 2 additions & 0 deletions mobile/lib/src/application/eeg_data/data_states.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
part of './data_cubit.dart';

abstract class DataState {}

class DataStateInitial extends DataState {}
Expand Down
20 changes: 20 additions & 0 deletions mobile/lib/src/application/navdrawer/navdrawer_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';

part 'navdrawer_event.dart';
part 'navdrawer_state.dart';

class NavdrawerBloc extends Bloc<NavdrawerEvent, NavdrawerState> {
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
NavdrawerBloc() : super(NavdrawerState.DashBoard);

@override
Stream<NavdrawerState> mapEventToState(
NavdrawerEvent event,
) async* {
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
if (event is NavdrawerUpdated) {
yield event.page;
}
}
}
19 changes: 19 additions & 0 deletions mobile/lib/src/application/navdrawer/navdrawer_event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
part of 'navdrawer_bloc.dart';

abstract class NavdrawerEvent extends Equatable {
const NavdrawerEvent();
@override
List<Object> get props => [];
}

abelfodil marked this conversation as resolved.
Show resolved Hide resolved
class NavdrawerUpdated extends NavdrawerEvent {
final NavdrawerState page;

const NavdrawerUpdated(this.page);

@override
List<Object> get props => [page];

@override
String toString() => 'NavDrawerUpdated { tab: $page }';
}
3 changes: 3 additions & 0 deletions mobile/lib/src/application/navdrawer/navdrawer_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
part of 'navdrawer_bloc.dart';

enum NavdrawerState { DashBoard, RecordSleep, History, BluetoothSelector }
2 changes: 2 additions & 0 deletions mobile/lib/src/locator.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';
import 'package:polydodo/src/application/navdrawer/navdrawer_bloc.dart';
import 'package:polydodo/src/application/device/device_selector_cubit.dart';
import 'package:polydodo/src/application/eeg_data/data_cubit.dart';
import 'package:polydodo/src/domain/acquisition_device/i_acquisition_device_repository.dart';
Expand All @@ -24,6 +25,7 @@ List<BlocProvider> createBlocProviders() => [
_serviceLocator.get<IAcquisitionDeviceRepository>(),
),
),
BlocProvider<NavdrawerBloc>(create: (context) => NavdrawerBloc()),
BlocProvider<DataCubit>(
create: (context) => DataCubit(
_serviceLocator.get<IAcquisitionDeviceRepository>(),
Expand Down
81 changes: 81 additions & 0 deletions mobile/lib/src/presentation/navigation/navdrawer_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import 'dart:io';

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:polydodo/src/application/navdrawer/navdrawer_bloc.dart';
import 'package:polydodo/src/presentation/navigation/routes/router.gr.dart';

class NavDrawerPage extends StatelessWidget {
static const name = "appDrawerRoute";

@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero, //only(top: 8.0),
children: <Widget>[
_createHeader(),
_createDrawerItem(
icon: Icons.bluetooth,
text: "Bluetooth selector",
onTap: () {
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
context
.bloc<NavdrawerBloc>()
.add(NavdrawerUpdated(NavdrawerState.BluetoothSelector));
ExtendedNavigator.of(context)
.replace(Routes.bluetoothSelectorPage);
},
),
_createDrawerItem(
icon: Icons.hotel,
text: "Record Sleep sequence",
onTap: () {
context
.bloc<NavdrawerBloc>()
.add(NavdrawerUpdated(NavdrawerState.RecordSleep));
ExtendedNavigator.of(context)
.replace(Routes.recordSleepGuidePage);
},
),
],
),
);
}
}

Widget _createHeader() {
return DrawerHeader(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage('common/assets/img/Material-Wallpaper.jpg'))),
child: Stack(children: <Widget>[
Positioned(
bottom: 12.0,
left: 16.0,
child: Text("Polydodo",
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
fontWeight: FontWeight.w500))),
]));
}

Widget _createDrawerItem(
{IconData icon, String text, GestureTapCallback onTap}) {
return ListTile(
title: Row(
children: <Widget>[
Icon(icon),
Padding(
padding: EdgeInsets.only(left: 8.0),
child: Text(text),
)
],
),
onTap: onTap,
);
}
16 changes: 16 additions & 0 deletions mobile/lib/src/presentation/navigation/routes/router.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:auto_route/auto_route_annotations.dart';
import 'package:polydodo/src/presentation/navigation/navdrawer_widget.dart';
mateobelanger marked this conversation as resolved.
Show resolved Hide resolved
import 'package:polydodo/src/presentation/pages/bluetooth_page/bluetoothSelector_page.dart';
import 'package:polydodo/src/presentation/pages/dashboard/dashboard_page.dart';
import 'package:polydodo/src/presentation/pages/record_sleep/record_sleep_guide_page.dart';

@MaterialAutoRouter(
generateNavigationHelperExtension: true,
routes: <AutoRoute>[
MaterialRoute(page: NavDrawerPage),
MaterialRoute(page: DashBoardPage, initial: true),
MaterialRoute(page: RecordSleepGuidePage),
MaterialRoute(page: RecordSleepValidatePage),
MaterialRoute(page: BluetoothSelectorPage),
WilliamHarvey97 marked this conversation as resolved.
Show resolved Hide resolved
])
class $Router {}
113 changes: 113 additions & 0 deletions mobile/lib/src/presentation/navigation/routes/router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:polydodo/src/application/device/device_selector_cubit.dart';
import 'package:polydodo/src/application/device/device_selector_state.dart';
import 'package:polydodo/src/presentation/recording/recording_route.dart';
import 'package:polydodo/src/presentation/navigation/navdrawer_widget.dart';

class BluetoothSelectorRoute extends StatelessWidget {
import 'record_sleep/record_sleep_guide_page.dart';

class BluetoothSelectorPage extends StatelessWidget {
static const name = 'bluetoothRoute';

BluetoothSelectorRoute({Key key}) : super(key: key);
BluetoothSelectorPage({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Polydodo')),
drawer: NavDrawerPage(),
body: BlocConsumer<DeviceSelectorCubit, DeviceState>(
listener: (context, state) {
print(state.runtimeType);
Expand All @@ -30,7 +33,7 @@ class BluetoothSelectorRoute extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RecordingRoute(),
builder: (context) => RecordSleepGuidePage(),
));
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:polydodo/src/presentation/navigation/navdrawer_widget.dart';
import 'package:polydodo/src/presentation/navigation/routes/router.gr.dart';

class RecordSleepGuidePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Record Sleep')),
drawer: NavDrawerPage(),
body: Center(
child: Text('Record Sleep Guide'),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
ExtendedNavigator.of(context).replace(Routes.recordSleepValidatePage);
},
child: Icon(Icons.add),
),
);
}
}
Loading