WT 1.1.26+3 bloc migration

This commit is contained in:
Tibor Bossanyi (Freelancer)
2022-04-15 08:47:32 +02:00
parent 60df0bcf2d
commit 225172f950
47 changed files with 1527 additions and 1620 deletions
+1 -1
View File
@@ -191,7 +191,7 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, C
percent > 0.6 ? Icons.mood : Icons.mood_bad,
color: colorAnim.value,
),
linearStrokeCap: LinearStrokeCap.roundAll,
barRadius: Radius.circular(8),
backgroundColor: colorAnim.value,
progressColor: Color(0xff73e600),
animation: true,
+4 -41
View File
@@ -75,32 +75,6 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
if (Cache().userLoggedIn != null) {
await initDynamicLinks();
}
if (Cache().canTrial()) {
showDialog(
context: context,
builder: (BuildContext context) {
return DialogTrialWidget(
title: t("10 days Premium for free"),
description: t("Would you like to try all premium functions for 10 days, without any subscription or bank card data?"),
widget: Column(children: [
Text(
t("If you click to 'OK', all premium functions will be available right now."),
style: GoogleFonts.inter(color: Colors.white),
),
Divider(),
/* Text(
t("If you click to 'No', you can use all basic functions, and you will loose the oppurtunity to try the premium functions for free."),
style: GoogleFonts.inter(color: Colors.white),
), */
]),
onCancel: () => {
Navigator.of(context).pop(),
menuBloc.add(MenuStartTrial(start: DateTime.parse("1900-01-01 00:00:00"))),
},
onTap: () => {Navigator.of(context).pop(), menuBloc.add(MenuStartTrial(start: DateTime.now()))},
);
});
}
});
}
@@ -128,7 +102,6 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
@override
Widget build(BuildContext context) {
menuBloc = BlocProvider.of<MenuBloc>(context);
//tutorialBloc = BlocProvider.of<TutorialBloc>(context);
setContext(context);
double cWidth = MediaQuery.of(context).size.width;
double cHeight = MediaQuery.of(context).size.height;
@@ -139,9 +112,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
return Stack(children: [
CustomScrollView(
controller: scrollController,
scrollDirection: Axis.vertical,
slivers: buildMenuColumn(widget.parent!, context, menuBloc, cWidth, cHeight)),
controller: scrollController, scrollDirection: Axis.vertical, slivers: buildMenuColumn(widget.parent!, context, menuBloc, cWidth, cHeight)),
]);
}
@@ -163,15 +134,13 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
padding: EdgeInsets.only(top: 15.0),
child: Center(
child: Stack(alignment: Alignment.bottomLeft, children: [
Text(AppLocalizations.of(context)!.translate("All Exercises has been filtered out"),
style: GoogleFonts.inter(color: Colors.white)),
Text(AppLocalizations.of(context)!.translate("All Exercises has been filtered out"), style: GoogleFonts.inter(color: Colors.white)),
]))));
} else {
menuBloc.getFilteredBranch(menuBloc.parent).forEach((treeName, value) {
WorkoutMenuTree workoutTree = value;
_columnChildren.add(Container(
padding: EdgeInsets.only(top: 15.0, left: cWidth * 0.04, right: cWidth * 0.04),
//height: (cHeight / 3) - cWidth * 0.16,
child: Badge(
padding: EdgeInsets.all(8),
position: BadgePosition.bottomEnd(end: 0),
@@ -384,8 +353,6 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
Navigator.of(context).pushNamed("myTrainingPlanActivate", arguments: args);
menuBloc.add(MenuTreeDown(item: workoutTree, parent: workoutTree.id));
} else if (workoutTree.internalName == "training_execute") {
/* Cache().myTrainingPlan = null;
Cache().deleteMyTrainingPlan(); */
if (Cache().myTrainingPlan != null) {
final TrainingPlanBloc bloc = BlocProvider.of<TrainingPlanBloc>(context);
bloc.setMyPlan(Cache().myTrainingPlan);
@@ -417,8 +384,6 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
menuBloc.add(MenuTreeDown(item: workoutTree, parent: workoutTree.id));
}
} else {
menuBloc.add(MenuClickExercise(exerciseTypeId: workoutTree.id));
if (workoutTree.exerciseType!.name == "Custom" && Cache().userLoggedIn!.admin == 1) {
Navigator.of(context).pushNamed('exerciseCustomPage', arguments: workoutTree.exerciseType);
} else {
@@ -430,10 +395,8 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
dynamic getShape(WorkoutMenuTree workoutTree) {
bool base = workoutTree.base;
dynamic returnCode = (base == true)
? RoundedRectangleBorder(
side: BorderSide(width: 6, color: Colors.orangeAccent), borderRadius: BorderRadius.all(Radius.circular(24.0)))
: RoundedRectangleBorder(
side: BorderSide(width: 1, color: Colors.transparent), borderRadius: BorderRadius.all(Radius.circular(8.0)));
? RoundedRectangleBorder(side: BorderSide(width: 6, color: Colors.orangeAccent), borderRadius: BorderRadius.all(Radius.circular(24.0)))
: RoundedRectangleBorder(side: BorderSide(width: 1, color: Colors.transparent), borderRadius: BorderRadius.all(Radius.circular(8.0)));
return returnCode;
}