diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 9cffa03..ea1f80a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ + android:icon="@mipmap/launcher_icon"> [ + Padding( + padding: EdgeInsets.all(18), + child: Center( + child: Text( + "Delete this Mediminder?", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, fontWeight: FontWeight.bold), + ), + ), ), - child: Container( - width: 280, - height: 70, - child: FlatButton( - color: Color(0xFF3EB16F), - shape: StadiumBorder(), - onPressed: () { + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { _globalBloc.removeMedicine(medicine); + Navigator.popUntil( + context, + ModalRoute.withName('/'), + ); + }, + child: InkWell( + child: Container( + width: MediaQuery.of(context).size.width / 2.743, + padding: EdgeInsets.only(top: 15.0, bottom: 15.0), + decoration: BoxDecoration( + color: Color(0xFF3EB16F), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(30.0), + ), + ), + child: Text( + "Yes", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, + ), + ), + ), + ), + GestureDetector( + onTap: () { Navigator.of(context).pop(); }, - child: Center( - child: Text( - "Delete Mediminder", - style: TextStyle( - color: Colors.white, - fontSize: 22, - fontWeight: FontWeight.w700, + child: InkWell( + child: Container( + width: MediaQuery.of(context).size.width / 2.743, + padding: EdgeInsets.only(top: 15.0, bottom: 15.0), + decoration: BoxDecoration( + color: Colors.red[700], + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(30.0)), + ), + child: Text( + "No", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, ), ), ), - ))), - ], - ), - ), - ), - ); + ), + ], + ) + ], + ), + ), + ); + }); } } +// _globalBloc.removeMedicine(medicine); +// Navigator.of(context).pop() class MainSection extends StatelessWidget { final Medicine medicine; @@ -155,7 +253,9 @@ class MainSection extends StatelessWidget { ), MainInfoTab( fieldTitle: "Dosage", - fieldInfo: medicine.dosage.toString() + " mg", + fieldInfo: medicine.dosage == 0 + ? "Not Specified" + : medicine.dosage.toString() + " mg", ) ], ) @@ -191,7 +291,7 @@ class MainInfoTab extends StatelessWidget { Text( fieldInfo, style: TextStyle( - fontSize: 26, + fontSize: 24, color: Color(0xFF3EB16F), fontWeight: FontWeight.bold), ), @@ -222,9 +322,8 @@ class ExtendedSection extends StatelessWidget { fieldTitle: "Dose Interval", fieldInfo: "Every " + medicine.interval.toString() + - " hour(s) | " + - (24 / medicine.interval).floor().toString() + - " time(s) a day", + " hours | " + + " ${medicine.interval == 24 ? "One time a day" : (24 / medicine.interval).floor().toString() + " times a day"}", ), ExtendedInfoTab( fieldTitle: "Start Time", diff --git a/lib/src/ui/new_entry/new_entry.dart b/lib/src/ui/new_entry/new_entry.dart index b0597ee..52a4d51 100644 --- a/lib/src/ui/new_entry/new_entry.dart +++ b/lib/src/ui/new_entry/new_entry.dart @@ -69,13 +69,16 @@ class _NewEntryState extends State { child: Provider.value( value: _newEntryBloc, child: ListView( - padding: EdgeInsets.symmetric(horizontal: 25, vertical: 10), + padding: EdgeInsets.symmetric( + horizontal: 25, + ), children: [ PanelTitle( title: "Medicine Name", isRequired: true, ), TextFormField( + maxLength: 12, style: TextStyle( fontSize: 16, ), @@ -85,12 +88,9 @@ class _NewEntryState extends State { border: UnderlineInputBorder(), ), ), - SizedBox( - height: 10, - ), PanelTitle( title: "Dosage in mg", - isRequired: true, + isRequired: false, ), TextFormField( controller: dosageController, @@ -103,6 +103,10 @@ class _NewEntryState extends State { border: UnderlineInputBorder(), ), ), + SizedBox( + height: 15, + ), + PanelTitle( title: "Medicine Type", isRequired: false, @@ -178,7 +182,7 @@ class _NewEntryState extends State { "Confirm", style: TextStyle( color: Colors.white, - fontSize: 26, + fontSize: 28, fontWeight: FontWeight.w700, ), ), @@ -188,23 +192,18 @@ class _NewEntryState extends State { int dosage; //--------------------Error Checking------------------------ //Had to do error checking in UI - //Due to unoptimized BLoC error checking architecture + //Due to unoptimized BLoC value-grabbing architecture if (nameController.text == "") { - print("error"); _newEntryBloc.submitError(EntryError.NameNull); return; } if (nameController.text != "") { - print("noerror"); medicineName = nameController.text; } if (dosageController.text == "") { - print("error"); - _newEntryBloc.submitError(EntryError.Dosage); - return; + dosage = 0; } if (dosageController.text != "") { - print("noerror"); dosage = int.parse(dosageController.text); } for (var medicine in _globalBloc.medicineList$.value) { @@ -312,7 +311,7 @@ class _NewEntryState extends State { initializeNotifications() async { var initializationSettingsAndroid = - AndroidInitializationSettings('@mipmap/ic_launcher'); + AndroidInitializationSettings('@mipmap/launcher_icon'); var initializationSettingsIOS = IOSInitializationSettings(); var initializationSettings = InitializationSettings( initializationSettingsAndroid, initializationSettingsIOS); @@ -353,8 +352,10 @@ class _NewEntryState extends State { } await flutterLocalNotificationsPlugin.showDailyAtTime( int.parse(medicine.notificationIDs[i]), - 'Medicine Reminder: ${medicine.medicineName}', - 'It is time to take your ${medicine.medicineName + " " + medicine.medicineType}, according to schedule', + 'Mediminder: ${medicine.medicineName}', + medicine.medicineType.toString() == MedicineType.None.toString() + ? 'It is time to take your ${medicine.medicineType.toLowerCase()}, according to schedule' + : 'It is to time to take your medicine, according to schedule', Time(hour, minute, 0), platformChannelSpecifics); hour = ogValue; @@ -395,6 +396,7 @@ class _IntervalSelectionState extends State { ), ), DropdownButton( + iconEnabledColor: Color(0xFF3EB16F), hint: _selected == 0 ? Text( "Select an Interval", @@ -470,42 +472,28 @@ class _SelectTimeState extends State { @override Widget build(BuildContext context) { return Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(top: 8.0, bottom: 4), - child: FlatButton( - color: Color(0xFF3EB16F), - shape: StadiumBorder(), - onPressed: () { - _selectTime(context); - }, - child: Center( - child: Text( - _clicked == false ? "Pick Time" : "Edit Time", - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - ), - ), - Center( + height: 60, + child: Padding( + padding: EdgeInsets.only(top: 10.0, bottom: 4), + child: FlatButton( + color: Color(0xFF3EB16F), + shape: StadiumBorder(), + onPressed: () { + _selectTime(context); + }, + child: Center( child: Text( _clicked == false - ? "" - : "Selected starting time: ${convertTime(_time.hour.toString())}:${convertTime(_time.minute.toString())}", + ? "Pick Time" + : "${convertTime(_time.hour.toString())}:${convertTime(_time.minute.toString())}", style: TextStyle( - color: Colors.black, - fontSize: 16, + color: Colors.white, + fontSize: 20, fontWeight: FontWeight.w500, ), ), ), - ], + ), ), ); } diff --git a/lib/src/ui/new_entry/new_entry_bloc.dart b/lib/src/ui/new_entry/new_entry_bloc.dart index 45153c7..ce9406a 100644 --- a/lib/src/ui/new_entry/new_entry_bloc.dart +++ b/lib/src/ui/new_entry/new_entry_bloc.dart @@ -40,27 +40,6 @@ class NewEntryBloc { _errorState$.add(error); } - void errorCheck(String medicineName, List medicineList) { - for (var medicine in medicineList) { - if (medicineName == medicine.medicineName) { - print("no dup"); - _errorState$.add(EntryError.NameDuplicate); - return; - } - } - if (_selectedInterval$.value == 0) { - print("no interval"); - _errorState$.add(EntryError.Interval); - return; - } - if (_selectedTimeOfDay$.value == "None") { - print("no start"); - _errorState$.add(EntryError.StartTime); - return; - } - return; - } - void updateInterval(int interval) { _selectedInterval$.add(interval); } diff --git a/pubspec.lock b/pubspec.lock index 6f2c43e..96b618b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,20 @@ # Generated by pub # See https://www.dartlang.org/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.10" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.2" async: dependency: transitive description: @@ -29,6 +43,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" cupertino_icons: dependency: "direct main" description: @@ -59,6 +87,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.2+1" flutter_local_notifications: dependency: "direct main" description: @@ -71,6 +106,13 @@ packages: description: flutter source: sdk version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" matcher: dependency: transitive description: @@ -99,6 +141,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.5.0" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" platform: dependency: transitive description: @@ -195,6 +244,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.16" sdks: - dart: ">=2.2.0 <3.0.0" + dart: ">=2.3.0 <3.0.0" flutter: ">=0.1.4 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index d198f86..fcde7c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,6 +36,14 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + flutter_launcher_icons: "^0.7.2" + +flutter_icons: + android: "launcher_icon" + ios: false + image_path: "assets/logo/Mediminder_Logo.png" + + # For information on the generic Dart part of this file, see the