WT1.1.0+38 Design, time_picker
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:aitrainer_app/library/numberpicker.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class ExerciseControlPage extends StatefulWidget {
|
||||
_ExerciseControlPage createState() => _ExerciseControlPage();
|
||||
@@ -62,7 +63,7 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_light_background.png'),
|
||||
image: AssetImage('asset/image/WT_black_background.png'),
|
||||
fit: BoxFit.fill,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
@@ -77,19 +78,25 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
children: <Widget>[
|
||||
Text(
|
||||
exerciseName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.deepOrange),
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.orange),
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 1,
|
||||
softWrap: true,
|
||||
),
|
||||
FlatButton(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Icon(Icons.info),
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.yellow[300],
|
||||
),
|
||||
Flexible(
|
||||
child: Text(t("Why do you need Exercise Control?"),
|
||||
style: TextStyle(color: Colors.blueAccent, fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
style: TextStyle(color: Colors.yellow[300], fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.yellow[300],
|
||||
),
|
||||
Icon(Icons.arrow_forward_ios),
|
||||
]),
|
||||
textColor: Colors.blueAccent,
|
||||
color: Colors.transparent,
|
||||
@@ -100,15 +107,16 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
t("Your 1RM:"),
|
||||
),
|
||||
Text(t("Your 1RM:"),
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.yellow[300],
|
||||
)),
|
||||
Text(
|
||||
" " +
|
||||
exerciseBloc.initialRM.toStringAsFixed(0) +
|
||||
" " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -136,18 +144,20 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
" " +
|
||||
strTimes +
|
||||
" " +
|
||||
t("times!");
|
||||
t(
|
||||
"times!",
|
||||
);
|
||||
|
||||
String title = step.toString() + ". " + t("Control Exercise:");
|
||||
|
||||
List<Widget> listWidgets = [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
textInstruction,
|
||||
style: TextStyle(fontSize: 12),
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontSize: 12),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -160,21 +170,30 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
step: 1,
|
||||
onChanged: (value) => {exerciseBloc.add(ExerciseControlQuantityChange(quantity: value.toDouble(), step: step))},
|
||||
listViewHeight: 80,
|
||||
textStyleHighlighted: GoogleFonts.archivoBlack(color: Colors.orange[300], fontSize: 24),
|
||||
//decoration: _decoration,
|
||||
),
|
||||
RaisedButton(
|
||||
FlatButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: step == exerciseBloc.step ? Colors.blue : Colors.black26,
|
||||
//color: step == exerciseBloc.step ? Colors.orange : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {
|
||||
exerciseBloc.add(ExerciseControlSubmit(step: step)),
|
||||
if (step == 3) {confirmationDialog(exerciseBloc)}
|
||||
},
|
||||
child: Text(
|
||||
t("Save"),
|
||||
style: TextStyle(fontSize: 12),
|
||||
)),
|
||||
child: step == exerciseBloc.step
|
||||
? Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Image.asset('asset/icon/gomb_orange_a.png', width: 140, height: 60),
|
||||
Text(
|
||||
t("Save"),
|
||||
style: TextStyle(fontSize: 16, color: Colors.white),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container()),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
@@ -50,8 +50,8 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: customerId == Cache().userLoggedIn.customerId
|
||||
? AssetImage('asset/image/WT_menu_dark.png')
|
||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
? AssetImage('asset/image/WT_black_background.png')
|
||||
: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bmi_widget.dart';
|
||||
import 'package:aitrainer_app/widgets/bmr_widget.dart';
|
||||
import 'package:aitrainer_app/widgets/size_widget.dart';
|
||||
import 'package:aitrainer_app/widgets/time_picker.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -158,7 +159,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
child: KeyboardActions(
|
||||
config: _buildConfig(context),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 5, left: 75, right: 75),
|
||||
padding: const EdgeInsets.only(top: 5, left: 55, right: 55),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
@@ -229,7 +230,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
),
|
||||
FlatButton(
|
||||
onPressed: () => {
|
||||
confirmationDialog(exerciseBloc),
|
||||
confirmationDialog(exerciseBloc, menuBloc),
|
||||
},
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
@@ -277,6 +278,13 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
}
|
||||
|
||||
Column columnQuantity(ExerciseNewBloc bloc) {
|
||||
if (bloc.exerciseRepository.exerciseType.unit == "second") {
|
||||
return Column(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||
TimePickerWidget(
|
||||
onChange: (value) => {bloc.add(ExerciseNewQuantityChange(quantity: value))},
|
||||
)
|
||||
]);
|
||||
}
|
||||
Column row = Column(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||
TextFormField(
|
||||
focusNode: _nodeText2,
|
||||
@@ -303,7 +311,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
return row;
|
||||
}
|
||||
|
||||
void confirmationDialog(ExerciseNewBloc bloc) {
|
||||
void confirmationDialog(ExerciseNewBloc bloc, MenuBloc menuBloc) {
|
||||
LinkedHashMap args = LinkedHashMap();
|
||||
print("exercise validated " + bloc.exerciseRepository.exercise.quantity.toString());
|
||||
if (bloc.exerciseRepository.exercise.quantity == null) {
|
||||
@@ -324,7 +332,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
//barrierDismissible: false,
|
||||
builder: (_) => CupertinoAlertDialog(
|
||||
title: Text(t("Do you save this exercise with these parameters?")),
|
||||
content: Column(children: [
|
||||
@@ -356,14 +363,15 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
bloc.exerciseRepository.addExercise(),
|
||||
Navigator.pop(context),
|
||||
Navigator.pop(context),
|
||||
if (bloc.exerciseRepository.exerciseType.is1RM)
|
||||
if (bloc.exerciseRepository.exerciseType.is1RM && menuBloc.ability.toString() == ExerciseAbility.oneRepMax.toString())
|
||||
{
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.75,
|
||||
args['readonly'] = false,
|
||||
Navigator.of(context).pushNamed('exerciseControlPage', arguments: args)
|
||||
}
|
||||
else if (bloc.exerciseRepository.exerciseType.isEndurance)
|
||||
else if (bloc.exerciseRepository.exerciseType.isEndurance &&
|
||||
menuBloc.ability.toString() == ExerciseAbility.endurance.toString())
|
||||
{
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.50,
|
||||
|
||||
@@ -52,8 +52,8 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: customerId == Cache().userLoggedIn.customerId
|
||||
? AssetImage('asset/image/WT_menu_dark.png')
|
||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
? AssetImage('asset/image/WT_black_background.png')
|
||||
: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
@@ -151,7 +151,7 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
||||
icon: element.selected
|
||||
? Icon(
|
||||
Icons.check,
|
||||
color: Colors.green[600],
|
||||
color: Colors.green[300],
|
||||
)
|
||||
: Icon(
|
||||
Icons.add,
|
||||
@@ -187,14 +187,14 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
||||
),
|
||||
onTap: () => clickAddDetail(bloc, element),
|
||||
),
|
||||
IconButton(
|
||||
/* IconButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
icon: Icon(
|
||||
Icons.info,
|
||||
color: Colors.black12,
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
), */
|
||||
]),
|
||||
)),
|
||||
children: []));
|
||||
|
||||
Reference in New Issue
Block a user