From 32c7ca080324dd58953db4424d836f59f696761e Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Thu, 23 Nov 2023 13:15:03 +0100 Subject: [PATCH 01/24] Centered titles on macOS / iOS --- lib/screens/nutritional_plan_screen.dart | 1 + lib/screens/workout_plan_screen.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/screens/nutritional_plan_screen.dart b/lib/screens/nutritional_plan_screen.dart index c590464e5..f79dddc4a 100644 --- a/lib/screens/nutritional_plan_screen.dart +++ b/lib/screens/nutritional_plan_screen.dart @@ -107,6 +107,7 @@ class NutritionalPlanScreen extends StatelessWidget { ), ], flexibleSpace: FlexibleSpaceBar( + titlePadding: const EdgeInsets.fromLTRB(56, 0, 56, 16), title: Text( nutritionalPlan.getLabel(context), style: Theme.of(context).textTheme.titleLarge?.copyWith(color: appBarForeground), diff --git a/lib/screens/workout_plan_screen.dart b/lib/screens/workout_plan_screen.dart index 0fb013431..b0e175f15 100644 --- a/lib/screens/workout_plan_screen.dart +++ b/lib/screens/workout_plan_screen.dart @@ -82,6 +82,7 @@ class _WorkoutPlanScreenState extends State { iconTheme: const IconThemeData(color: appBarForeground), backgroundColor: wgerPrimaryColor, flexibleSpace: FlexibleSpaceBar( + titlePadding: const EdgeInsets.fromLTRB(56, 0, 56, 16), title: Text( workoutPlan.name, style: Theme.of(context).textTheme.titleLarge?.copyWith(color: appBarForeground), From bc1cfc5ca11712cc43b50ea00aa65303a792e9d9 Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Thu, 23 Nov 2023 13:15:12 +0100 Subject: [PATCH 02/24] macOS Podfile update --- macos/Podfile.lock | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 72fa8204f..2c359a411 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -13,6 +13,9 @@ PODS: - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS + - video_player_avfoundation (0.0.1): + - Flutter + - FlutterMacOS DEPENDENCIES: - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) @@ -22,6 +25,7 @@ DEPENDENCIES: - rive_common (from `Flutter/ephemeral/.symlinks/plugins/rive_common/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) + - video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`) EXTERNAL SOURCES: file_selector_macos: @@ -38,15 +42,18 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos + video_player_avfoundation: + :path: Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin SPEC CHECKSUMS: - file_selector_macos: 0f85c1108e2fd597b58246bc0b0c1cb483d7593b + file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9 flutter_zxing: ea030278aa2a051cd81a5b0053be9d0569d11c9a FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce - rive_common: acedcab7802c0ece4b0d838b71d7deb637e1309a - shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 - url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451 + rive_common: 0f0aadf670f0c6a7872dfe3e6186f112a5319108 + shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 + video_player_avfoundation: 8563f13d8fc8b2c29dc2d09e60b660e4e8128837 PODFILE CHECKSUM: 0d3963a09fc94f580682bd88480486da345dc3f0 From 1983d3890af10155d03e0102e9aa65bf2bae714c Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Thu, 23 Nov 2023 13:53:06 +0100 Subject: [PATCH 03/24] GymMode: Use Table of Contents icon, not Menu --- lib/widgets/workouts/gym_mode.dart | 2 +- test/workout/gym_mode_screen_test.dart | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index b188d52d8..c1f996c28 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -1130,7 +1130,7 @@ class NavigationHeader extends StatelessWidget { ), ), IconButton( - icon: const Icon(Icons.menu), + icon: const Icon(Icons.toc), onPressed: () { showDialog( context: context, diff --git a/test/workout/gym_mode_screen_test.dart b/test/workout/gym_mode_screen_test.dart index 54efa024b..7ce88d377 100644 --- a/test/workout/gym_mode_screen_test.dart +++ b/test/workout/gym_mode_screen_test.dart @@ -90,7 +90,7 @@ void main() { expect(find.text('Bench press'), findsOneWidget); expect(find.text('Side raises'), findsOneWidget); expect(find.byIcon(Icons.close), findsOneWidget); - expect(find.byIcon(Icons.menu), findsOneWidget); + expect(find.byIcon(Icons.toc), findsOneWidget); expect(find.byIcon(Icons.chevron_left), findsNothing); expect(find.byIcon(Icons.chevron_right), findsOneWidget); await tester.tap(find.byIcon(Icons.chevron_right)); @@ -102,7 +102,7 @@ void main() { expect(find.text('Bench press'), findsOneWidget); expect(find.byType(ExerciseOverview), findsOneWidget); expect(find.byIcon(Icons.close), findsOneWidget); - expect(find.byIcon(Icons.menu), findsOneWidget); + expect(find.byIcon(Icons.toc), findsOneWidget); expect(find.byIcon(Icons.chevron_left), findsOneWidget); expect(find.byIcon(Icons.chevron_right), findsOneWidget); await tester.drag(find.byType(ExerciseOverview), const Offset(-500.0, 0.0)); @@ -119,7 +119,7 @@ void main() { expect(find.text('12 × 10 kg (2 RiR)'), findsOneWidget); expect(find.text('Make sure to warm up'), findsOneWidget, reason: 'Set comment'); expect(find.byIcon(Icons.close), findsOneWidget); - expect(find.byIcon(Icons.menu), findsOneWidget); + expect(find.byIcon(Icons.toc), findsOneWidget); expect(find.byIcon(Icons.chevron_left), findsOneWidget); expect(find.byIcon(Icons.chevron_right), findsOneWidget); @@ -145,7 +145,7 @@ void main() { expect(find.text('Pause'), findsOneWidget); expect(find.byType(TimerWidget), findsOneWidget); expect(find.byIcon(Icons.close), findsOneWidget); - expect(find.byIcon(Icons.menu), findsOneWidget); + expect(find.byIcon(Icons.toc), findsOneWidget); expect(find.byIcon(Icons.chevron_left), findsOneWidget); expect(find.byIcon(Icons.chevron_right), findsOneWidget); await tester.tap(find.byIcon(Icons.chevron_right)); From 814acd14c7eda99c16e281d284aeb0dc77d3c6a1 Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Fri, 24 Nov 2023 13:01:30 +0100 Subject: [PATCH 04/24] Meals + workouts: Removing Dismissible --- lib/l10n/app_en.arb | 8 +- lib/widgets/nutrition/meal.dart | 302 +++++++++--------- .../nutrition/nutritional_diary_detail.dart | 1 + .../nutrition/nutritional_plans_list.dart | 134 ++++---- lib/widgets/workouts/day.dart | 230 ++++++------- lib/widgets/workouts/workout_plans_list.dart | 132 ++++---- .../nutritional_plan_screen_test.dart | 2 +- .../nutritional_plans_screen_test.dart | 7 +- test/workout/workout_plan_screen_test.dart | 2 +- test/workout/workout_plans_screen_test.dart | 7 +- 10 files changed, 389 insertions(+), 436 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f4a2de7b4..65007b5d8 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -798,5 +798,11 @@ "none__bodyweight_exercise_": "none (bodyweight exercise)", "@none__bodyweight_exercise_": { "description": "Generated entry for translation for server strings" - } + }, + "editSchedule": "Edit schedule", + "log": "Log", + "@log": { + "description": "Log a specific meal" + }, + "done": "Done" } diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index 381ef006c..2002c0ae8 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -43,11 +43,18 @@ class MealWidget extends StatefulWidget { } class _MealWidgetState extends State { - bool _expanded = false; + bool _showingDetails = false; + bool _editing = false; - void _toggleExpanded() { + void _toggleEditing() { setState(() { - _expanded = !_expanded; + _editing = !_editing; + }); + } + + void _toggleDetails() { + setState(() { + _showingDetails = !_showingDetails; }); } @@ -57,85 +64,72 @@ class _MealWidgetState extends State { padding: const EdgeInsets.all(3), child: Card( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - DismissibleMealHeader(_expanded, _toggleExpanded, meal: widget._meal), - if (_expanded) - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - IconButton( - onPressed: () { - // Delete the meal - Provider.of(context, listen: false) - .deleteMeal(widget._meal); - - // and inform the user - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).successfullyDeleted, - textAlign: TextAlign.center, - ), - ), - ); - }, - icon: const Icon(Icons.delete), - ), - if (widget._meal.mealItems.isNotEmpty) - Ink( - decoration: ShapeDecoration( - color: Theme.of(context).primaryColor, //wgerPrimaryButtonColor, - shape: const CircleBorder(), - ), - child: IconButton( - icon: const Icon(Icons.history_edu), - color: Colors.white, + MealHeader( + editing: _editing, + toggleEditing: _toggleEditing, + showingDetails: _showingDetails, + toggleDetails: _toggleDetails, + meal: widget._meal), + if (_editing) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Wrap( + spacing: 8, + children: [ + TextButton.icon( + icon: const Icon(Icons.add), + label: Text(AppLocalizations.of(context).addIngredient), onPressed: () { - Provider.of(context, listen: false) - .logMealToDiary(widget._meal); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).mealLogged, - textAlign: TextAlign.center, - ), + Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).addIngredient, + MealItemForm(widget._meal, widget._listMealItems), + hasListView: true, ), ); }, ), - ), - IconButton( - onPressed: () { - Navigator.pushNamed( - context, - FormScreen.routeName, - arguments: FormScreenArguments( - AppLocalizations.of(context).edit, - MealForm(widget._meal.planId, widget._meal), - ), - ); - }, - icon: const Icon(Icons.edit), - ), - ], - ), - if (_expanded) const Divider(), - ...widget._meal.mealItems.map((item) => MealItemWidget(item, _expanded)), - OutlinedButton( - child: Text(AppLocalizations.of(context).addIngredient), - onPressed: () { - Navigator.pushNamed( - context, - FormScreen.routeName, - arguments: FormScreenArguments( - AppLocalizations.of(context).addIngredient, - MealItemForm(widget._meal, widget._listMealItems), - hasListView: true, - ), - ); - }, - ), + TextButton.icon( + label: Text(AppLocalizations.of(context).editSchedule), + onPressed: () { + Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).edit, + MealForm(widget._meal.planId, widget._meal), + ), + ); + }, + icon: const Icon(Icons.timer), + ), + TextButton.icon( + onPressed: () { + // Delete the meal + Provider.of(context, listen: false) + .deleteMeal(widget._meal); + + // and inform the user + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context).successfullyDeleted, + textAlign: TextAlign.center, + ), + ), + ); + }, + label: Text(AppLocalizations.of(context).delete), + icon: const Icon(Icons.delete)), + ], + )), + const Divider(), + ...widget._meal.mealItems + .map((item) => MealItemWidget(item, _showingDetails, _editing)), ], ), ), @@ -144,10 +138,11 @@ class _MealWidgetState extends State { } class MealItemWidget extends StatelessWidget { - final bool _expanded; + final bool _editing; + final bool _showingDetails; final MealItem _item; - const MealItemWidget(this._item, this._expanded); + const MealItemWidget(this._item, this._showingDetails, this._editing); @override Widget build(BuildContext context) { @@ -180,11 +175,12 @@ class MealItemWidget extends StatelessWidget { ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [if (_expanded) ...getMutedNutritionalValues(values, context)], + children: [if (_showingDetails) ...getMutedNutritionalValues(values, context)], ), - trailing: _expanded + trailing: _editing ? IconButton( icon: const Icon(Icons.delete), + tooltip: AppLocalizations.of(context).delete, iconSize: ICON_SIZE_SMALL, onPressed: () { // Delete the meal item @@ -205,87 +201,95 @@ class MealItemWidget extends StatelessWidget { } } -class DismissibleMealHeader extends StatelessWidget { - final bool _expanded; - final Function _toggle; +class MealHeader extends StatelessWidget { + final bool _editing; + final bool _showingDetails; + final Function _toggleEditing; + final Function _toggleDetails; - const DismissibleMealHeader( - this._expanded, - this._toggle, { + const MealHeader({ required Meal meal, - }) : _meal = meal; + required bool editing, + required Function toggleEditing, + required bool showingDetails, + required Function toggleDetails, + }) : _toggleDetails = toggleDetails, + _toggleEditing = toggleEditing, + _showingDetails = showingDetails, + _editing = editing, + _meal = meal; final Meal _meal; @override Widget build(BuildContext context) { - return Dismissible( - key: Key(_meal.id.toString()), - direction: DismissDirection.startToEnd, - background: Container( - color: Theme.of(context).primaryColor, //wgerPrimaryButtonColor, - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 10), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + title: Row(children: [ + Expanded( + child: (_meal.name != '') + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _meal.name, + style: Theme.of(context).textTheme.titleMedium, + ), + Text( + _meal.time!.format(context), + style: Theme.of(context).textTheme.headlineSmall, + ) + ], + ) + : Text( + _meal.time!.format(context), + style: Theme.of(context).textTheme.headlineSmall, + ), + ), Text( - AppLocalizations.of(context).logMeal, - style: const TextStyle(color: Colors.white), + AppLocalizations.of(context).log, + style: Theme.of(context) + .textTheme + .labelLarge + ?.copyWith(color: Theme.of(context).colorScheme.primary), ), - const Icon( - Icons.history_edu, - color: Colors.white, + const SizedBox(width: 26), + const SizedBox(height: 40, width: 1, child: VerticalDivider()), + ]), + trailing: Row(mainAxisSize: MainAxisSize.min, children: [ + IconButton( + icon: _showingDetails ? const Icon(Icons.info) : const Icon(Icons.info_outline), + onPressed: () { + _toggleDetails(); + }, + tooltip: AppLocalizations.of(context).toggleDetails, ), - ], - ), - ), - confirmDismiss: (direction) async { - // Delete - if (direction == DismissDirection.startToEnd) { - Provider.of(context, listen: false).logMealToDiary(_meal); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).mealLogged, - textAlign: TextAlign.center, - ), - ), - ); - } - return false; - }, - child: Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration(color: Theme.of(context).colorScheme.inversePrimary), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (_meal.name != '') - Text( - _meal.name, - style: Theme.of(context).textTheme.headlineSmall, - ), - Row( - children: [ - Expanded( - child: Text( - _meal.time!.format(context), - style: Theme.of(context).textTheme.headlineSmall, - ), + const SizedBox(width: 5), + IconButton( + icon: _editing ? const Icon(Icons.done) : const Icon(Icons.edit), + tooltip: + _editing ? AppLocalizations.of(context).done : AppLocalizations.of(context).edit, + onPressed: () { + _toggleEditing(); + }, + ) + ]), + onTap: () { + Provider.of(context, listen: false).logMealToDiary(_meal); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context).mealLogged, + textAlign: TextAlign.center, ), - IconButton( - visualDensity: VisualDensity.compact, - icon: _expanded ? const Icon(Icons.unfold_less) : const Icon(Icons.unfold_more), - onPressed: () { - _toggle(); - }, - ), - ], - ), - ], + ), + ); + }, ), - ), + ], ); } } diff --git a/lib/widgets/nutrition/nutritional_diary_detail.dart b/lib/widgets/nutrition/nutritional_diary_detail.dart index af07c2911..d1080e4fd 100644 --- a/lib/widgets/nutrition/nutritional_diary_detail.dart +++ b/lib/widgets/nutrition/nutritional_diary_detail.dart @@ -195,6 +195,7 @@ class NutritionalDiaryDetailWidget extends StatelessWidget { ), ), IconButton( + tooltip: AppLocalizations.of(context).delete, onPressed: () { Provider.of(context, listen: false) .deleteLog(log.id!, _nutritionalPlan.id!); diff --git a/lib/widgets/nutrition/nutritional_plans_list.dart b/lib/widgets/nutrition/nutritional_plans_list.dart index 58b112108..3377a6c93 100644 --- a/lib/widgets/nutrition/nutritional_plans_list.dart +++ b/lib/widgets/nutrition/nutritional_plans_list.dart @@ -39,78 +39,70 @@ class NutritionalPlansList extends StatelessWidget { itemCount: _nutritionProvider.items.length, itemBuilder: (context, index) { final currentPlan = _nutritionProvider.items[index]; - return Dismissible( - key: Key(currentPlan.id.toString()), - confirmDismiss: (direction) async { - // Delete workout from DB - final bool? res = await showDialog( - context: context, - builder: (BuildContext contextDialog) { - return AlertDialog( - content: Text( - AppLocalizations.of(context).confirmDelete(currentPlan.description), - ), - actions: [ - TextButton( - child: Text(MaterialLocalizations.of(context).cancelButtonLabel), - onPressed: () => Navigator.of(contextDialog).pop(), - ), - TextButton( - child: Text( - AppLocalizations.of(context).delete, - style: TextStyle(color: Theme.of(context).colorScheme.error), - ), - onPressed: () { - // Confirmed, delete the workout - _nutritionProvider.deletePlan(currentPlan.id!); - - // Close the popup - Navigator.of(contextDialog).pop(); - - // and inform the user - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).successfullyDeleted, - textAlign: TextAlign.center, - ), + return Card( + child: ListTile( + onTap: () { + Navigator.of(context).pushNamed( + NutritionalPlanScreen.routeName, + arguments: currentPlan, + ); + }, + title: Text(currentPlan.getLabel(context)), + subtitle: Text( + DateFormat.yMd(Localizations.localeOf(context).languageCode) + .format(currentPlan.creationDate), + ), + trailing: Row(mainAxisSize: MainAxisSize.min, children: [ + const VerticalDivider(), + IconButton( + icon: const Icon(Icons.delete), + tooltip: AppLocalizations.of(context).delete, + onPressed: () async { + // Delete workout from DB + await showDialog( + context: context, + builder: (BuildContext contextDialog) { + return AlertDialog( + content: Text( + AppLocalizations.of(context) + .confirmDelete(currentPlan.description), + ), + actions: [ + TextButton( + child: + Text(MaterialLocalizations.of(context).cancelButtonLabel), + onPressed: () => Navigator.of(contextDialog).pop(), ), - ); - }, - ), - ], - ); - }); - return res; - }, - background: Container( - color: Theme.of(context).colorScheme.error, - alignment: Alignment.centerRight, - padding: const EdgeInsets.only(right: 20), - margin: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 4, - ), - child: const Icon( - Icons.delete, - color: Colors.white, - ), - ), - direction: DismissDirection.endToStart, - child: Card( - child: ListTile( - onTap: () { - Navigator.of(context).pushNamed( - NutritionalPlanScreen.routeName, - arguments: currentPlan, - ); - }, - title: Text(currentPlan.getLabel(context)), - subtitle: Text( - DateFormat.yMd(Localizations.localeOf(context).languageCode) - .format(currentPlan.creationDate), - ), - ), + TextButton( + child: Text( + AppLocalizations.of(context).delete, + style: + TextStyle(color: Theme.of(context).colorScheme.error), + ), + onPressed: () { + // Confirmed, delete the workout + _nutritionProvider.deletePlan(currentPlan.id!); + + // Close the popup + Navigator.of(contextDialog).pop(); + + // and inform the user + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context).successfullyDeleted, + textAlign: TextAlign.center, + ), + ), + ); + }, + ), + ], + ); + }); + }, + ) + ]), ), ); }, diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index dbd923dcc..0229df1c2 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -97,7 +97,7 @@ class WorkoutDayWidget extends StatefulWidget { } class _WorkoutDayWidgetState extends State { - bool _expanded = false; + bool _editing = false; late List _sets; @override @@ -109,20 +109,21 @@ class _WorkoutDayWidgetState extends State { void _toggleExpanded() { setState(() { - _expanded = !_expanded; + _editing = !_editing; }); } Widget getSetRow(Set set, int index) { return Row( key: ValueKey(set.id), - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - if (_expanded) + if (_editing) IconButton( visualDensity: VisualDensity.compact, icon: const Icon(Icons.delete), iconSize: ICON_SIZE_SMALL, + tooltip: AppLocalizations.of(context).delete, onPressed: () { Provider.of(context, listen: false).deleteSet(set); }, @@ -131,21 +132,19 @@ class _WorkoutDayWidgetState extends State { child: Column( children: [ if (set.comment != '') MutedText(set.comment), - ...set.settingsFiltered - .map( - (setting) => SettingWidget( - set: set, - setting: setting, - expanded: _expanded, - toggle: _toggleExpanded, - ), - ) - , + ...set.settingsFiltered.map( + (setting) => SettingWidget( + set: set, + setting: setting, + expanded: _editing, + toggle: _toggleExpanded, + ), + ), const Divider(), ], ), ), - if (_expanded) + if (_editing) ReorderableDragStartListener( index: index, child: const IconButton( @@ -164,62 +163,65 @@ class _WorkoutDayWidgetState extends State { child: Card( margin: EdgeInsets.zero, child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - DayHeaderDismissible( + DayHeader( day: widget._day, - expanded: _expanded, + expanded: _editing, toggle: _toggleExpanded, ), - if (_expanded) - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - IconButton( - onPressed: () { - Provider.of(context, listen: false).deleteDay( - widget._day, - ); - }, - icon: const Icon(Icons.delete), - ), - if (widget._day.sets.isNotEmpty) - Ink( - decoration: ShapeDecoration( - color: Theme.of(context).primaryColor, - shape: const CircleBorder(), - ), - child: IconButton( - icon: const Icon(Icons.play_arrow), - color: Colors.white, + if (_editing) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Wrap( + spacing: 8, + children: [ + TextButton.icon( + label: Text(AppLocalizations.of(context).addSet), + icon: const Icon(Icons.add), onPressed: () { - Navigator.of(context).pushNamed( - GymModeScreen.routeName, - arguments: widget._day, + Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).newSet, + SetFormWidget(widget._day), + hasListView: true, + padding: EdgeInsets.zero, + ), ); }, ), - ), - IconButton( - onPressed: () { - Navigator.pushNamed( - context, - FormScreen.routeName, - arguments: FormScreenArguments( - AppLocalizations.of(context).edit, - DayFormWidget( - Provider.of(context, listen: false) - .findById(widget._day.workoutId), - widget._day), - hasListView: true, - ), - ); - }, - icon: const Icon(Icons.edit), - ), - ], - ), - if (_expanded) const Divider(), + TextButton.icon( + icon: const Icon(Icons.calendar_month), + label: Text(AppLocalizations.of(context).editSchedule), + onPressed: () { + Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).edit, + DayFormWidget( + Provider.of(context, listen: false) + .findById(widget._day.workoutId), + widget._day), + hasListView: true, + ), + ); + }, + ), + TextButton.icon( + icon: const Icon(Icons.delete), + label: Text(AppLocalizations.of(context).delete), + onPressed: () { + Provider.of(context, listen: false).deleteDay( + widget._day, + ); + }, + ), + ], + )), + const Divider(), ReorderableListView( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, @@ -242,21 +244,6 @@ class _WorkoutDayWidgetState extends State { for (var i = 0; i < widget._day.sets.length; i++) getSetRow(widget._day.sets[i], i), ], ), - OutlinedButton( - child: Text(AppLocalizations.of(context).addSet), - onPressed: () { - Navigator.pushNamed( - context, - FormScreen.routeName, - arguments: FormScreenArguments( - AppLocalizations.of(context).newSet, - SetFormWidget(widget._day), - hasListView: true, - padding: EdgeInsets.zero, - ), - ); - }, - ), ], ), ), @@ -264,77 +251,48 @@ class _WorkoutDayWidgetState extends State { } } -class DayHeaderDismissible extends StatelessWidget { +class DayHeader extends StatelessWidget { final Day _day; - final bool _expanded; + final bool _editing; final Function _toggle; - const DayHeaderDismissible({ + const DayHeader({ required Day day, required bool expanded, required Function toggle, }) : _day = day, - _expanded = expanded, + _editing = expanded, _toggle = toggle; @override Widget build(BuildContext context) { - return Dismissible( - key: Key(_day.id.toString()), - direction: DismissDirection.startToEnd, - background: Container( - color: Theme.of(context).primaryColor, - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 10), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AppLocalizations.of(context).gymMode, - style: const TextStyle(color: Colors.white), - ), - const Icon( - Icons.play_arrow, - color: Colors.white, - ), - ], - ), + return ListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + title: Text( + _day.description, + style: Theme.of(context).textTheme.headlineSmall, + overflow: TextOverflow.ellipsis, ), - confirmDismiss: (direction) async { - // Delete day - if (direction == DismissDirection.startToEnd) { - Navigator.of(context).pushNamed(GymModeScreen.routeName, arguments: _day); - } - return false; + subtitle: Text(_day.getDaysTextTranslated(Localizations.localeOf(context).languageCode)), + leading: const Icon(Icons.play_arrow), + minLeadingWidth: 8, + trailing: Row(mainAxisSize: MainAxisSize.min, children: [ + const SizedBox(height: 40, width: 1, child: VerticalDivider()), + const SizedBox(width: 10), + IconButton( + icon: _editing ? const Icon(Icons.done) : const Icon(Icons.edit), + tooltip: _editing ? AppLocalizations.of(context).done : AppLocalizations.of(context).edit, + onPressed: () { + _toggle(); + }, + ) + ]), + onTap: () { + Navigator.of(context).pushNamed( + GymModeScreen.routeName, + arguments: _day, + ); }, - child: Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration(color: Theme.of(context).colorScheme.inversePrimary), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _day.description, - style: Theme.of(context).textTheme.headlineSmall, - overflow: TextOverflow.ellipsis, - ), - Text(_day.getDaysTextTranslated(Localizations.localeOf(context).languageCode)), - ], - ), - ), - IconButton( - icon: _expanded ? const Icon(Icons.unfold_less) : const Icon(Icons.unfold_more), - onPressed: () { - _toggle(); - }, - ), - ], - ), - ), ); } } diff --git a/lib/widgets/workouts/workout_plans_list.dart b/lib/widgets/workouts/workout_plans_list.dart index d2bc3d7ec..d7443bdac 100644 --- a/lib/widgets/workouts/workout_plans_list.dart +++ b/lib/widgets/workouts/workout_plans_list.dart @@ -40,81 +40,71 @@ class WorkoutPlansList extends StatelessWidget { itemCount: _workoutProvider.items.length, itemBuilder: (context, index) { final currentWorkout = _workoutProvider.items[index]; - return Dismissible( - key: Key(currentWorkout.id.toString()), - confirmDismiss: (direction) async { - // Delete workout from DB - final res = await showDialog( - context: context, - builder: (BuildContext contextDialog) { - return AlertDialog( - content: Text( - AppLocalizations.of(context).confirmDelete(currentWorkout.name), - ), - actions: [ - TextButton( - child: Text(MaterialLocalizations.of(context).cancelButtonLabel), - onPressed: () => Navigator.of(contextDialog).pop(), - ), - TextButton( - child: Text( - AppLocalizations.of(context).delete, - style: TextStyle(color: Theme.of(context).colorScheme.error), - ), - onPressed: () { - // Confirmed, delete the workout - Provider.of(context, listen: false) - .deleteWorkout(currentWorkout.id!); - // Close the popup - Navigator.of(contextDialog).pop(); - - // and inform the user - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).successfullyDeleted, - textAlign: TextAlign.center, - ), - ), - ); - }, - ), - ], - ); - }); - return res; - }, - background: Container( - color: Theme.of(context).colorScheme.error, - alignment: Alignment.centerRight, - padding: const EdgeInsets.only(right: 20), - margin: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 4, - ), - child: const Icon( - Icons.delete, - color: Colors.white, - ), - ), - direction: DismissDirection.endToStart, - child: Card( + return Card( child: ListTile( - onTap: () { - _workoutProvider.setCurrentPlan(currentWorkout.id!); + onTap: () { + _workoutProvider.setCurrentPlan(currentWorkout.id!); - Navigator.of(context) - .pushNamed(WorkoutPlanScreen.routeName, arguments: currentWorkout); - }, - title: Text(currentWorkout.name), - subtitle: Text( - DateFormat.yMd(Localizations.localeOf(context).languageCode) - .format(currentWorkout.creationDate), - ), - ), + Navigator.of(context) + .pushNamed(WorkoutPlanScreen.routeName, arguments: currentWorkout); + }, + title: Text(currentWorkout.name), + subtitle: Text( + DateFormat.yMd(Localizations.localeOf(context).languageCode) + .format(currentWorkout.creationDate), ), - ); + trailing: Row(mainAxisSize: MainAxisSize.min, children: [ + const VerticalDivider(), + IconButton( + icon: const Icon(Icons.delete), + tooltip: AppLocalizations.of(context).delete, + onPressed: () async { + // Delete workout from DB + await showDialog( + context: context, + builder: (BuildContext contextDialog) { + return AlertDialog( + content: Text( + AppLocalizations.of(context).confirmDelete(currentWorkout.name), + ), + actions: [ + TextButton( + child: + Text(MaterialLocalizations.of(context).cancelButtonLabel), + onPressed: () => Navigator.of(contextDialog).pop(), + ), + TextButton( + child: Text( + AppLocalizations.of(context).delete, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + onPressed: () { + // Confirmed, delete the workout + Provider.of(context, listen: false) + .deleteWorkout(currentWorkout.id!); + + // Close the popup + Navigator.of(contextDialog).pop(); + + // and inform the user + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context).successfullyDeleted, + textAlign: TextAlign.center, + ), + ), + ); + }, + ), + ], + ); + }); + }, + ) + ]), + )); }, ), ); diff --git a/test/nutrition/nutritional_plan_screen_test.dart b/test/nutrition/nutritional_plan_screen_test.dart index af66d0056..cea4afb8c 100644 --- a/test/nutrition/nutritional_plan_screen_test.dart +++ b/test/nutrition/nutritional_plan_screen_test.dart @@ -80,7 +80,7 @@ void main() { expect(find.text('75g Burger soup'), findsOneWidget); expect(find.text('300g Broccoli cake'), findsOneWidget); - expect(find.byType(Dismissible), findsNWidgets(2)); + expect(find.byType(Card), findsNWidgets(2)); expect(find.byType(FlNutritionalDiaryChartWidget), findsNothing); }); diff --git a/test/nutrition/nutritional_plans_screen_test.dart b/test/nutrition/nutritional_plans_screen_test.dart index b7fd34dcd..df5828334 100644 --- a/test/nutrition/nutritional_plans_screen_test.dart +++ b/test/nutrition/nutritional_plans_screen_test.dart @@ -86,14 +86,15 @@ void main() { //debugDumpApp(); expect(find.text('Nutritional plans'), findsOneWidget); - expect(find.byType(Dismissible), findsNWidgets(2)); + expect(find.byType(Card), findsNWidgets(2)); expect(find.byType(ListTile), findsNWidgets(2)); }); - testWidgets('Test deleting an item by dragging the dismissible', (WidgetTester tester) async { + testWidgets('Test deleting an item using the Delete button', (WidgetTester tester) async { await tester.pumpWidget(createHomeScreen()); - await tester.drag(find.byKey(const Key('1')), const Offset(-500.0, 0.0)); + await tester.tap(find.byIcon(Icons.delete).first); + await tester.pumpAndSettle(); // Confirmation dialog diff --git a/test/workout/workout_plan_screen_test.dart b/test/workout/workout_plan_screen_test.dart index 838e7d414..cd9febcc8 100644 --- a/test/workout/workout_plan_screen_test.dart +++ b/test/workout/workout_plan_screen_test.dart @@ -67,7 +67,7 @@ void main() { expect(find.text('3 day workout'), findsOneWidget); expect(find.text('chest, shoulders'), findsOneWidget); expect(find.text('legs'), findsOneWidget); - expect(find.byType(Dismissible), findsNWidgets(2)); + expect(find.byType(Card), findsNWidgets(2)); }); testWidgets('Tests the localization of times - EN', (WidgetTester tester) async { diff --git a/test/workout/workout_plans_screen_test.dart b/test/workout/workout_plans_screen_test.dart index 45ee48797..5fe146c7e 100644 --- a/test/workout/workout_plans_screen_test.dart +++ b/test/workout/workout_plans_screen_test.dart @@ -78,14 +78,15 @@ void main() { //debugDumpApp(); expect(find.text('Workout plans'), findsOneWidget); - expect(find.byType(Dismissible), findsNWidgets(2)); + expect(find.byType(Card), findsNWidgets(2)); expect(find.byType(ListTile), findsNWidgets(2)); }); - testWidgets('Test deleting an item by dragging the dismissible', (WidgetTester tester) async { + testWidgets('Test deleting an item using the Delete button', (WidgetTester tester) async { await tester.pumpWidget(createHomeScreen()); - await tester.drag(find.byKey(const Key('1')), const Offset(-500.0, 0.0)); + await tester.tap(find.byIcon(Icons.delete).first); + await tester.pumpAndSettle(); // Confirmation dialog From 87c8a599f0ed7b863d6614da3820fd9944f8152c Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Fri, 24 Nov 2023 13:02:25 +0100 Subject: [PATCH 05/24] Homescreen: new details icon + tweaked padding --- lib/widgets/dashboard/widgets.dart | 62 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index b5565c840..349eea65c 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -146,14 +146,6 @@ class _DashboardNutritionWidgetState extends State { return out; } - Widget getTrailing() { - if (!_hasContent) { - return const Text(''); - } - - return _showDetail ? const Icon(Icons.expand_less) : const Icon(Icons.expand_more); - } - @override Widget build(BuildContext context) { return Card( @@ -174,7 +166,15 @@ class _DashboardNutritionWidgetState extends State { Icons.restaurant, color: Theme.of(context).textTheme.headlineSmall!.color, ), - trailing: getTrailing(), + trailing: _hasContent + ? Tooltip( + message: AppLocalizations.of(context).toggleDetails, + child: _showDetail + ? const Icon( + Icons.info, + ) + : const Icon(Icons.info_outline)) + : const SizedBox(), onTap: () { setState(() { _showDetail = !_showDetail; @@ -182,16 +182,18 @@ class _DashboardNutritionWidgetState extends State { }, ), if (_hasContent) - Column( - children: [ - ...getContent(), - Container( - padding: const EdgeInsets.all(15), - height: 180, - child: FlNutritionalPlanPieChartWidget(_plan!.nutritionalValues), - ) - ], - ) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + children: [ + ...getContent(), + Container( + padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 15), + height: 180, + child: FlNutritionalPlanPieChartWidget(_plan!.nutritionalValues), + ) + ], + )) else NothingFound( AppLocalizations.of(context).noNutritionalPlans, @@ -441,14 +443,6 @@ class _DashboardWorkoutWidgetState extends State { _hasContent = _workoutPlan != null; } - Widget getTrailing() { - if (!_hasContent) { - return const Text(''); - } - - return _showDetail ? const Icon(Icons.expand_less) : const Icon(Icons.expand_more); - } - List getContent() { final List out = []; @@ -540,7 +534,15 @@ class _DashboardWorkoutWidgetState extends State { Icons.fitness_center, color: Theme.of(context).textTheme.headlineSmall!.color, ), - trailing: getTrailing(), + trailing: _hasContent + ? Tooltip( + message: AppLocalizations.of(context).toggleDetails, + child: _showDetail + ? const Icon( + Icons.info, + ) + : const Icon(Icons.info_outline)) + : const SizedBox(), onTap: () { setState(() { _showDetail = !_showDetail; @@ -548,8 +550,8 @@ class _DashboardWorkoutWidgetState extends State { }, ), if (_hasContent) - Container( - padding: const EdgeInsets.only(left: 10), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ ...getContent(), From 95ea711e9720de373d48844c01e9d36723e0fbcb Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Sat, 25 Nov 2023 00:57:27 +0100 Subject: [PATCH 06/24] Weight entries - buggy test --- lib/widgets/measurements/entries.dart | 104 ++++++++++---------------- lib/widgets/weight/entries_list.dart | 104 ++++++++++---------------- test/weight/weight_screen_test.dart | 12 ++- 3 files changed, 87 insertions(+), 133 deletions(-) diff --git a/lib/widgets/measurements/entries.dart b/lib/widgets/measurements/entries.dart index c3cf83379..cb4134ed0 100644 --- a/lib/widgets/measurements/entries.dart +++ b/lib/widgets/measurements/entries.dart @@ -52,72 +52,46 @@ class EntriesList extends StatelessWidget { final currentEntry = _category.entries[index]; final provider = Provider.of(context, listen: false); - return Dismissible( - key: Key(currentEntry.id.toString()), - onDismissed: (direction) { - if (direction == DismissDirection.endToStart) { - // Delete entry from DB - provider.deleteEntry(currentEntry.id!, currentEntry.category); + return Card( + child: ListTile( + title: Text('${currentEntry.value} ${_category.unit}'), + subtitle: Text( + DateFormat.yMd(Localizations.localeOf(context).languageCode) + .format(currentEntry.date), + ), + trailing: PopupMenuButton( + itemBuilder: (BuildContext context) { + return [ + PopupMenuItem( + child: Text(AppLocalizations.of(context).edit), + onTap: () => Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).edit, + MeasurementEntryForm(currentEntry.category, currentEntry), + ), + )), + PopupMenuItem( + child: Text(AppLocalizations.of(context).delete), + onTap: () async { + // Delete entry from DB + await provider.deleteEntry(currentEntry.id!, currentEntry.category); - // and inform the user - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).successfullyDeleted, - textAlign: TextAlign.center, - ), - ), - ); - } - }, - confirmDismiss: (direction) async { - // Edit entry - if (direction == DismissDirection.startToEnd) { - Navigator.pushNamed( - context, - FormScreen.routeName, - arguments: FormScreenArguments( - AppLocalizations.of(context).edit, - MeasurementEntryForm(currentEntry.category, currentEntry), - ), - ); - return false; - } - return true; - }, - secondaryBackground: Container( - color: Theme.of(context).colorScheme.error, - alignment: Alignment.centerRight, - padding: const EdgeInsets.only(right: 20), - margin: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 4, - ), - child: const Icon( - Icons.delete, - color: Colors.white, - ), - ), - background: Container( - color: wgerPrimaryButtonColor, - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 20), - margin: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 4, - ), - child: const Icon( - Icons.edit, - color: Colors.white, - ), - ), - child: Card( - child: ListTile( - title: Text('${currentEntry.value} ${_category.unit}'), - subtitle: Text( - DateFormat.yMd(Localizations.localeOf(context).languageCode) - .format(currentEntry.date), - ), + // and inform the user + if (context.mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context).successfullyDeleted, + textAlign: TextAlign.center, + ), + ), + ); + } + }) + ]; + }, ), ), ); diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index 8377ec5b6..ff3f033ef 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -60,72 +60,46 @@ class WeightEntriesList extends StatelessWidget { itemCount: weightProvider.items.length, itemBuilder: (context, index) { final currentEntry = weightProvider.items[index]; - return Dismissible( - key: Key(currentEntry.id.toString()), - onDismissed: (direction) { - if (direction == DismissDirection.endToStart) { - // Delete entry from DB - weightProvider.deleteEntry(currentEntry.id!); + return Card( + child: ListTile( + title: Text('${currentEntry.weight} kg'), + subtitle: Text( + DateFormat.yMd(Localizations.localeOf(context).languageCode) + .format(currentEntry.date), + ), + trailing: PopupMenuButton( + itemBuilder: (BuildContext context) { + return [ + PopupMenuItem( + child: Text(AppLocalizations.of(context).edit), + onTap: () => Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).edit, + WeightForm(currentEntry), + ), + )), + PopupMenuItem( + child: Text(AppLocalizations.of(context).delete), + onTap: () async { + // Delete entry from DB + await weightProvider.deleteEntry(currentEntry.id!); - // and inform the user - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).successfullyDeleted, - textAlign: TextAlign.center, - ), - ), - ); - } - }, - confirmDismiss: (direction) async { - // Edit entry - if (direction == DismissDirection.startToEnd) { - Navigator.pushNamed( - context, - FormScreen.routeName, - arguments: FormScreenArguments( - AppLocalizations.of(context).edit, - WeightForm(currentEntry), - ), - ); - return false; - } - return true; - }, - secondaryBackground: Container( - color: Theme.of(context).colorScheme.error, - alignment: Alignment.centerRight, - padding: const EdgeInsets.only(right: 20), - margin: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 4, - ), - child: const Icon( - Icons.delete, - color: Colors.white, - ), - ), - background: Container( - // color: wgerPrimaryButtonColor, - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 20), - margin: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 4, - ), - child: const Icon( - Icons.edit, - color: Colors.white, - ), - ), - child: Card( - child: ListTile( - title: Text('${currentEntry.weight} kg'), - subtitle: Text( - DateFormat.yMd(Localizations.localeOf(context).languageCode) - .format(currentEntry.date), - ), + // and inform the user + if (context.mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context).successfullyDeleted, + textAlign: TextAlign.center, + ), + ), + ); + } + }) + ]; + }, ), ), ); diff --git a/test/weight/weight_screen_test.dart b/test/weight/weight_screen_test.dart index 10bd75bd0..f566e8e1b 100644 --- a/test/weight/weight_screen_test.dart +++ b/test/weight/weight_screen_test.dart @@ -58,15 +58,21 @@ void main() { expect(find.text('Weight'), findsOneWidget); expect(find.byType(MeasurementChartWidgetFl), findsOneWidget); - expect(find.byType(Dismissible), findsNWidgets(2)); + expect(find.byType(Card), findsNWidgets(2)); expect(find.byType(ListTile), findsNWidgets(2)); }); - testWidgets('Test deleting an item by dragging the dismissible', (WidgetTester tester) async { + testWidgets('Test deleting an item using the Delete button', (WidgetTester tester) async { await tester.pumpWidget(createWeightScreen()); - await tester.drag(find.byKey(const Key('1')), const Offset(-500.0, 0.0)); + expect(find.byType(ListTile), findsNWidgets(2)); + + await tester.tap(find.byTooltip('Show menu').first); await tester.pumpAndSettle(); + + await tester.tap(find.text('Delete')); + await tester.pumpAndSettle(); + verify(mockWeightProvider.deleteEntry(1)).called(1); expect(find.byType(ListTile), findsOneWidget); }); From 79522575f6cf545f02d575156603dc798f640040 Mon Sep 17 00:00:00 2001 From: Miroslav Mazel Date: Wed, 10 Jan 2024 18:41:59 +0100 Subject: [PATCH 07/24] Updated Flatpak scripts --- .github/workflows/build-release.yml | 2 +- ...pdata.xml => de.wger.flutter.metainfo.xml} | 0 flatpak/flatpak_meta.json | 8 +- flatpak/scripts/flatpak_packager.dart | 123 +++++++------ flatpak/scripts/flatpak_shared.dart | 166 +++++++++++------- flatpak/scripts/manifest_generator.dart | 43 +++-- 6 files changed, 208 insertions(+), 134 deletions(-) rename flatpak/{de.wger.flutter.appdata.xml => de.wger.flutter.metainfo.xml} (100%) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index b8e61ce92..5aa9fc479 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -63,7 +63,7 @@ jobs: flutter build linux --release cd flatpak/scripts dart pub get - dart flatpak_packager.dart --meta ../flatpak_meta.json --github + dart flatpak_packager.dart --meta ../flatpak_meta.json --github --addTodaysVersion ${{ env.VERSION }} - name: Build AAB run: flutter build appbundle --release diff --git a/flatpak/de.wger.flutter.appdata.xml b/flatpak/de.wger.flutter.metainfo.xml similarity index 100% rename from flatpak/de.wger.flutter.appdata.xml rename to flatpak/de.wger.flutter.metainfo.xml diff --git a/flatpak/flatpak_meta.json b/flatpak/flatpak_meta.json index 5d408ead3..253cf82ef 100644 --- a/flatpak/flatpak_meta.json +++ b/flatpak/flatpak_meta.json @@ -3,14 +3,8 @@ "lowercaseAppName": "wger", "githubReleaseOrganization": "wger-project", "githubReleaseProject": "flutter", - "localReleases": [ - - ], - "localReleaseAssets": [ - - ], "localLinuxBuildDir": "../build/linux", - "appDataPath": "de.wger.flutter.appdata.xml", + "appStreamPath": "de.wger.flutter.metainfo.xml", "desktopPath": "de.wger.flutter.desktop", "icons": { "64x64": "logo64.png", diff --git a/flatpak/scripts/flatpak_packager.dart b/flatpak/scripts/flatpak_packager.dart index 5346a6056..92cf27681 100644 --- a/flatpak/scripts/flatpak_packager.dart +++ b/flatpak/scripts/flatpak_packager.dart @@ -1,17 +1,27 @@ // ignore_for_file: avoid_print import 'dart:io'; - import 'flatpak_shared.dart'; +/// Creates an archive containing all the sources for the Flatpak package for a +/// specific architecture. +/// /// arguments: /// --meta [file] +/// Required argument for providing the metadata file for this script. + /// --github +/// Use this option to pull release info from Github rather than the metadata file. + +/// --addTodaysVersion [version] +/// If pulling data from Github, this provides a way to specify the release to be released today. + void main(List arguments) async { - if (Platform.isWindows) { - throw Exception('Must be run under a UNIX-like operating system.'); + if (!Platform.isLinux) { + throw Exception('Must be run under Linux'); } + // PARSE ARGUMENTS final metaIndex = arguments.indexOf('--meta'); if (metaIndex == -1) { throw Exception( @@ -22,123 +32,136 @@ void main(List arguments) async { } final metaFile = File(arguments[metaIndex + 1]); - if (!metaFile.existsSync()) { + if (!(await metaFile.exists())) { throw Exception('The provided metadata file does not exist.'); } - final meta = FlatpakMeta.fromJson(metaFile); - final fetchFromGithub = arguments.contains('--github'); + final addTodaysVersionIndex = arguments.indexOf('--addTodaysVersion'); + if (addTodaysVersionIndex != -1 && arguments.length == addTodaysVersionIndex + 1) { + throw Exception('The --addTodaysVersion flag must be followed by the version name.'); + } + + final addedTodaysVersion = + addTodaysVersionIndex != -1 ? arguments[addTodaysVersionIndex + 1] : null; + + // GENERATE PACKAGE + + final meta = FlatpakMeta.fromJson(metaFile, skipLocalReleases: fetchFromGithub); + final outputDir = Directory('${Directory.current.path}/flatpak_generator_exports'); - outputDir.createSync(); + await outputDir.create(); - final packageGenerator = PackageGenerator(inputDir: metaFile.parent, meta: meta); + final packageGenerator = PackageGenerator( + inputDir: metaFile.parent, meta: meta, addedTodaysVersion: addedTodaysVersion); - packageGenerator.generatePackage( - outputDir, - PackageGenerator.runningOnARM() ? CPUArchitecture.aarch64 : CPUArchitecture.x86_64, - fetchFromGithub, - ); + await packageGenerator.generatePackage( + outputDir, + await PackageGenerator.runningOnARM() ? CPUArchitecture.aarch64 : CPUArchitecture.x86_64, + fetchFromGithub); } class PackageGenerator { final Directory inputDir; final FlatpakMeta meta; - final Map shaByArch = {}; + final String? addedTodaysVersion; - PackageGenerator({required this.inputDir, required this.meta}); + PackageGenerator({required this.inputDir, required this.meta, required this.addedTodaysVersion}); Future generatePackage( Directory outputDir, CPUArchitecture arch, bool fetchReleasesFromGithub) async { - final tempDir = outputDir.createTempSync('flutter_generator_temp'); + final tempDir = await outputDir.createTemp('flutter_generator_temp'); final appId = meta.appId; // desktop file final desktopFile = File('${inputDir.path}/${meta.desktopPath}'); - if (!desktopFile.existsSync()) { + if (!(await desktopFile.exists())) { throw Exception( 'The desktop file does not exist under the specified path: ${desktopFile.path}'); } - desktopFile.copySync('${tempDir.path}/$appId.desktop'); + await desktopFile.copy('${tempDir.path}/$appId.desktop'); // icons final iconTempDir = Directory('${tempDir.path}/icons'); for (final icon in meta.icons) { final iconFile = File('${inputDir.path}/${icon.path}'); - if (!iconFile.existsSync()) { + if (!(await iconFile.exists())) { throw Exception('The icon file ${iconFile.path} does not exist.'); } final iconSubdir = Directory('${iconTempDir.path}/${icon.type}'); - iconSubdir.createSync(recursive: true); - iconFile.copySync('${iconSubdir.path}/${icon.getFilename(appId)}'); + await iconSubdir.create(recursive: true); + await iconFile.copy('${iconSubdir.path}/${icon.getFilename(appId)}'); } - // appdata file - final origAppDataFile = File('${inputDir.path}/${meta.appDataPath}'); - if (!origAppDataFile.existsSync()) { + // AppStream metainfo file + final origAppStreamFile = File('${inputDir.path}/${meta.appStreamPath}'); + if (!(await origAppStreamFile.exists())) { throw Exception( - 'The app data file does not exist under the specified path: ${origAppDataFile.path}'); + 'The app data file does not exist under the specified path: ${origAppStreamFile.path}'); } - final editedAppDataContent = AppDataModifier.replaceVersions( - origAppDataFile.readAsStringSync(), await meta.getReleases(fetchReleasesFromGithub)); + final editedAppStreamContent = AppStreamModifier.replaceVersions( + await origAppStreamFile.readAsString(), + await meta.getReleases(fetchReleasesFromGithub, addedTodaysVersion)); - final editedAppDataFile = File('${tempDir.path}/$appId.appdata.xml'); - editedAppDataFile.writeAsStringSync(editedAppDataContent); + final editedAppStreamFile = File('${tempDir.path}/$appId.metainfo.xml'); + await editedAppStreamFile.writeAsString(editedAppStreamContent); // build files final bundlePath = '${inputDir.path}/${meta.localLinuxBuildDir}/${arch.flutterDirName}/release/bundle'; final buildDir = Directory(bundlePath); - if (!buildDir.existsSync()) { + if (!(await buildDir.exists())) { throw Exception( 'The linux build directory does not exist under the specified path: ${buildDir.path}'); } final destDir = Directory('${tempDir.path}/bin'); - destDir.createSync(); + await destDir.create(); - final baseFileName = '${meta.lowercaseAppName}-linux-${arch.flatpakArchCode}'; + final baseFilename = '${meta.lowercaseAppName}-linux-${arch.flatpakArchCode}'; + final packagePath = '${outputDir.absolute.path}/$baseFilename.tar.gz'; + final shaPath = '${outputDir.absolute.path}/$baseFilename.sha256'; + + await Process.run('cp', ['-r', '${buildDir.absolute.path}/.', destDir.absolute.path]); + await Process.run('tar', ['-czvf', packagePath, '.'], workingDirectory: tempDir.absolute.path); - final packagePath = '${outputDir.absolute.path}/$baseFileName.tar.gz'; - Process.runSync('cp', ['-r', '${buildDir.absolute.path}/.', destDir.absolute.path]); - Process.runSync('tar', ['-czvf', packagePath, '.'], workingDirectory: tempDir.absolute.path); print('Generated $packagePath'); - final preShasum = Process.runSync('shasum', ['-a', '256', packagePath]); - final sha256 = preShasum.stdout.toString().split(' ').first; + final preShasum = await Process.run('shasum', ['-a', '256', packagePath]); + final shasum = preShasum.stdout.toString().split(' ').first; - final shaFile = await File('${outputDir.path}/$baseFileName.sha256').writeAsString(sha256); - print('Generated ${shaFile.path}'); + await File(shaPath).writeAsString(shasum); - shaByArch.putIfAbsent(arch, () => sha256); + print('Generated $shaPath'); - tempDir.deleteSync(recursive: true); + await tempDir.delete(recursive: true); } - static bool runningOnARM() { - final unameRes = Process.runSync('uname', ['-m']); + static Future runningOnARM() async { + final unameRes = await Process.run('uname', ['-m']); final unameString = unameRes.stdout.toString().trimLeft(); return unameString.startsWith('arm') || unameString.startsWith('aarch'); } } -// updates releases in ${appName}.appdata.xml -class AppDataModifier { - static String replaceVersions(String origAppDataContent, List versions) { +// updates releases in ${appName}.metainfo.xml +class AppStreamModifier { + static String replaceVersions(String origAppStreamContent, List versions) { final joinedReleases = versions.map((v) => '\t\t').join('\n'); - final releasesSection = '\n$joinedReleases\n\t'; //todo check this - if (origAppDataContent.contains('') .replaceFirst(RegExp(''), releasesSection) .replaceAll('<~>', '\n'); } else { - return origAppDataContent.replaceFirst('', '\n\t$releasesSection\n'); + return origAppStreamContent.replaceFirst( + '', '\n\t$releasesSection\n'); } } } diff --git a/flatpak/scripts/flatpak_shared.dart b/flatpak/scripts/flatpak_shared.dart index f411aabef..d3ad12adb 100644 --- a/flatpak/scripts/flatpak_shared.dart +++ b/flatpak/scripts/flatpak_shared.dart @@ -3,20 +3,21 @@ import 'dart:io'; import 'package:http/http.dart' as http; +/// Shared files for the two Flatpak-related scripts. + class Release { final String version; - final String date; //todo add resources + final String date; //TODO add resources Release({required this.version, required this.date}); } enum CPUArchitecture { x86_64('x86_64', 'x64'), - aarch64('aarch64', 'aarch64'); + aarch64('aarch64', 'arm64'); final String flatpakArchCode; final String flutterDirName; - const CPUArchitecture(this.flatpakArchCode, this.flutterDirName); } @@ -43,8 +44,9 @@ class Icon { _fileExtension = path.split('.').last; } - String getFilename(String appId) => - (type == _symbolicType) ? '$appId-symbolic.$_fileExtension' : '$appId.$_fileExtension'; + String getFilename(String appId) => (type == _symbolicType) + ? '$appId-symbolic.$_fileExtension' + : '$appId.$_fileExtension'; } class GithubReleases { @@ -55,25 +57,26 @@ class GithubReleases { GithubReleases(this.githubReleaseOrganization, this.githubReleaseProject); - Future> getReleases() async { + Future> getReleases(bool canBeEmpty) async { if (_releases == null) { - await _fetchReleasesAndAssets(); + await _fetchReleasesAndAssets(canBeEmpty); } return _releases!; } Future?> getLatestReleaseAssets() async { if (_releases == null) { - await _fetchReleasesAndAssets(); + await _fetchReleasesAndAssets(false); } return _latestReleaseAssets; } - Future _fetchReleasesAndAssets() async { + Future _fetchReleasesAndAssets(bool canBeEmpty) async { final releaseJsonContent = (await http.get(Uri( scheme: 'https', host: 'api.github.com', - path: '/repos/$githubReleaseOrganization/$githubReleaseProject/releases'))) + path: + '/repos/$githubReleaseOrganization/$githubReleaseProject/releases'))) .body; final decodedJson = jsonDecode(releaseJsonContent) as List; @@ -84,27 +87,33 @@ class GithubReleases { await Future.forEach(decodedJson, (dynamic releaseDynamic) async { final releaseMap = releaseDynamic as Map; - final releaseDateAndTime = DateTime.parse(releaseMap['published_at'] as String); - final releaseDateString = releaseDateAndTime.toIso8601String().split('T').first; + final releaseDateAndTime = + DateTime.parse(releaseMap['published_at'] as String); + final releaseDateString = + releaseDateAndTime.toIso8601String().split('T').first; if (latestReleaseAssetDate == null || (latestReleaseAssetDate?.compareTo(releaseDateAndTime) == -1)) { - final assets = await _parseReleaseAssets(releaseMap['assets'] as List); + final assets = + await _parseGithubReleaseAssets(releaseMap['assets'] as List); if (assets != null) { _latestReleaseAssets = assets; latestReleaseAssetDate = releaseDateAndTime; } } - releases.add(Release(version: releaseMap['name'] as String, date: releaseDateString)); + releases.add(Release( + version: releaseMap['name'] as String, date: releaseDateString)); }); - if (releases.isNotEmpty) { + if (releases.isNotEmpty || canBeEmpty) { _releases = releases; + } else { + throw Exception("Github must contain at least 1 release."); } } - Future?> _parseReleaseAssets(List assetMaps) async { + Future?> _parseGithubReleaseAssets(List assetMaps) async { String? x64TarballUrl; String? x64Sha; String? aarch64TarballUrl; @@ -115,7 +124,8 @@ class GithubReleases { final downloadUrl = amMap['browser_download_url'] as String; final filename = amMap['name'] as String; final fileExtension = filename.substring(filename.indexOf('.') + 1); - final filenameWithoutExtension = filename.substring(0, filename.indexOf('.')); + final filenameWithoutExtension = + filename.substring(0, filename.indexOf('.')); final arch = filenameWithoutExtension.endsWith('aarch64') ? CPUArchitecture.aarch64 @@ -166,15 +176,14 @@ class GithubReleases { return res.isEmpty ? null : res; } - Future _readSha(String shaUrl) async { - return (await http.get(Uri.parse(shaUrl))).body.split(' ').first; - } + Future _readSha(String shaUrl) async => + (await http.get(Uri.parse(shaUrl))).body.split(' ').first; } class FlatpakMeta { final String appId; final String lowercaseAppName; - final String appDataPath; + final String appStreamPath; final String desktopPath; final List icons; @@ -202,7 +211,7 @@ class FlatpakMeta { required List? localReleases, required List? localReleaseAssets, required this.localLinuxBuildDir, - required this.appDataPath, + required this.appStreamPath, required this.desktopPath, required this.icons, required this.freedesktopRuntime, @@ -212,88 +221,117 @@ class FlatpakMeta { : _localReleases = localReleases, _localReleaseAssets = localReleaseAssets { if (githubReleaseOrganization != null && githubReleaseProject != null) { - _githubReleases = GithubReleases(githubReleaseOrganization!, githubReleaseProject!); + _githubReleases = + GithubReleases(githubReleaseOrganization!, githubReleaseProject!); } } - Future> getReleases(bool fetchReleasesFromGithub) async { + Future> getReleases( + bool fetchReleasesFromGithub, String? addedTodaysVersion) async { + final releases = List.empty(growable: true); + if (addedTodaysVersion != null) { + releases.add(Release( + version: addedTodaysVersion, + date: DateTime.now().toIso8601String().split("T").first)); + } if (fetchReleasesFromGithub) { if (_githubReleases == null) { throw Exception( 'Metadata must include Github repository info if fetching releases from Github.'); } - return await _githubReleases!.getReleases(); + releases.addAll( + await _githubReleases!.getReleases(addedTodaysVersion != null)); } else { - if (_localReleases == null) { - throw Exception('Metadata must include releases if not fetching releases from Github.'); + if (_localReleases == null && addedTodaysVersion == null) { + throw Exception( + 'Metadata must include releases if not fetching releases from Github.'); + } + if (_localReleases?.isNotEmpty ?? false) { + releases.addAll(_localReleases!); } - return _localReleases!; } + return releases; } - Future?> getReleaseAssets(bool fetchReleasesFromGithub) async { + Future?> getLatestReleaseAssets( + bool fetchReleasesFromGithub) async { if (fetchReleasesFromGithub) { if (_githubReleases == null) { throw Exception( 'Metadata must include Github repository info if fetching releases from Github.'); } - return _githubReleases!.getLatestReleaseAssets(); + return await _githubReleases!.getLatestReleaseAssets(); } else { if (_localReleases == null) { - throw Exception('Metadata must include releases if not fetching releases from Github.'); + throw Exception( + 'Metadata must include releases if not fetching releases from Github.'); } return _localReleaseAssets; } } - static FlatpakMeta fromJson(File jsonFile) { + static FlatpakMeta fromJson(File jsonFile, {bool skipLocalReleases = false}) { try { final dynamic json = jsonDecode(jsonFile.readAsStringSync()); return FlatpakMeta( appId: json['appId'] as String, lowercaseAppName: json['lowercaseAppName'] as String, - githubReleaseOrganization: json['githubReleaseOrganization'] as String?, + githubReleaseOrganization: + json['githubReleaseOrganization'] as String?, githubReleaseProject: json['githubReleaseProject'] as String?, - localReleases: (json['localReleases'] as List?)?.map((dynamic r) { - final rMap = r as Map; - return Release(version: rMap['version'] as String, date: rMap['date'] as String); - }).toList(), - localReleaseAssets: (json['localReleaseAssets'] as List?)?.map((dynamic ra) { - final raMap = ra as Map; - final archString = raMap['arch'] as String; - final arch = (archString == CPUArchitecture.x86_64.flatpakArchCode) - ? CPUArchitecture.x86_64 - : (archString == CPUArchitecture.aarch64.flatpakArchCode) - ? CPUArchitecture.aarch64 - : null; - if (arch == null) { - throw Exception( - 'Architecture must be either "${CPUArchitecture.x86_64.flatpakArchCode}" or "${CPUArchitecture.aarch64.flatpakArchCode}"'); - } - final tarballPath = '${jsonFile.parent.path}/${raMap['tarballPath'] as String}'; - final preShasum = Process.runSync('shasum', ['-a', '256', tarballPath]); - final shasum = preShasum.stdout.toString().split(' ').first; - if (preShasum.exitCode != 0) { - throw Exception(preShasum.stderr); - } - return ReleaseAsset( - arch: arch, - tarballUrlOrPath: tarballPath, - isRelativeLocalPath: true, - tarballSha256: shasum); - }).toList(), + localReleases: skipLocalReleases + ? null + : (json['localReleases'] as List?)?.map((dynamic r) { + final rMap = r as Map; + return Release( + version: rMap['version'] as String, + date: rMap['date'] as String); + }).toList(), + localReleaseAssets: skipLocalReleases + ? null + : (json['localReleaseAssets'] as List?)?.map((dynamic ra) { + final raMap = ra as Map; + final archString = raMap['arch'] as String; + final arch = (archString == + CPUArchitecture.x86_64.flatpakArchCode) + ? CPUArchitecture.x86_64 + : (archString == CPUArchitecture.aarch64.flatpakArchCode) + ? CPUArchitecture.aarch64 + : null; + if (arch == null) { + throw Exception( + 'Architecture must be either "${CPUArchitecture.x86_64.flatpakArchCode}" or "${CPUArchitecture.aarch64.flatpakArchCode}"'); + } + final tarballFile = File( + '${jsonFile.parent.path}/${raMap['tarballPath'] as String}'); + final tarballPath = tarballFile.absolute.path; + final preShasum = + Process.runSync('shasum', ['-a', '256', tarballPath]); + final shasum = preShasum.stdout.toString().split(' ').first; + if (preShasum.exitCode != 0) { + throw Exception(preShasum.stderr); + } + return ReleaseAsset( + arch: arch, + tarballUrlOrPath: tarballPath, + isRelativeLocalPath: true, + tarballSha256: shasum); + }).toList(), localLinuxBuildDir: json['localLinuxBuildDir'] as String, - appDataPath: json['appDataPath'] as String, + appStreamPath: json['appStreamPath'] as String, desktopPath: json['desktopPath'] as String, icons: (json['icons'] as Map).entries.map((mapEntry) { - return Icon(type: mapEntry.key as String, path: mapEntry.value as String); + return Icon( + type: mapEntry.key as String, path: mapEntry.value as String); }).toList(), freedesktopRuntime: json['freedesktopRuntime'] as String, buildCommandsAfterUnpack: (json['buildCommandsAfterUnpack'] as List?) ?.map((dynamic bc) => bc as String) .toList(), extraModules: json['extraModules'] as List?, - finishArgs: (json['finishArgs'] as List).map((dynamic fa) => fa as String).toList()); + finishArgs: (json['finishArgs'] as List) + .map((dynamic fa) => fa as String) + .toList()); } catch (e) { throw Exception('Could not parse JSON file, due to this error:\n$e'); } diff --git a/flatpak/scripts/manifest_generator.dart b/flatpak/scripts/manifest_generator.dart index da27f8609..8957a3d16 100644 --- a/flatpak/scripts/manifest_generator.dart +++ b/flatpak/scripts/manifest_generator.dart @@ -1,8 +1,20 @@ +// ignore_for_file: avoid_print + import 'dart:convert'; import 'dart:io'; - import 'flatpak_shared.dart'; +/// Generates the Flatpak manifest. +/// (Separate from the package generation, as those are generated per each +/// architecture.) +/// +/// arguments: +/// --meta [file] +/// Required argument for providing the metadata file for this script. + +/// --github +/// Use this option to pull release info from Github rather than the metadata file. + void main(List arguments) async { if (Platform.isWindows) { throw Exception('Must be run under a UNIX-like operating system.'); @@ -14,7 +26,8 @@ void main(List arguments) async { 'You must run this script with a metadata file argument, using the --meta flag.'); } if (arguments.length == metaIndex + 1) { - throw Exception('The --meta flag must be followed by the path to the metadata file.'); + throw Exception( + 'The --meta flag must be followed by the path to the metadata file.'); } final metaFile = File(arguments[metaIndex + 1]); @@ -22,21 +35,25 @@ void main(List arguments) async { throw Exception('The provided metadata file does not exist.'); } - final meta = FlatpakMeta.fromJson(metaFile); - final fetchFromGithub = arguments.contains('--github'); - final outputDir = Directory('${Directory.current.path}/flatpak_generator_exports'); + final meta = + FlatpakMeta.fromJson(metaFile, skipLocalReleases: fetchFromGithub); + + final outputDir = + Directory('${Directory.current.path}/flatpak_generator_exports'); outputDir.createSync(); final manifestGenerator = FlatpakManifestGenerator(meta); - final manifestContent = await manifestGenerator.generateFlatpakManifest(fetchFromGithub); + final manifestContent = + await manifestGenerator.generateFlatpakManifest(fetchFromGithub); final manifestPath = '${outputDir.path}/${meta.appId}.json'; final manifestFile = File(manifestPath); manifestFile.writeAsStringSync(manifestContent); print('Generated $manifestPath'); - final flathubJsonContent = await manifestGenerator.generateFlathubJson(fetchFromGithub); + final flathubJsonContent = + await manifestGenerator.generateFlathubJson(fetchFromGithub); if (flathubJsonContent != null) { final flathubJsonPath = '${outputDir.path}/flathub.json'; final flathubJsonFile = File(flathubJsonPath); @@ -56,7 +73,7 @@ class FlatpakManifestGenerator { Future generateFlatpakManifest(bool fetchFromGithub) async { final appName = meta.lowercaseAppName; final appId = meta.appId; - final assets = await meta.getReleaseAssets(fetchFromGithub); + final assets = await meta.getLatestReleaseAssets(fetchFromGithub); if (assets == null) { throw Exception('There are no associated assets.'); @@ -88,7 +105,7 @@ class FlatpakManifestGenerator { ...meta.icons.map((icon) => 'install -Dm644 $appName/icons/${icon.type}/${icon.getFilename(appId)} /app/share/icons/hicolor/${icon.type}/apps/${icon.getFilename(appId)}'), 'install -Dm644 $appName/$appId.desktop /app/share/applications/$appId.desktop', - 'install -Dm644 $appName/$appId.appdata.xml /app/share/applications/$appId.appdata.xml' + 'install -Dm644 $appName/$appId.metainfo.xml /app/share/metainfo/$appId.metainfo.xml' ], 'sources': assets .map((a) => { @@ -105,7 +122,7 @@ class FlatpakManifestGenerator { } Future generateFlathubJson(bool fetchFromGithub) async { - final assets = await meta.getReleaseAssets(fetchFromGithub); + final assets = await meta.getLatestReleaseAssets(fetchFromGithub); if (assets == null) { throw Exception('There are no associated assets.'); @@ -115,7 +132,8 @@ class FlatpakManifestGenerator { const encoder = JsonEncoder.withIndent(' '); - final onlyArchListInput = fetchFromGithub ? _githubArchSupport! : _localArchSupport!; + final onlyArchListInput = + fetchFromGithub ? _githubArchSupport! : _localArchSupport!; final onlyArchList = List.empty(growable: true); for (final e in onlyArchListInput.entries) { @@ -131,7 +149,8 @@ class FlatpakManifestGenerator { } } - void _lazyGenerateArchSupportMap(bool fetchFromGithub, List assets) { + void _lazyGenerateArchSupportMap( + bool fetchFromGithub, List assets) { if (fetchFromGithub) { if (_githubArchSupport == null) { _githubArchSupport = { From 0400d1b9c4e243c75621a74fb75da77a9ea0c4f5 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 6 Dec 2023 21:07:43 +0100 Subject: [PATCH 08/24] Small tweaks --- lib/l10n/app_en.arb | 3 +-- lib/widgets/nutrition/meal.dart | 2 +- lib/widgets/workouts/day.dart | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index a44457c75..8618567a7 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -809,10 +809,9 @@ "@none__bodyweight_exercise_": { "description": "Generated entry for translation for server strings" }, - "editSchedule": "Edit schedule", "log": "Log", "@log": { - "description": "Log a specific meal" + "description": "Log a specific meal (imperative form)" }, "done": "Done" } diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index 2002c0ae8..a9d71c132 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -94,7 +94,7 @@ class _MealWidgetState extends State { }, ), TextButton.icon( - label: Text(AppLocalizations.of(context).editSchedule), + label: Text(AppLocalizations.of(context).edit), onPressed: () { Navigator.pushNamed( context, diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index 6fc911f55..30df13594 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -194,7 +194,7 @@ class _WorkoutDayWidgetState extends State { ), TextButton.icon( icon: const Icon(Icons.calendar_month), - label: Text(AppLocalizations.of(context).editSchedule), + label: Text(AppLocalizations.of(context).edit), onPressed: () { Navigator.pushNamed( context, From d59553d558008ba797b4c3b51b30d2b1e560b40b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:09:56 +0000 Subject: [PATCH 09/24] Bump sqlite3_flutter_libs from 0.5.18 to 0.5.19+1 Bumps [sqlite3_flutter_libs](https://github.com/simolus3/sqlite3.dart) from 0.5.18 to 0.5.19+1. - [Release notes](https://github.com/simolus3/sqlite3.dart/releases) - [Commits](https://github.com/simolus3/sqlite3.dart/compare/sqlite3_flutter_libs-0.5.18...sqlite3_flutter_libs-0.5.19) --- updated-dependencies: - dependency-name: sqlite3_flutter_libs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 3edd1fcad..75e046e51 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1189,10 +1189,10 @@ packages: dependency: "direct main" description: name: sqlite3_flutter_libs - sha256: "3e3583b77cf888a68eae2e49ee4f025f66b86623ef0d83c297c8d903daa14871" + sha256: "90963b515721d6a71e96f438175cf43c979493ed14822860a300b69694c74eb6" url: "https://pub.dev" source: hosted - version: "0.5.18" + version: "0.5.19+1" sqlparser: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 16c57f952..b31a6cddf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,7 +62,7 @@ dependencies: drift: ^2.15.0 path: ^1.8.3 path_provider: ^2.1.1 - sqlite3_flutter_libs: ^0.5.18 + sqlite3_flutter_libs: ^0.5.19+1 get_it: ^7.6.4 flex_seed_scheme: ^1.4.0 flex_color_scheme: ^7.3.1 From f45c49f5b212fd312b4fde017dae8ee8fb2c4848 Mon Sep 17 00:00:00 2001 From: Victor Jouhoff Date: Tue, 23 Jan 2024 04:51:47 +0000 Subject: [PATCH 10/24] Translated using Weblate (German) Currently translated at 99.5% (240 of 241 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/de/ --- lib/l10n/app_de.arb | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 5660e72dc..cc88438a8 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -748,5 +748,45 @@ "description": "Generated entry for translation for server strings" }, "verify": "Verifizieren", - "@verify": {} + "@verify": {}, + "textPromptTitle": "Bereit zu starten?", + "@textPromptTitle": {}, + "settingsTitle": "Einstellung", + "@settingsTitle": {}, + "textPromptSubheading": "Drücken Sie die Aktionstaste, um zu beginnen", + "@textPromptSubheading": {}, + "max_reps": "Max. Wiederholungen", + "@max_reps": { + "description": "Generated entry for translation for server strings" + }, + "noMatchingExerciseFound": "Diese Übung wurde nicht gefunden", + "@noMatchingExerciseFound": { + "description": "Message returned if no exercises match the searched string" + }, + "aboutMastodonTitle": "Mastodon", + "@aboutMastodonTitle": { + "description": "Title for mastodon section in the about dialog" + }, + "plates": "Platten", + "@plates": { + "description": "Generated entry for translation for server strings" + }, + "aboutMastodonText": "Folgen Sie uns auf Mastodon für Updates und Neuigkeiten zum Projekt", + "@aboutMastodonText": { + "description": "Text for the mastodon section in the about dialog" + }, + "aboutDonateTitle": "Spende", + "@aboutDonateTitle": {}, + "aboutDonateText": "Kaufen Sie uns einen Kaffee, um das Projekt zu unterstützen, Serverkosten zu decken und uns weiterhin zu versorgen", + "@aboutDonateText": {}, + "settingsCacheTitle": "Zwischenspeicher", + "@settingsCacheTitle": {}, + "settingsCacheDescription": "Übungs-Zwischenspeicher", + "@settingsCacheDescription": {}, + "settingsCacheDeletedSnackbar": "Zwischenspeicher erfolgreich gelöscht", + "@settingsCacheDeletedSnackbar": {}, + "lb": "Pfund", + "@lb": { + "description": "Generated entry for translation for server strings" + } } From 4f2ee9e4d5b5b6bba370c5c536cb57e85319ba3e Mon Sep 17 00:00:00 2001 From: Costas Korai Date: Wed, 24 Jan 2024 00:44:26 +1100 Subject: [PATCH 11/24] Add clock package as a dependency --- pubspec.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/pubspec.yaml b/pubspec.yaml index b31a6cddf..c2852e7dd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -67,6 +67,7 @@ dependencies: flex_seed_scheme: ^1.4.0 flex_color_scheme: ^7.3.1 freezed_annotation: ^2.4.1 + clock: ^1.1.1 dev_dependencies: flutter_test: From 135ddb4a782b1bece2a3292404d47199d22eea7f Mon Sep 17 00:00:00 2001 From: Costas Korai Date: Wed, 24 Jan 2024 00:47:43 +1100 Subject: [PATCH 12/24] Update to use clock.now where needed - The initial time set in the MealForm is defined in the meal model object provided to the MealForm so both the test and the meal object had to use clock.now in order for the fixed value to apply to both. --- lib/models/nutrition/meal.dart | 3 +- .../nutrition/nutritional_meal_form_test.dart | 46 +++++++++++++------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/lib/models/nutrition/meal.dart b/lib/models/nutrition/meal.dart index a89330bb6..eff3f3d15 100644 --- a/lib/models/nutrition/meal.dart +++ b/lib/models/nutrition/meal.dart @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import 'package:clock/clock.dart'; import 'package:flutter/material.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; @@ -54,7 +55,7 @@ class Meal { this.mealItems = mealItems ?? []; - this.time = time ?? TimeOfDay.now(); + this.time = time ?? TimeOfDay.fromDateTime(clock.now()); this.name = name ?? ''; } diff --git a/test/nutrition/nutritional_meal_form_test.dart b/test/nutrition/nutritional_meal_form_test.dart index 303e291b5..34a87b5ba 100644 --- a/test/nutrition/nutritional_meal_form_test.dart +++ b/test/nutrition/nutritional_meal_form_test.dart @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import 'package:clock/clock.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -39,7 +40,6 @@ void main() { var plan1 = NutritionalPlan.empty(); var meal1 = Meal(); - final meal2 = Meal(); when(mockNutrition.editMeal(any)).thenAnswer((_) => Future.value(Meal())); when(mockNutrition.addMeal(any, any)).thenAnswer((_) => Future.value(Meal())); @@ -105,22 +105,40 @@ void main() { }); testWidgets('Test creating a new nutritional plan', (WidgetTester tester) async { - await tester.pumpWidget(createHomeScreen(meal2)); - await tester.pumpAndSettle(); + // DateTime.now() is difficult to mock as it pull directly from the platform + // currently being run. The clock pacakge (https://pub.dev/packages/clock) + // addresses this issue, using clock.now() allows us to set a fixed value as the + // response when using withClock. + final fixedDateTimeValue = DateTime(2020, 09, 01, 01, 01); + withClock(Clock.fixed(fixedDateTimeValue), () async { + // The time set in the meal object is what is displayed by default + // and can be matched with the find.text function. By creating the meal + // wrapped in the withClock it also shares the same now value. + final fixedTimeMeal = Meal(); - expect( - find.text(timeToString(TimeOfDay.now())!), - findsOneWidget, - reason: 'Current time is filled in', - ); + await tester.pumpWidget(createHomeScreen(fixedTimeMeal)); + await tester.pumpAndSettle(); - await tester.enterText(find.byKey(const Key('field-time')), '08:00'); - await tester.enterText(find.byKey(const Key('field-name')), 'test meal'); - await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); + expect( + clock.now(), + fixedDateTimeValue, + reason: 'Current time is set to a fixed value for testing', + ); - // Correct method was called - verifyNever(mockNutrition.editMeal(any)); - verify(mockNutrition.addMeal(any, any)); + expect( + find.text(timeToString(TimeOfDay.fromDateTime(clock.now()))!), + findsOneWidget, + reason: 'Current time is filled in', + ); + + await tester.enterText(find.byKey(const Key('field-time')), '08:00'); + await tester.enterText(find.byKey(const Key('field-name')), 'test meal'); + await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); + + // Correct method was called + verifyNever(mockNutrition.editMeal(any)); + verify(mockNutrition.addMeal(any, any)); + }); // Detail page // ... From 143f73539522bb830c768788c644c80621ae0970 Mon Sep 17 00:00:00 2001 From: Costas Korai Date: Wed, 24 Jan 2024 00:51:34 +1100 Subject: [PATCH 13/24] Update authors.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index b617a4a7c..5372b1bc7 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -25,6 +25,7 @@ - Abhishek Saini - - Hanaa Allohibi - - Shey Alnasrawi - +- Costas Korai - ## Translators From 3f46277c7540e042880e95dae164bc1889834ca4 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 23 Jan 2024 14:58:53 +0100 Subject: [PATCH 14/24] Fix test Since we're mocking the provider no entries are actually being deleted anywhere --- lib/widgets/weight/entries_list.dart | 31 ++++++++++++++------------- test/weight/weight_provider_test.dart | 2 +- test/weight/weight_screen_test.dart | 13 +++++------ 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index ff3f033ef..99f703102 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -81,23 +81,24 @@ class WeightEntriesList extends StatelessWidget { ), )), PopupMenuItem( - child: Text(AppLocalizations.of(context).delete), - onTap: () async { - // Delete entry from DB - await weightProvider.deleteEntry(currentEntry.id!); + child: Text(AppLocalizations.of(context).delete), + onTap: () async { + // Delete entry from DB + await weightProvider.deleteEntry(currentEntry.id!); - // and inform the user - if (context.mounted) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - AppLocalizations.of(context).successfullyDeleted, - textAlign: TextAlign.center, - ), + // and inform the user + if (context.mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.of(context).successfullyDeleted, + textAlign: TextAlign.center, ), - ); - } - }) + ), + ); + } + }, + ) ]; }, ), diff --git a/test/weight/weight_provider_test.dart b/test/weight/weight_provider_test.dart index 6f4dccad8..72488713d 100644 --- a/test/weight/weight_provider_test.dart +++ b/test/weight/weight_provider_test.dart @@ -31,7 +31,7 @@ import 'weight_provider_test.mocks.dart'; @GenerateMocks([WgerBaseProvider]) void main() { - var mockBaseProvider = MockWgerBaseProvider(); + late MockWgerBaseProvider mockBaseProvider; setUp(() { mockBaseProvider = MockWgerBaseProvider(); diff --git a/test/weight/weight_screen_test.dart b/test/weight/weight_screen_test.dart index f566e8e1b..49894e358 100644 --- a/test/weight/weight_screen_test.dart +++ b/test/weight/weight_screen_test.dart @@ -33,12 +33,14 @@ import 'weight_screen_test.mocks.dart'; @GenerateMocks([BodyWeightProvider]) void main() { - var mockWeightProvider = MockBodyWeightProvider(); + late MockBodyWeightProvider mockWeightProvider; - Widget createWeightScreen({locale = 'en'}) { + setUp(() { mockWeightProvider = MockBodyWeightProvider(); when(mockWeightProvider.items).thenReturn(getWeightEntries()); + }); + Widget createWeightScreen({locale = 'en'}) { return ChangeNotifierProvider( create: (context) => mockWeightProvider, child: MaterialApp( @@ -63,18 +65,18 @@ void main() { }); testWidgets('Test deleting an item using the Delete button', (WidgetTester tester) async { + // Arrange await tester.pumpWidget(createWeightScreen()); + // Act expect(find.byType(ListTile), findsNWidgets(2)); - await tester.tap(find.byTooltip('Show menu').first); await tester.pumpAndSettle(); + // Assert await tester.tap(find.text('Delete')); await tester.pumpAndSettle(); - verify(mockWeightProvider.deleteEntry(1)).called(1); - expect(find.byType(ListTile), findsOneWidget); }); testWidgets('Test the form on the body weight screen', (WidgetTester tester) async { @@ -89,7 +91,6 @@ void main() { testWidgets('Tests the localization of dates - EN', (WidgetTester tester) async { await tester.pumpWidget(createWeightScreen()); - // One in the entries list, one in the chart expect(find.text('1/1/2021'), findsOneWidget); expect(find.text('1/10/2021'), findsOneWidget); }); From 5003c00b32a9509a1699671affd977223f416144 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 6 Dec 2023 21:07:43 +0100 Subject: [PATCH 15/24] Small tweaks --- lib/l10n/app_en.arb | 3 +-- lib/widgets/nutrition/meal.dart | 2 +- lib/widgets/workouts/day.dart | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index a44457c75..8618567a7 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -809,10 +809,9 @@ "@none__bodyweight_exercise_": { "description": "Generated entry for translation for server strings" }, - "editSchedule": "Edit schedule", "log": "Log", "@log": { - "description": "Log a specific meal" + "description": "Log a specific meal (imperative form)" }, "done": "Done" } diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index 2002c0ae8..a9d71c132 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -94,7 +94,7 @@ class _MealWidgetState extends State { }, ), TextButton.icon( - label: Text(AppLocalizations.of(context).editSchedule), + label: Text(AppLocalizations.of(context).edit), onPressed: () { Navigator.pushNamed( context, diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index 6fc911f55..30df13594 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -194,7 +194,7 @@ class _WorkoutDayWidgetState extends State { ), TextButton.icon( icon: const Icon(Icons.calendar_month), - label: Text(AppLocalizations.of(context).editSchedule), + label: Text(AppLocalizations.of(context).edit), onPressed: () { Navigator.pushNamed( context, From d4786601bf7eaeee9d1c768ed864b6ec68966189 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 23 Jan 2024 15:22:03 +0100 Subject: [PATCH 16/24] Update Gemfile.lock --- Gemfile.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile.lock b/Gemfile.lock index e0b3d0764..b0b1c2f1d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -208,6 +208,7 @@ GEM PLATFORMS arm64-darwin-21 arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES From d4e4f3384ab656a28e12dd12c65f6de932219fd4 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 23 Jan 2024 16:33:32 +0100 Subject: [PATCH 17/24] Use the user's preferred unit for body weight --- lib/l10n/app_de.arb | 2 +- lib/l10n/app_en.arb | 1 + lib/models/user/profile.dart | 7 ++ lib/models/user/profile.g.dart | 4 +- lib/widgets/dashboard/widgets.dart | 12 ++- lib/widgets/user/forms.dart | 50 +++++++--- lib/widgets/weight/entries_list.dart | 8 +- test/weight/weight_screen_test.dart | 37 +++++--- test/weight/weight_screen_test.mocks.dart | 110 ++++++++++++++++++++++ test_data/profile.dart | 1 + 10 files changed, 199 insertions(+), 33 deletions(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index cc88438a8..513b19daa 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -785,7 +785,7 @@ "@settingsCacheDescription": {}, "settingsCacheDeletedSnackbar": "Zwischenspeicher erfolgreich gelöscht", "@settingsCacheDeletedSnackbar": {}, - "lb": "Pfund", + "lb": "lb", "@lb": { "description": "Generated entry for translation for server strings" } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 8618567a7..eb55d59e1 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -167,6 +167,7 @@ "@rirNotUsed": { "description": "Label used in RiR slider when the RiR value is not used/saved for the current setting or log" }, + "useMetric": "Use metric units for body weight", "weightUnit": "Weight unit", "@weightUnit": {}, "repetitionUnit": "Repetition unit", diff --git a/lib/models/user/profile.dart b/lib/models/user/profile.dart index 5bb5335b5..ed7cb174a 100644 --- a/lib/models/user/profile.dart +++ b/lib/models/user/profile.dart @@ -31,6 +31,11 @@ class Profile { @JsonKey(required: true, name: 'is_trustworthy') bool isTrustworthy; + @JsonKey(required: true, name: 'weight_unit') + String weightUnitStr; + + bool get isMetric => weightUnitStr == 'kg'; + @JsonKey(required: true) String email; @@ -39,9 +44,11 @@ class Profile { required this.emailVerified, required this.isTrustworthy, required this.email, + required this.weightUnitStr, }); // Boilerplate factory Profile.fromJson(Map json) => _$ProfileFromJson(json); + Map toJson() => _$ProfileToJson(this); } diff --git a/lib/models/user/profile.g.dart b/lib/models/user/profile.g.dart index fc05b9cf2..1bc975c27 100644 --- a/lib/models/user/profile.g.dart +++ b/lib/models/user/profile.g.dart @@ -9,13 +9,14 @@ part of 'profile.dart'; Profile _$ProfileFromJson(Map json) { $checkKeys( json, - requiredKeys: const ['username', 'email_verified', 'is_trustworthy', 'email'], + requiredKeys: const ['username', 'email_verified', 'is_trustworthy', 'weight_unit', 'email'], ); return Profile( username: json['username'] as String, emailVerified: json['email_verified'] as bool, isTrustworthy: json['is_trustworthy'] as bool, email: json['email'] as String, + weightUnitStr: json['weight_unit'] as String, ); } @@ -23,5 +24,6 @@ Map _$ProfileToJson(Profile instance) => { 'username': instance.username, 'email_verified': instance.emailVerified, 'is_trustworthy': instance.isTrustworthy, + 'weight_unit': instance.weightUnitStr, 'email': instance.email, }; diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index 6b265658a..d3acd0846 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -27,6 +27,7 @@ import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/providers/body_weight.dart'; import 'package:wger/providers/measurement.dart'; import 'package:wger/providers/nutrition.dart'; +import 'package:wger/providers/user.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/gym_mode.dart'; @@ -243,6 +244,7 @@ class _DashboardWeightWidgetState extends State { @override Widget build(BuildContext context) { + final profile = context.read().profile; weightEntriesData = Provider.of(context, listen: false); return Consumer( @@ -267,9 +269,13 @@ class _DashboardWeightWidgetState extends State { children: [ SizedBox( height: 200, - child: MeasurementChartWidgetFl(weightEntriesData.items - .map((e) => MeasurementChartEntry(e.weight, e.date)) - .toList()), + child: MeasurementChartWidgetFl( + weightEntriesData.items + .map((e) => MeasurementChartEntry(e.weight, e.date)) + .toList(), + unit: profile!.isMetric + ? AppLocalizations.of(context).kg + : AppLocalizations.of(context).lb), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/widgets/user/forms.dart b/lib/widgets/user/forms.dart index 87907f8ed..5f4a58cdc 100644 --- a/lib/widgets/user/forms.dart +++ b/lib/widgets/user/forms.dart @@ -23,14 +23,26 @@ import 'package:wger/models/user/profile.dart'; import 'package:wger/providers/user.dart'; import 'package:wger/theme/theme.dart'; -class UserProfileForm extends StatelessWidget { +class UserProfileForm extends StatefulWidget { late final Profile _profile; - final _form = GlobalKey(); - final emailController = TextEditingController(); UserProfileForm(Profile profile) { _profile = profile; - emailController.text = _profile.email; + } + + @override + State createState() => _UserProfileFormState(); +} + +class _UserProfileFormState extends State { + final _form = GlobalKey(); + + final emailController = TextEditingController(); + + @override + void initState() { + super.initState(); + emailController.text = widget._profile.email; } @override @@ -42,16 +54,29 @@ class UserProfileForm extends StatelessWidget { ListTile( leading: const Icon(Icons.person, color: wgerPrimaryColor), title: Text(AppLocalizations.of(context).username), - subtitle: Text(_profile.username), + subtitle: Text(widget._profile.username), + ), + SwitchListTile( + title: Text(AppLocalizations.of(context).useMetric), + subtitle: Text(widget._profile.weightUnitStr), + value: widget._profile.isMetric, + onChanged: (_) { + setState(() { + widget._profile.weightUnitStr = widget._profile.isMetric + ? AppLocalizations.of(context).lb + : AppLocalizations.of(context).kg; + }); + }, + dense: true, ), ListTile( leading: const Icon(Icons.email_rounded, color: wgerPrimaryColor), title: TextFormField( decoration: InputDecoration( - labelText: _profile.emailVerified + labelText: widget._profile.emailVerified ? AppLocalizations.of(context).verifiedEmail : AppLocalizations.of(context).unVerifiedEmail, - suffixIcon: _profile.emailVerified + suffixIcon: widget._profile.emailVerified ? const Icon( Icons.check_circle, color: Colors.green, @@ -60,7 +85,7 @@ class UserProfileForm extends StatelessWidget { controller: emailController, keyboardType: TextInputType.emailAddress, onSaved: (newValue) { - _profile.email = newValue!; + widget._profile.email = newValue!; }, validator: (value) { if (value!.isNotEmpty && !value.contains('@')) { @@ -70,11 +95,11 @@ class UserProfileForm extends StatelessWidget { }, ), ), - if (!_profile.emailVerified) + if (!widget._profile.emailVerified) OutlinedButton( onPressed: () async { // Email is already verified - if (_profile.emailVerified) { + if (widget._profile.emailVerified) { return; } @@ -83,7 +108,7 @@ class UserProfileForm extends StatelessWidget { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - AppLocalizations.of(context).verifiedEmailInfo(_profile.email), + AppLocalizations.of(context).verifiedEmailInfo(widget._profile.email), ), ), ); @@ -91,9 +116,6 @@ class UserProfileForm extends StatelessWidget { child: Text(AppLocalizations.of(context).verify), ), ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: wgerPrimaryButtonColor, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(50))), onPressed: () async { // Validate and save the current values to the weightEntry final isValid = _form.currentState!.validate(); diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index 8377ec5b6..bf42303ba 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -21,6 +21,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:wger/providers/body_weight.dart'; +import 'package:wger/providers/user.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/measurement_categories_screen.dart'; import 'package:wger/widgets/measurements/charts.dart'; @@ -29,6 +30,7 @@ import 'package:wger/widgets/weight/forms.dart'; class WeightEntriesList extends StatelessWidget { @override Widget build(BuildContext context) { + final profile = context.read().profile; final weightProvider = Provider.of(context, listen: false); return Column( @@ -37,7 +39,11 @@ class WeightEntriesList extends StatelessWidget { padding: const EdgeInsets.all(15), height: 220, child: MeasurementChartWidgetFl( - weightProvider.items.map((e) => MeasurementChartEntry(e.weight, e.date)).toList()), + weightProvider.items.map((e) => MeasurementChartEntry(e.weight, e.date)).toList(), + unit: profile!.isMetric + ? AppLocalizations.of(context).kg + : AppLocalizations.of(context).lb, + ), ), TextButton( onPressed: () => Navigator.pushNamed( diff --git a/test/weight/weight_screen_test.dart b/test/weight/weight_screen_test.dart index 10bd75bd0..575867d3b 100644 --- a/test/weight/weight_screen_test.dart +++ b/test/weight/weight_screen_test.dart @@ -23,32 +23,43 @@ import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; import 'package:wger/providers/body_weight.dart'; +import 'package:wger/providers/user.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/weight_screen.dart'; import 'package:wger/widgets/measurements/charts.dart'; import 'package:wger/widgets/weight/forms.dart'; import '../../test_data/body_weight.dart'; +import '../../test_data/profile.dart'; import 'weight_screen_test.mocks.dart'; -@GenerateMocks([BodyWeightProvider]) +@GenerateMocks([BodyWeightProvider, UserProvider]) void main() { - var mockWeightProvider = MockBodyWeightProvider(); + late MockBodyWeightProvider mockWeightProvider; + late MockUserProvider mockUserProvider; - Widget createWeightScreen({locale = 'en'}) { + setUp(() { mockWeightProvider = MockBodyWeightProvider(); when(mockWeightProvider.items).thenReturn(getWeightEntries()); - return ChangeNotifierProvider( - create: (context) => mockWeightProvider, - child: MaterialApp( - locale: Locale(locale), - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: AppLocalizations.supportedLocales, - home: WeightScreen(), - routes: { - FormScreen.routeName: (_) => FormScreen(), - }, + mockUserProvider = MockUserProvider(); + when(mockUserProvider.profile).thenReturn(tProfile1); + }); + + Widget createWeightScreen({locale = 'en'}) { + return ChangeNotifierProvider( + create: (context) => mockUserProvider, + child: ChangeNotifierProvider( + create: (context) => mockWeightProvider, + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: WeightScreen(), + routes: { + FormScreen.routeName: (_) => FormScreen(), + }, + ), ), ); } diff --git a/test/weight/weight_screen_test.mocks.dart b/test/weight/weight_screen_test.mocks.dart index 530a9aeb7..e42d7e68f 100644 --- a/test/weight/weight_screen_test.mocks.dart +++ b/test/weight/weight_screen_test.mocks.dart @@ -8,8 +8,10 @@ import 'dart:ui' as _i6; import 'package:mockito/mockito.dart' as _i1; import 'package:wger/models/body_weight/weight_entry.dart' as _i3; +import 'package:wger/models/user/profile.dart' as _i8; import 'package:wger/providers/base_provider.dart' as _i2; import 'package:wger/providers/body_weight.dart' as _i4; +import 'package:wger/providers/user.dart' as _i7; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -192,3 +194,111 @@ class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider returnValueForMissingStub: null, ); } + +/// A class which mocks [UserProvider]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockUserProvider extends _i1.Mock implements _i7.UserProvider { + MockUserProvider() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.WgerBaseProvider get baseProvider => (super.noSuchMethod( + Invocation.getter(#baseProvider), + returnValue: _FakeWgerBaseProvider_0( + this, + Invocation.getter(#baseProvider), + ), + ) as _i2.WgerBaseProvider); + + @override + set profile(_i8.Profile? _profile) => super.noSuchMethod( + Invocation.setter( + #profile, + _profile, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); + + @override + void clear() => super.noSuchMethod( + Invocation.method( + #clear, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i5.Future fetchAndSetProfile() => (super.noSuchMethod( + Invocation.method( + #fetchAndSetProfile, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future saveProfile() => (super.noSuchMethod( + Invocation.method( + #saveProfile, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + _i5.Future verifyEmail() => (super.noSuchMethod( + Invocation.method( + #verifyEmail, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + + @override + void addListener(_i6.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #removeListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method( + #notifyListeners, + [], + ), + returnValueForMissingStub: null, + ); +} diff --git a/test_data/profile.dart b/test_data/profile.dart index f908c8587..f7e053f98 100644 --- a/test_data/profile.dart +++ b/test_data/profile.dart @@ -5,4 +5,5 @@ final tProfile1 = Profile( emailVerified: true, isTrustworthy: true, email: 'admin@google.com', + weightUnitStr: 'kg', ); From d31b09d8e289e1454a910d12b257cfed62480c1e Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 23 Jan 2024 16:56:10 +0100 Subject: [PATCH 18/24] Make behaviour of cards more consistent Now the nutrition card has the "go to detail page" on the left and the action icon on the right as well --- lib/widgets/dashboard/widgets.dart | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index d3acd0846..59df7d3ef 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -206,7 +206,17 @@ class _DashboardNutritionWidgetState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ TextButton( - child: Text(AppLocalizations.of(context).logIngredient), + child: Text(AppLocalizations.of(context).goToDetailPage), + onPressed: () { + Navigator.of(context) + .pushNamed(NutritionalPlanScreen.routeName, arguments: _plan); + }, + ), + IconButton( + icon: const Icon( + Icons.history_edu, + ), + tooltip: AppLocalizations.of(context).logIngredient, onPressed: () { Navigator.pushNamed( context, @@ -219,13 +229,6 @@ class _DashboardNutritionWidgetState extends State { ); }, ), - TextButton( - child: Text(AppLocalizations.of(context).goToDetailPage), - onPressed: () { - Navigator.of(context) - .pushNamed(NutritionalPlanScreen.routeName, arguments: _plan); - }, - ), ], ), ], From eba08b1d66c4e88b1679f64d817322ac09662ee7 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 23 Jan 2024 16:56:10 +0100 Subject: [PATCH 19/24] Make behaviour of cards more consistent Now the workout card has the "go to detail page" on the left as well --- lib/widgets/dashboard/widgets.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index 59df7d3ef..aedf5ef67 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -575,7 +575,7 @@ class _DashboardWorkoutWidgetState extends State { ), if (_hasContent) Row( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.start, children: [ TextButton( child: Text(AppLocalizations.of(context).goToDetailPage), From 4af4462498b477bd0a2e1830cf7ce7bc0ddb03c0 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 23 Jan 2024 21:14:06 +0100 Subject: [PATCH 20/24] Remove unused import --- lib/widgets/measurements/entries.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/widgets/measurements/entries.dart b/lib/widgets/measurements/entries.dart index cb4134ed0..b37eea4ca 100644 --- a/lib/widgets/measurements/entries.dart +++ b/lib/widgets/measurements/entries.dart @@ -23,7 +23,6 @@ import 'package:provider/provider.dart'; import 'package:wger/models/measurements/measurement_category.dart'; import 'package:wger/providers/measurement.dart'; import 'package:wger/screens/form_screen.dart'; -import 'package:wger/theme/theme.dart'; import 'package:wger/widgets/measurements/charts.dart'; import 'forms.dart'; From 2c892dddb8270e79aca356c9fef9befebd999e60 Mon Sep 17 00:00:00 2001 From: Milo Ivir Date: Wed, 24 Jan 2024 19:16:13 +0000 Subject: [PATCH 21/24] Translated using Weblate (Croatian) Currently translated at 100.0% (244 of 244 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/hr/ --- lib/l10n/app_hr.arb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_hr.arb b/lib/l10n/app_hr.arb index 2b98be30f..8c6125fb6 100644 --- a/lib/l10n/app_hr.arb +++ b/lib/l10n/app_hr.arb @@ -835,5 +835,13 @@ "settingsCacheDescription": "Izvrši predmemoriju", "@settingsCacheDescription": {}, "settingsCacheDeletedSnackbar": "Predmemorija je uspješno izbrisana", - "@settingsCacheDeletedSnackbar": {} + "@settingsCacheDeletedSnackbar": {}, + "useMetric": "Koristi metričke jedinice za tjelesnu težinu", + "@useMetric": {}, + "log": "Zapiši", + "@log": { + "description": "Log a specific meal (imperative form)" + }, + "done": "Obavljeno", + "@done": {} } From dcb54cfe69977107fadde53fe3aebbf9fb8268c6 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 25 Jan 2024 12:30:33 +0100 Subject: [PATCH 22/24] Also copy flathub.json --- .github/workflows/build-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e5d6d0c2b..fcf51cd4a 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -92,6 +92,7 @@ jobs: dart manifest_generator.dart --meta ../flatpak_meta.json --github mkdir ../../flathub cp flatpak_generator_exports/de.wger.flutter.json ../../flathub + cp flatpak_generator_exports/flathub.json ../../flathub - name: Push updated config to flathub repository uses: cpina/github-action-push-to-another-repository@main @@ -120,7 +121,5 @@ jobs: git checkout -b release-${{ env.VERSION }} git add pubspec.yaml git commit -m "Bump version to $( flutter pub run cider version )" - git tag ${{ env.VERSION }} - git push origin ${{ env.VERSION }} git push origin --delete ${{ env.VERSION_V }} git push \ No newline at end of file From 1801f8075a57b5c7b9e376e3c0289d9129629494 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 25 Jan 2024 12:31:34 +0100 Subject: [PATCH 23/24] Manually bump version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index c2852e7dd..f1f1d01fc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # - the version number is taken from the git tag vX.Y.Z # - the build number is computed by reading the last one from the play store # and increasing by one -version: 1.6.4+39 +version: 1.7.0+40 environment: sdk: '>=3.0.0 <4.0.0' From 6038b23685addac26bb5913c77a151806bc642b8 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 27 Jan 2024 22:03:18 +0100 Subject: [PATCH 24/24] Update iOS related files --- ios/Flutter/AppFrameworkInfo.plist | 2 +- ios/Podfile.lock | 37 +++++++++++++++++++++++++--- ios/Runner.xcodeproj/project.pbxproj | 6 ++--- macos/Podfile.lock | 35 ++++++++++++++++++++++++-- 4 files changed, 71 insertions(+), 9 deletions(-) diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 4f8d4d245..8c6e56146 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index b8acaa9e4..0cdb23fc2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -14,11 +14,29 @@ PODS: - Flutter - package_info_plus (0.4.5): - Flutter + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS - rive_common (0.0.1): - Flutter - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS + - sqlite3 (3.45.0): + - sqlite3/common (= 3.45.0) + - sqlite3/common (3.45.0) + - sqlite3/fts5 (3.45.0): + - sqlite3/common + - sqlite3/perf-threadsafe (3.45.0): + - sqlite3/common + - sqlite3/rtree (3.45.0): + - sqlite3/common + - sqlite3_flutter_libs (0.0.1): + - Flutter + - sqlite3 (~> 3.45.0) + - sqlite3/fts5 + - sqlite3/perf-threadsafe + - sqlite3/rtree - url_launcher_ios (0.0.1): - Flutter - video_player_avfoundation (0.0.1): @@ -34,11 +52,17 @@ DEPENDENCIES: - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - integration_test (from `.symlinks/plugins/integration_test/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - rive_common (from `.symlinks/plugins/rive_common/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`) +SPEC REPOS: + trunk: + - sqlite3 + EXTERNAL SOURCES: camera_avfoundation: :path: ".symlinks/plugins/camera_avfoundation/ios" @@ -56,10 +80,14 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/integration_test/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" rive_common: :path: ".symlinks/plugins/rive_common/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + sqlite3_flutter_libs: + :path: ".symlinks/plugins/sqlite3_flutter_libs/ios" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" video_player_avfoundation: @@ -67,17 +95,20 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_barcode_scanner: 7a1144744c28dc0c57a8de7218ffe5ec59a9e4bf flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 flutter_zxing: 19a866d17c8a87ee1026d68521c69d2f008635f6 image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 integration_test: 13825b8a9334a850581300559b8839134b124670 package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 rive_common: 3a4c254c6e4db7e4b9e05daeb3d1f47ae4f7bf76 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 - url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86 - video_player_avfoundation: 8563f13d8fc8b2c29dc2d09e60b660e4e8128837 + sqlite3: f307b6291c4db7b5086c38d6237446b98a738581 + sqlite3_flutter_libs: aeb4d37509853dfa79d9b59386a2dac5dd079428 + url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b + video_player_avfoundation: e9e6f9cae7d7a6d9b43519b0aab382bca60fcfd1 PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 08905a67e..eaa06d26b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -342,7 +342,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -428,7 +428,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -477,7 +477,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 2c359a411..89124fad9 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -6,11 +6,29 @@ PODS: - FlutterMacOS (1.0.0) - package_info_plus (0.0.1): - FlutterMacOS + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS - rive_common (0.0.1): - FlutterMacOS - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS + - sqlite3 (3.45.0): + - sqlite3/common (= 3.45.0) + - sqlite3/common (3.45.0) + - sqlite3/fts5 (3.45.0): + - sqlite3/common + - sqlite3/perf-threadsafe (3.45.0): + - sqlite3/common + - sqlite3/rtree (3.45.0): + - sqlite3/common + - sqlite3_flutter_libs (0.0.1): + - FlutterMacOS + - sqlite3 (~> 3.45.0) + - sqlite3/fts5 + - sqlite3/perf-threadsafe + - sqlite3/rtree - url_launcher_macos (0.0.1): - FlutterMacOS - video_player_avfoundation (0.0.1): @@ -22,11 +40,17 @@ DEPENDENCIES: - flutter_zxing (from `Flutter/ephemeral/.symlinks/plugins/flutter_zxing/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - rive_common (from `Flutter/ephemeral/.symlinks/plugins/rive_common/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqlite3_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`) +SPEC REPOS: + trunk: + - sqlite3 + EXTERNAL SOURCES: file_selector_macos: :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos @@ -36,10 +60,14 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral package_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin rive_common: :path: Flutter/ephemeral/.symlinks/plugins/rive_common/macos shared_preferences_foundation: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin + sqlite3_flutter_libs: + :path: Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos video_player_avfoundation: @@ -50,11 +78,14 @@ SPEC CHECKSUMS: flutter_zxing: ea030278aa2a051cd81a5b0053be9d0569d11c9a FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 rive_common: 0f0aadf670f0c6a7872dfe3e6186f112a5319108 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + sqlite3: f307b6291c4db7b5086c38d6237446b98a738581 + sqlite3_flutter_libs: 6b9913d8fbb718e5ebf23658aa6934a0fb509c0f url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 - video_player_avfoundation: 8563f13d8fc8b2c29dc2d09e60b660e4e8128837 + video_player_avfoundation: e9e6f9cae7d7a6d9b43519b0aab382bca60fcfd1 PODFILE CHECKSUM: 0d3963a09fc94f580682bd88480486da345dc3f0 -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3