WT1.1.10+1 Compact Test Edit
This commit is contained in:
@@ -14,6 +14,7 @@ import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_common.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:ezanimation/ezanimation.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
@@ -24,7 +25,6 @@ import 'package:transparent_image/transparent_image.dart';
|
||||
import 'package:aitrainer_app/library/image_cache.dart' as wt;
|
||||
|
||||
import 'dialog_html.dart';
|
||||
import 'menu_info_widget.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MenuPageWidget extends StatefulWidget {
|
||||
@@ -39,14 +39,24 @@ class MenuPageWidget extends StatefulWidget {
|
||||
class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
final double baseWidth = 312;
|
||||
final double baseHeight = 675.2;
|
||||
bool isFirst = true;
|
||||
bool wait = false;
|
||||
MenuBloc menuBloc;
|
||||
final scrollController = ScrollController();
|
||||
final bool activeExercisePlan = Cache().activeExercisePlan != null;
|
||||
final EzAnimation animation = EzAnimation(35.0, 10.0, Duration(seconds: 2), reverseCurve: Curves.linear);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
isFirst = true;
|
||||
if (activeExercisePlan) {
|
||||
animation.start();
|
||||
animation.addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) {
|
||||
animation.reverse();
|
||||
}
|
||||
});
|
||||
animation.addListener(() {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
/// We require the initializers to run after the loading screen is rendered
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -88,7 +98,8 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
padding: EdgeInsets.only(top: 15.0),
|
||||
child: Center(
|
||||
child: Stack(alignment: Alignment.bottomLeft, children: [
|
||||
Text(t("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) {
|
||||
@@ -103,7 +114,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
animationType: BadgeAnimationType.slide,
|
||||
badgeColor: Colors.orange[800],
|
||||
showBadge: workoutTree.base,
|
||||
badgeContent: Text(t("base"),
|
||||
badgeContent: Text(AppLocalizations.of(context).translate("base"),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
@@ -120,7 +131,9 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
builder: (BuildContext context) {
|
||||
return DialogHTML(
|
||||
title: workoutTree.name,
|
||||
htmlData: workoutTree.nameEnglish == "Endurance" ? t("Endurance_desc") : t("OneRepMax_desc"),
|
||||
htmlData: workoutTree.nameEnglish == "Endurance"
|
||||
? AppLocalizations.of(context).translate("Endurance_desc")
|
||||
: AppLocalizations.of(context).translate("OneRepMax_desc"),
|
||||
);
|
||||
})
|
||||
},
|
||||
@@ -171,7 +184,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
delegate: SliverChildListDelegate([
|
||||
Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Text(
|
||||
t("Equipment Filter"),
|
||||
AppLocalizations.of(context).translate("Equipment Filter"),
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 24,
|
||||
@@ -241,6 +254,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
menuBloc.setMenuInfo();
|
||||
|
||||
SliverAppBar sliverAppBar = SliverAppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||
SizedBox(
|
||||
@@ -283,6 +297,35 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
}
|
||||
},
|
||||
),
|
||||
activeExercisePlan
|
||||
? GestureDetector(
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogCommon(
|
||||
title: t("You have an acive Compact Test"),
|
||||
descriptions: t("Press OK to continue!"),
|
||||
text: "OK",
|
||||
onTap: () => {
|
||||
Navigator.of(context).pop(),
|
||||
},
|
||||
onCancel: () => {
|
||||
Navigator.of(context).pop(),
|
||||
},
|
||||
);
|
||||
}),
|
||||
child: AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: (context, snapshot) {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: animation.value,
|
||||
height: animation.value,
|
||||
child: Image.asset("asset/image/pict_reps_volumen_db.png"),
|
||||
),
|
||||
);
|
||||
}))
|
||||
: Offstage(),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
@@ -292,6 +335,9 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
|
||||
void menuClick(WorkoutMenuTree workoutTree, MenuBloc menuBloc, BuildContext context) {
|
||||
if (workoutTree.child == false) {
|
||||
if (ExerciseAbility.mini_test.equalsTo(menuBloc.ability) && workoutTree.parent != 0) {
|
||||
Navigator.of(context).pushNamed('testSetEdit', arguments: workoutTree.nameEnglish);
|
||||
}
|
||||
menuBloc.add(MenuTreeDown(item: workoutTree, parent: workoutTree.id));
|
||||
} else {
|
||||
menuBloc.add(MenuClickExercise(exerciseTypeId: workoutTree.id));
|
||||
|
||||
Reference in New Issue
Block a user