WT 1.1.18+8 skip exercise inside

This commit is contained in:
bossanyit
2021-06-08 15:57:27 +02:00
parent a8728edae2
commit e38a26dbc9
5 changed files with 60 additions and 43 deletions
+54 -38
View File
@@ -23,46 +23,62 @@ class TrainingPlanExercise extends StatelessWidget with Trans {
setContext(context);
return Scaffold(
appBar: AppBarNav(depth: 1),
body: Container(
height: double.infinity,
width: double.infinity,
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("asset/image/WT_black_background.jpg"),
fit: BoxFit.cover,
alignment: Alignment.center,
appBar: AppBarNav(depth: 1),
body: Container(
height: double.infinity,
width: double.infinity,
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("asset/image/WT_black_background.jpg"),
fit: BoxFit.cover,
alignment: Alignment.center,
),
),
child: BlocConsumer<TrainingPlanBloc, TrainingPlanState>(listener: (context, state) {
if (state is TrainingPlanError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
}
}, builder: (context, state) {
return ModalProgressHUD(
child: getExercises(bloc, detail),
inAsyncCall: state is TrainingPlanLoading,
opacity: 0.5,
color: Colors.black54,
progressIndicator: CircularProgressIndicator(),
);
}),
),
child: BlocConsumer<TrainingPlanBloc, TrainingPlanState>(listener: (context, state) {
if (state is TrainingPlanError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
}
}, builder: (context, state) {
return ModalProgressHUD(
child: getExercises(bloc, detail),
inAsyncCall: state is TrainingPlanLoading,
opacity: 0.5,
color: Colors.black54,
progressIndicator: CircularProgressIndicator(),
);
}),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () => {
Navigator.of(context).pop(),
bloc.add(TrainingPlanSaveExercise(detail: detail)),
},
backgroundColor: Colors.orange[800],
icon: Icon(CustomIcon.save),
label: Text(
t("Save"),
style: GoogleFonts.inter(fontWeight: FontWeight.bold, fontSize: 16),
),
),
);
floatingActionButton: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
FloatingActionButton.extended(
onPressed: () => {
Navigator.of(context).pop(),
bloc.add(TrainingPlanSkipExercise(detail: detail)),
},
backgroundColor: Colors.grey[700],
icon: Icon(Icons.skip_next),
label: Text(
t("Skip"),
style: GoogleFonts.inter(fontWeight: FontWeight.normal, fontSize: 14),
),
),
SizedBox(
width: 20,
),
FloatingActionButton.extended(
onPressed: () => {
Navigator.of(context).pop(),
bloc.add(TrainingPlanSaveExercise(detail: detail)),
},
backgroundColor: Colors.orange[800],
icon: Icon(CustomIcon.save),
label: Text(
t("Save"),
style: GoogleFonts.inter(fontWeight: FontWeight.bold, fontSize: 16),
),
),
]));
}
Widget getExercises(TrainingPlanBloc bloc, CustomerTrainingPlanDetails detail) {