From db103a1015706cdfc15cff812c4280be11fee337 Mon Sep 17 00:00:00 2001 From: bossanyit Date: Mon, 12 Apr 2021 18:51:50 +0200 Subject: [PATCH] WT 1.1.11+4 bug fixes --- i18n/en.json | 2 ++ i18n/hu.json | 1 + ios/Runner.xcodeproj/project.pbxproj | 6 ++-- .../exercise_control_bloc.dart | 31 ++++++++++++++++--- lib/util/track.dart | 2 +- lib/view/customer_bodytype_animation.dart | 4 ++- lib/view/exercise_control_page.dart | 27 ++++++++++------ .../exercise_plan_custom_detail_add_page.dart | 4 ++- lib/view/test_set_execute.dart | 4 ++- lib/widgets/menu_search_bar.dart | 2 +- lib/widgets/number_picker.dart | 19 ++++++++++-- pubspec.yaml | 2 +- 12 files changed, 79 insertions(+), 25 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 1af39c4..974e65e 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -84,6 +84,8 @@ "Yes": "Yes", "No": "No", "with": "with", + "Please repeat as much times as you can! MAXIMIZE it!":"Please repeat as much times as you can! MAXIMIZE it!", + "Please take a relative bigger weight and repeat 12-20 times and do your best! MAXIMIZE it!":"Please take a relative bigger weight and repeat 12-20 times and do your best! MAXIMIZE it!", "Do you save this exercise with these parameters?":"Do you save this exercise with these parameters?", "Did you try the MAXIMUM what you can do? Are you sure we save the exercise with ONLY 12 repeats?":"Did you try the MAXIMUM what you can do? Are you sure we save the exercise with ONLY 12 repeats?", "The number of the exercise": "The number of the exercise", diff --git a/i18n/hu.json b/i18n/hu.json index 7e00b04..0c522e7 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -275,6 +275,7 @@ "select your places by tapping":"kattints az edzéshelyszínre", "Available Training Places":"Elérhető edzéshelyszínek", "Please take a relative bigger weight and repeat 12-20 times and do your best! MAXIMIZE it!":"Válassz egy relatív nagyobb súlyt, amivel 12-20 közötti ismétlésre vagy képes, és adj bele mindent! MAXOLD KI!", + "Please repeat as much times as you can! MAXIMIZE it!":"Hajtsd végre a gyakorlatot, amennyiszer csak tudod! Ne állj meg, ha fáradt vagy, MAXOLD ki!", "Please take a medium weight and repeat 20-30 times": "Válassz egy közepes súlyt, amivel maximum 20-30 közötti ismétlésre vagy képes", "Equipment Filter":"Eszköz szűrő", "Live-Server":"Live-Server", diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 26f1ac7..6327ab4 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -388,7 +388,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -531,7 +531,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -566,7 +566,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/bloc/exercise_control/exercise_control_bloc.dart b/lib/bloc/exercise_control/exercise_control_bloc.dart index 1daa9a6..44f176a 100644 --- a/lib/bloc/exercise_control/exercise_control_bloc.dart +++ b/lib/bloc/exercise_control/exercise_control_bloc.dart @@ -9,6 +9,14 @@ part 'exercise_control_event.dart'; part 'exercise_control_state.dart'; +enum ExerciseTypeLocal { oneRepMax, endurance } + +extension ExerciseTypeLocalExt on ExerciseTypeLocal { + String toStr() => this.toString().split(".").last; + bool equalsTo(ExerciseTypeLocal type) => this.toString() == type.toString(); + bool equalsStringTo(String type) => this.toStr() == type; +} + class ExerciseControlBloc extends Bloc { final TimerBloc timerBloc; final ExerciseRepository exerciseRepository; @@ -26,16 +34,25 @@ class ExerciseControlBloc extends Bloc 25) { + exerciseTypeLocal = ExerciseTypeLocal.endurance; + } oneRepUnitQuantity = exerciseRepository.exercise!.unitQuantity!; initialRM = this.calculate1RM(percent75: false); unitQuantity = this.calculate1RM(percent75: true).roundToDouble(); quantity = 12; + if (oneRepQuantity > 25) { + quantity = 35; + } origQuantity = quantity; exerciseRepository.setUnitQuantity(unitQuantity); @@ -47,11 +64,12 @@ class ExerciseControlBloc extends Bloc mapEventToState(ExerciseControlEvent event) async* { try { - if (event is ExerciseControlLoad) { + /* if (event is ExerciseControlLoad) { yield ExerciseControlLoading(); step = 1; yield ExerciseControlReady(); - } else if (event is ExerciseControlQuantityChange) { + } else */ + if (event is ExerciseControlQuantityChange) { //yield ExerciseControlLoading(); if (event.step == step) { exerciseRepository.setQuantity(event.quantity); @@ -60,7 +78,7 @@ class ExerciseControlBloc extends Bloc with Trans { TimerBloc timerBloc = BlocProvider.of(context); return BlocProvider( - create: (context) => ExerciseControlBloc(exerciseRepository: exerciseRepository, readonly: readonly, timerBloc: timerBloc) - ..add(ExerciseControlLoad()), + create: (context) => ExerciseControlBloc(exerciseRepository: exerciseRepository, readonly: readonly, timerBloc: timerBloc), + //..add(ExerciseControlLoad()), child: BlocConsumer(listener: (context, state) { if (state is ExerciseControlError) { ScaffoldMessenger.of(context).showSnackBar( @@ -260,6 +260,7 @@ class _ExerciseControlPage extends State with Trans { Widget numberPickForm(ExerciseControlBloc exerciseBloc, int step) { final String strTimes = step == 2 ? exerciseBloc.origQuantity.toStringAsFixed(0) : "max."; + //print("step $step, quantity ${exerciseBloc.origQuantity}"); String title = (step + 1).toString() + "/4 " + t("Control Exercise:"); LinkedHashMap args = LinkedHashMap(); @@ -301,8 +302,8 @@ class _ExerciseControlPage extends State with Trans { TextSpan(text: t("hu_with") + " "), TextSpan( text: strTimes + " ", - style: GoogleFonts.inter( - fontSize: 16, + style: GoogleFonts.archivoBlack( + fontSize: 20, fontWeight: FontWeight.bold, color: Colors.yellow[100], )), @@ -318,7 +319,7 @@ class _ExerciseControlPage extends State with Trans { NumberPickerWidget( minValue: 0, maxValue: 200, - initalValue: exerciseBloc.quantity.round(), + initalValue: exerciseBloc.origQuantity.round(), unit: t("reps"), color: Colors.yellow[50]!, onChange: (value) => {exerciseBloc.add(ExerciseControlQuantityChange(quantity: value.toDouble(), step: step))}), @@ -372,10 +373,9 @@ class UnitQuantityControl extends StatefulWidget { } class _UnitQuantityControlState extends State with Trans { - late double changedValue; + double? changedValue; @override Widget build(BuildContext context) { - changedValue = widget.exerciseBloc.unitQuantity; setContext(context); return Dialog( shape: RoundedRectangleBorder( @@ -431,12 +431,21 @@ class _UnitQuantityControlState extends State with Trans { initalValue: widget.exerciseBloc.unitQuantity.round(), unit: t("kg"), color: Colors.yellow[50]!, - onChange: (value) => {changedValue = value}), + onChange: (value) => { + setState(() { + changedValue = value; + }) + }), Align( alignment: Alignment.center, child: GestureDetector( onTap: () => { - widget.exerciseBloc.add(ExerciseControlUnitQuantityChange(quantity: changedValue.toDouble(), step: widget.step)), + if (changedValue == null) + { + changedValue = widget.exerciseBloc.unitQuantity, + }, + //print("Changed new value $changedValue"), + widget.exerciseBloc.add(ExerciseControlUnitQuantityChange(quantity: changedValue!.toDouble(), step: widget.step)), Navigator.of(context).pop(), }, child: Stack( diff --git a/lib/view/exercise_plan_custom_detail_add_page.dart b/lib/view/exercise_plan_custom_detail_add_page.dart index eae32a3..dda3e2f 100644 --- a/lib/view/exercise_plan_custom_detail_add_page.dart +++ b/lib/view/exercise_plan_custom_detail_add_page.dart @@ -240,7 +240,9 @@ class _ExercisePlanDetailAddPage extends State with T initialValue: bloc.quantityUnit.toStringAsFixed(0), keyboardType: TextInputType.numberWithOptions(decimal: true), style: GoogleFonts.archivoBlack(fontSize: 60, color: Colors.yellow[200]), - onChanged: (value) => {bloc.add(ExercisePlanCustomAddChangeQuantityUnit(quantity: double.parse(value)))}) + onChanged: (value) => { + if (value.isNotEmpty) {bloc.add(ExercisePlanCustomAddChangeQuantityUnit(quantity: double.parse(value)))} + }) : Offstage(), Divider(), diff --git a/lib/view/test_set_execute.dart b/lib/view/test_set_execute.dart index a137812..db38247 100644 --- a/lib/view/test_set_execute.dart +++ b/lib/view/test_set_execute.dart @@ -350,7 +350,9 @@ class _ExerciseTileState extends State with Trans { animation.start(); animation.addStatusListener((status) { if (status == AnimationStatus.completed) { - setState(() {}); + setState(() { + print("animation state completed"); + }); } }); diff --git a/lib/widgets/menu_search_bar.dart b/lib/widgets/menu_search_bar.dart index fe98635..cf70d49 100644 --- a/lib/widgets/menu_search_bar.dart +++ b/lib/widgets/menu_search_bar.dart @@ -151,7 +151,7 @@ class Search extends StatelessWidget with Trans { searchBoxDecoration: InputDecoration( contentPadding: EdgeInsets.only(left: 15, top: 5, bottom: 5), labelText: t("Search Exercises..."), - labelStyle: GoogleFonts.inter(fontSize: 14, color: Colors.grey[400]), + labelStyle: GoogleFonts.inter(fontSize: 12, color: Colors.grey[400]), fillColor: Colors.white24, filled: true, border: OutlineInputBorder( diff --git a/lib/widgets/number_picker.dart b/lib/widgets/number_picker.dart index 12e1840..ce0ec8a 100644 --- a/lib/widgets/number_picker.dart +++ b/lib/widgets/number_picker.dart @@ -30,6 +30,7 @@ class NumberPickerWidget extends StatefulWidget { class _NumberPickerWidgetState extends State with Trans { late FixedExtentScrollController _scrollController; + double value = 0; @override void initState() { @@ -38,13 +39,22 @@ class _NumberPickerWidgetState extends State with Trans { _scrollController.animateToItem(widget.initalValue, duration: Duration(milliseconds: 100), curve: Curves.easeIn); } + @override + void dispose() { + _scrollController.dispose(); + super.dispose(); + } + @override void didUpdateWidget(NumberPickerWidget oldWidget) { + //print("value $value initial ${widget.initalValue}"); + if (value == 0) { + _scrollController.animateToItem(widget.initalValue, duration: Duration(milliseconds: 100), curve: Curves.easeIn); + } super.didUpdateWidget(oldWidget); } Widget durationPicker({bool inSeconds = false, bool inHundredths = false}) { - double value = 0; return CupertinoPicker( scrollController: _scrollController, useMagnifier: true, @@ -54,9 +64,11 @@ class _NumberPickerWidgetState extends State with Trans { selectionOverlay: Container(), onSelectedItemChanged: (x) { currentData = x.toDouble(); - value = x.toDouble(); + //print("sec" + seconds.toStringAsFixed(2)); - setState(() {}); + setState(() { + value = x.toDouble(); + }); widget.onChange(value); }, children: List.generate( @@ -69,6 +81,7 @@ class _NumberPickerWidgetState extends State with Trans { @override Widget build(BuildContext context) { setContext(context); + value = 0; return Container( color: Colors.transparent, width: MediaQuery.of(context).size.width * .40, diff --git a/pubspec.yaml b/pubspec.yaml index c8f0a9b..1765574 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.1.10+62 +version: 1.1.10+63 environment: sdk: ">=2.12.0 <3.0.0"