WT1.1.0+38 Design, time_picker
This commit is contained in:
parent
85ce68a9b8
commit
81f904af2c
Binary file not shown.
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.3 MiB |
@ -362,7 +362,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 36;
|
CURRENT_PROJECT_VERSION = 38;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -505,7 +505,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 36;
|
CURRENT_PROJECT_VERSION = 38;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -540,7 +540,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 36;
|
CURRENT_PROJECT_VERSION = 38;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
@ -51,6 +51,7 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
|||||||
exerciseRepository.setUnit(exerciseType.unit);
|
exerciseRepository.setUnit(exerciseType.unit);
|
||||||
exerciseRepository.setQuantity(quantity);
|
exerciseRepository.setQuantity(quantity);
|
||||||
exerciseRepository.setUnitQuantity(unitQuantity);
|
exerciseRepository.setUnitQuantity(unitQuantity);
|
||||||
|
exerciseRepository.exercise.exercisePlanDetailId = 0;
|
||||||
if (Cache().userLoggedIn != null) {
|
if (Cache().userLoggedIn != null) {
|
||||||
customerRepository.customer = Cache().userLoggedIn;
|
customerRepository.customer = Cache().userLoggedIn;
|
||||||
weight = customerRepository.customer.getProperty("Weight");
|
weight = customerRepository.customer.getProperty("Weight");
|
||||||
|
@ -93,9 +93,9 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> with Trans {
|
|||||||
//await menuTreeRepository.createTree();
|
//await menuTreeRepository.createTree();
|
||||||
setMenuInfo();
|
setMenuInfo();
|
||||||
exerciseDeviceRepository.setDevices(Cache().getDevices());
|
exerciseDeviceRepository.setDevices(Cache().getDevices());
|
||||||
exerciseDeviceRepository.getGymDevices().forEach((element) {
|
/* exerciseDeviceRepository.getGymDevices().forEach((element) {
|
||||||
listFilterDevice.add(element.exerciseDeviceId);
|
listFilterDevice.add(element.exerciseDeviceId);
|
||||||
});
|
}); */
|
||||||
yield MenuReady();
|
yield MenuReady();
|
||||||
} else if (event is MenuRecreateTree) {
|
} else if (event is MenuRecreateTree) {
|
||||||
// ie. at language changes
|
// ie. at language changes
|
||||||
@ -140,11 +140,10 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> with Trans {
|
|||||||
} else if (event is MenuFilterExerciseType) {
|
} else if (event is MenuFilterExerciseType) {
|
||||||
yield MenuLoading();
|
yield MenuLoading();
|
||||||
final int deviceId = event.deviceId;
|
final int deviceId = event.deviceId;
|
||||||
print("Defilter " + deviceId.toString());
|
|
||||||
if (selectedDevice(deviceId)) {
|
if (selectedDevice(deviceId)) {
|
||||||
listFilterDevice.remove(deviceId);
|
|
||||||
} else {
|
|
||||||
listFilterDevice.add(deviceId);
|
listFilterDevice.add(deviceId);
|
||||||
|
} else {
|
||||||
|
listFilterDevice.remove(deviceId);
|
||||||
}
|
}
|
||||||
yield MenuReady();
|
yield MenuReady();
|
||||||
}
|
}
|
||||||
@ -170,14 +169,14 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> with Trans {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool selectedDevice(int deviceId) {
|
bool selectedDevice(int deviceId) {
|
||||||
return listFilterDevice.contains(deviceId);
|
return !listFilterDevice.contains(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedHashMap<String, WorkoutMenuTree> getFilteredBranch(int parent) {
|
LinkedHashMap<String, WorkoutMenuTree> getFilteredBranch(int parent) {
|
||||||
if (parent == null) return LinkedHashMap();
|
if (parent == null) return LinkedHashMap();
|
||||||
|
|
||||||
LinkedHashMap<String, WorkoutMenuTree> branch = menuTreeRepository.getBranch(parent);
|
LinkedHashMap<String, WorkoutMenuTree> branch = menuTreeRepository.getBranch(parent);
|
||||||
if (!menuTreeRepository.isChild(parent) || ability.toString() == ExerciseAbility.none.toString()) {
|
if (!menuTreeRepository.isChild(parent) || ability.toString() == ExerciseAbility.none.toString() || listFilterDevice.isEmpty) {
|
||||||
return branch;
|
return branch;
|
||||||
}
|
}
|
||||||
LinkedHashMap<String, WorkoutMenuTree> filtered = LinkedHashMap();
|
LinkedHashMap<String, WorkoutMenuTree> filtered = LinkedHashMap();
|
||||||
|
@ -129,6 +129,7 @@ class Cache {
|
|||||||
|
|
||||||
void setServerAddress(SharedPreferences prefs) {
|
void setServerAddress(SharedPreferences prefs) {
|
||||||
if (this.testEnvironment == "1") {
|
if (this.testEnvironment == "1") {
|
||||||
|
baseUrl = 'http://aitrainer.app:8899/api/';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final bool live = prefs.getBool(Cache.serverKey);
|
final bool live = prefs.getBool(Cache.serverKey);
|
||||||
@ -138,6 +139,8 @@ class Cache {
|
|||||||
liveServer = live;
|
liveServer = live;
|
||||||
if (live) {
|
if (live) {
|
||||||
baseUrl = 'http://aitrainer.info:8888/api/';
|
baseUrl = 'http://aitrainer.info:8888/api/';
|
||||||
|
} else {
|
||||||
|
baseUrl = 'http://aitrainer.app:8899/api/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||||
import 'package:aitrainer_app/library/numberpicker.dart';
|
import 'package:aitrainer_app/library/numberpicker.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
class ExerciseControlPage extends StatefulWidget {
|
class ExerciseControlPage extends StatefulWidget {
|
||||||
_ExerciseControlPage createState() => _ExerciseControlPage();
|
_ExerciseControlPage createState() => _ExerciseControlPage();
|
||||||
@ -62,7 +63,7 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
|||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('asset/image/WT_light_background.png'),
|
image: AssetImage('asset/image/WT_black_background.png'),
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
),
|
),
|
||||||
@ -77,19 +78,25 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
exerciseName,
|
exerciseName,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.deepOrange),
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.orange),
|
||||||
overflow: TextOverflow.fade,
|
overflow: TextOverflow.fade,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
),
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
Icon(Icons.info),
|
Icon(
|
||||||
|
Icons.info,
|
||||||
|
color: Colors.yellow[300],
|
||||||
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(t("Why do you need Exercise Control?"),
|
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,
|
textColor: Colors.blueAccent,
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
@ -100,15 +107,16 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(t("Your 1RM:"),
|
||||||
t("Your 1RM:"),
|
style: GoogleFonts.inter(
|
||||||
),
|
color: Colors.yellow[300],
|
||||||
|
)),
|
||||||
Text(
|
Text(
|
||||||
" " +
|
" " +
|
||||||
exerciseBloc.initialRM.toStringAsFixed(0) +
|
exerciseBloc.initialRM.toStringAsFixed(0) +
|
||||||
" " +
|
" " +
|
||||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit,
|
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 +
|
strTimes +
|
||||||
" " +
|
" " +
|
||||||
t("times!");
|
t(
|
||||||
|
"times!",
|
||||||
|
);
|
||||||
|
|
||||||
String title = step.toString() + ". " + t("Control Exercise:");
|
String title = step.toString() + ". " + t("Control Exercise:");
|
||||||
|
|
||||||
List<Widget> listWidgets = [
|
List<Widget> listWidgets = [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: GoogleFonts.inter(color: Colors.yellow[300], fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
textInstruction,
|
textInstruction,
|
||||||
style: TextStyle(fontSize: 12),
|
style: GoogleFonts.inter(color: Colors.yellow[300], fontSize: 12),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@ -160,21 +170,30 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
|||||||
step: 1,
|
step: 1,
|
||||||
onChanged: (value) => {exerciseBloc.add(ExerciseControlQuantityChange(quantity: value.toDouble(), step: step))},
|
onChanged: (value) => {exerciseBloc.add(ExerciseControlQuantityChange(quantity: value.toDouble(), step: step))},
|
||||||
listViewHeight: 80,
|
listViewHeight: 80,
|
||||||
|
textStyleHighlighted: GoogleFonts.archivoBlack(color: Colors.orange[300], fontSize: 24),
|
||||||
//decoration: _decoration,
|
//decoration: _decoration,
|
||||||
),
|
),
|
||||||
RaisedButton(
|
FlatButton(
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
color: step == exerciseBloc.step ? Colors.blue : Colors.black26,
|
//color: step == exerciseBloc.step ? Colors.orange : Colors.black26,
|
||||||
focusColor: Colors.blueAccent,
|
focusColor: Colors.blueAccent,
|
||||||
onPressed: () => {
|
onPressed: () => {
|
||||||
exerciseBloc.add(ExerciseControlSubmit(step: step)),
|
exerciseBloc.add(ExerciseControlSubmit(step: step)),
|
||||||
if (step == 3) {confirmationDialog(exerciseBloc)}
|
if (step == 3) {confirmationDialog(exerciseBloc)}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: step == exerciseBloc.step
|
||||||
|
? Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset('asset/icon/gomb_orange_a.png', width: 140, height: 60),
|
||||||
|
Text(
|
||||||
t("Save"),
|
t("Save"),
|
||||||
style: TextStyle(fontSize: 12),
|
style: TextStyle(fontSize: 16, color: Colors.white),
|
||||||
)),
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -50,8 +50,8 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: customerId == Cache().userLoggedIn.customerId
|
image: customerId == Cache().userLoggedIn.customerId
|
||||||
? AssetImage('asset/image/WT_menu_dark.png')
|
? AssetImage('asset/image/WT_black_background.png')
|
||||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
: AssetImage('asset/image/WT_light_background.png'),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
alignment: Alignment.center,
|
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/bmi_widget.dart';
|
||||||
import 'package:aitrainer_app/widgets/bmr_widget.dart';
|
import 'package:aitrainer_app/widgets/bmr_widget.dart';
|
||||||
import 'package:aitrainer_app/widgets/size_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_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -158,7 +159,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
|||||||
child: KeyboardActions(
|
child: KeyboardActions(
|
||||||
config: _buildConfig(context),
|
config: _buildConfig(context),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.only(top: 5, left: 75, right: 75),
|
padding: const EdgeInsets.only(top: 5, left: 55, right: 55),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -229,7 +230,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
|||||||
),
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
onPressed: () => {
|
onPressed: () => {
|
||||||
confirmationDialog(exerciseBloc),
|
confirmationDialog(exerciseBloc, menuBloc),
|
||||||
},
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@ -277,6 +278,13 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column columnQuantity(ExerciseNewBloc bloc) {
|
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: [
|
Column row = Column(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||||
TextFormField(
|
TextFormField(
|
||||||
focusNode: _nodeText2,
|
focusNode: _nodeText2,
|
||||||
@ -303,7 +311,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
|||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
void confirmationDialog(ExerciseNewBloc bloc) {
|
void confirmationDialog(ExerciseNewBloc bloc, MenuBloc menuBloc) {
|
||||||
LinkedHashMap args = LinkedHashMap();
|
LinkedHashMap args = LinkedHashMap();
|
||||||
print("exercise validated " + bloc.exerciseRepository.exercise.quantity.toString());
|
print("exercise validated " + bloc.exerciseRepository.exercise.quantity.toString());
|
||||||
if (bloc.exerciseRepository.exercise.quantity == null) {
|
if (bloc.exerciseRepository.exercise.quantity == null) {
|
||||||
@ -324,7 +332,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
|||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
context: context,
|
context: context,
|
||||||
//barrierDismissible: false,
|
|
||||||
builder: (_) => CupertinoAlertDialog(
|
builder: (_) => CupertinoAlertDialog(
|
||||||
title: Text(t("Do you save this exercise with these parameters?")),
|
title: Text(t("Do you save this exercise with these parameters?")),
|
||||||
content: Column(children: [
|
content: Column(children: [
|
||||||
@ -356,14 +363,15 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
|||||||
bloc.exerciseRepository.addExercise(),
|
bloc.exerciseRepository.addExercise(),
|
||||||
Navigator.pop(context),
|
Navigator.pop(context),
|
||||||
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['exerciseRepository'] = bloc.exerciseRepository,
|
||||||
args['percent'] = 0.75,
|
args['percent'] = 0.75,
|
||||||
args['readonly'] = false,
|
args['readonly'] = false,
|
||||||
Navigator.of(context).pushNamed('exerciseControlPage', arguments: args)
|
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['exerciseRepository'] = bloc.exerciseRepository,
|
||||||
args['percent'] = 0.50,
|
args['percent'] = 0.50,
|
||||||
|
@ -52,8 +52,8 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: customerId == Cache().userLoggedIn.customerId
|
image: customerId == Cache().userLoggedIn.customerId
|
||||||
? AssetImage('asset/image/WT_menu_dark.png')
|
? AssetImage('asset/image/WT_black_background.png')
|
||||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
: AssetImage('asset/image/WT_light_background.png'),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
),
|
),
|
||||||
@ -151,7 +151,7 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
|||||||
icon: element.selected
|
icon: element.selected
|
||||||
? Icon(
|
? Icon(
|
||||||
Icons.check,
|
Icons.check,
|
||||||
color: Colors.green[600],
|
color: Colors.green[300],
|
||||||
)
|
)
|
||||||
: Icon(
|
: Icon(
|
||||||
Icons.add,
|
Icons.add,
|
||||||
@ -187,14 +187,14 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
|||||||
),
|
),
|
||||||
onTap: () => clickAddDetail(bloc, element),
|
onTap: () => clickAddDetail(bloc, element),
|
||||||
),
|
),
|
||||||
IconButton(
|
/* IconButton(
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.info,
|
Icons.info,
|
||||||
color: Colors.black12,
|
color: Colors.black12,
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
), */
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
children: []));
|
children: []));
|
||||||
|
@ -48,7 +48,7 @@ class MenuInfoWidget extends StatelessWidget with Common {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.black.withOpacity(0.5),
|
color: Colors.black.withOpacity(0.5),
|
||||||
border: Border.all(color: Colors.white60),
|
border: Border.all(color: Colors.white60),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
borderRadius: BorderRadius.all(Radius.circular(16.0)),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -45,7 +45,6 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<Widget> _columnChildren = List();
|
final List<Widget> _columnChildren = List();
|
||||||
final double distortionHeight = cHeight / baseHeight;
|
|
||||||
|
|
||||||
if (menuBloc.getFilteredBranch(menuBloc.parent).isEmpty) {
|
if (menuBloc.getFilteredBranch(menuBloc.parent).isEmpty) {
|
||||||
_columnChildren.add(Container(
|
_columnChildren.add(Container(
|
||||||
@ -57,21 +56,6 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
|||||||
} else {
|
} else {
|
||||||
menuBloc.getFilteredBranch(menuBloc.parent).forEach((treeName, value) {
|
menuBloc.getFilteredBranch(menuBloc.parent).forEach((treeName, value) {
|
||||||
WorkoutMenuTree workoutTree = value;
|
WorkoutMenuTree workoutTree = value;
|
||||||
/* double textLength = workoutTree.name.length * workoutTree.fontSize;
|
|
||||||
double top = textLength < cWidth - 30
|
|
||||||
? (cHeight / 3 - 2.5 * workoutTree.fontSize) / distortionHeight
|
|
||||||
: (cHeight / 3 - 3.6 * workoutTree.fontSize) / distortionHeight;
|
|
||||||
|
|
||||||
print(" dH: " +
|
|
||||||
distortionHeight.toStringAsFixed(1) +
|
|
||||||
" W: " +
|
|
||||||
cWidth.toStringAsFixed(0) +
|
|
||||||
" H: " +
|
|
||||||
cHeight.toStringAsFixed(0) +
|
|
||||||
" TOP: " +
|
|
||||||
top.toStringAsFixed(0) +
|
|
||||||
" tL: " +
|
|
||||||
textLength.toStringAsFixed(0)); */
|
|
||||||
_columnChildren.add(Container(
|
_columnChildren.add(Container(
|
||||||
padding: EdgeInsets.only(top: 15.0, left: 15, right: 15),
|
padding: EdgeInsets.only(top: 15.0, left: 15, right: 15),
|
||||||
height: 225, //cHeight / 3 * distortionHeight,
|
height: 225, //cHeight / 3 * distortionHeight,
|
||||||
@ -94,15 +78,14 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
|||||||
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(left: 15, bottom: 10),
|
padding: EdgeInsets.only(left: 15, bottom: 15, right: 15),
|
||||||
child: InkWell(
|
child: GestureDetector(
|
||||||
onTap: () => menuClick(workoutTree, menuBloc, context),
|
onTap: () => menuClick(workoutTree, menuBloc, context),
|
||||||
child: Text(
|
child: Text(
|
||||||
workoutTree.name,
|
workoutTree.name,
|
||||||
maxLines: 3,
|
maxLines: 4,
|
||||||
style: GoogleFonts.archivoBlack(color: workoutTree.color, fontSize: workoutTree.fontSize, height: 1.1),
|
style: GoogleFonts.archivoBlack(color: workoutTree.color, fontSize: workoutTree.fontSize, height: 1.1),
|
||||||
),
|
),
|
||||||
highlightColor: workoutTree.color,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]))));
|
]))));
|
||||||
@ -111,12 +94,6 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
|||||||
|
|
||||||
SliverList sliverList = SliverList(
|
SliverList sliverList = SliverList(
|
||||||
delegate: SliverChildListDelegate(_columnChildren),
|
delegate: SliverChildListDelegate(_columnChildren),
|
||||||
/* gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 1,
|
|
||||||
mainAxisSpacing: 6.0,
|
|
||||||
crossAxisSpacing: 10.0,
|
|
||||||
childAspectRatio: cWidth > 375 ? 1.8 : 1.8,
|
|
||||||
) */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
slivers.add(sliverList);
|
slivers.add(sliverList);
|
||||||
@ -165,7 +142,6 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
|||||||
menuBloc.exerciseDeviceRepository.getGymDevices().forEach((element) {
|
menuBloc.exerciseDeviceRepository.getGymDevices().forEach((element) {
|
||||||
String deviceName = AppLanguage().appLocal == Locale('en') ? element.name : element.nameTranslation;
|
String deviceName = AppLanguage().appLocal == Locale('en') ? element.name : element.nameTranslation;
|
||||||
ChoiceChip chip = ChoiceChip(
|
ChoiceChip chip = ChoiceChip(
|
||||||
//padding: EdgeInsets.zero,
|
|
||||||
labelPadding: EdgeInsets.only(right: 5),
|
labelPadding: EdgeInsets.only(right: 5),
|
||||||
avatar: Icon(
|
avatar: Icon(
|
||||||
Icons.remove_circle_outline,
|
Icons.remove_circle_outline,
|
||||||
|
85
lib/widgets/time_picker.dart
Normal file
85
lib/widgets/time_picker.dart
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import 'package:aitrainer_app/util/trans.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class TimePickerWidget extends StatefulWidget {
|
||||||
|
final Function(double) onChange;
|
||||||
|
|
||||||
|
const TimePickerWidget({Key key, this.onChange}) : super(key: key);
|
||||||
|
@override
|
||||||
|
_TimePickerWidgetState createState() => _TimePickerWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TimePickerWidgetState extends State<TimePickerWidget> with Trans {
|
||||||
|
Widget durationPicker({bool inSeconds = false, bool inHundredths = false}) {
|
||||||
|
double seconds = 0;
|
||||||
|
return CupertinoPicker(
|
||||||
|
scrollController: FixedExtentScrollController(initialItem: 0),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
onSelectedItemChanged: (x) {
|
||||||
|
if (inSeconds) {
|
||||||
|
currentTimeInSec = x.toDouble();
|
||||||
|
} else if (inHundredths) {
|
||||||
|
currentTimeInDec = x.toDouble();
|
||||||
|
} else {
|
||||||
|
currentTimeInMin = x.toDouble();
|
||||||
|
}
|
||||||
|
seconds = currentTimeInMin * 60 + currentTimeInSec + currentTimeInDec / 100;
|
||||||
|
//print("sec" + seconds.toStringAsFixed(2));
|
||||||
|
setState(() {});
|
||||||
|
widget.onChange(seconds);
|
||||||
|
},
|
||||||
|
children: List.generate(
|
||||||
|
inSeconds
|
||||||
|
? 60
|
||||||
|
: inHundredths
|
||||||
|
? 100
|
||||||
|
: 60,
|
||||||
|
(index) => Text(
|
||||||
|
inSeconds
|
||||||
|
? '$index sec'
|
||||||
|
: inHundredths
|
||||||
|
? index.toString() + ' "'
|
||||||
|
: '$index min',
|
||||||
|
style: TextStyle(color: Colors.yellow[200]))),
|
||||||
|
itemExtent: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
double currentTimeInSec = 0;
|
||||||
|
double currentTimeInMin = 0;
|
||||||
|
double currentTimeInDec = 0;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
setContext(context);
|
||||||
|
return Container(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.95,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.25,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(child: durationPicker()),
|
||||||
|
Expanded(child: durationPicker(inSeconds: true)),
|
||||||
|
Expanded(child: durationPicker(inHundredths: true)),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -42,6 +42,8 @@ dependencies:
|
|||||||
keyboard_actions: ^3.3.1+1
|
keyboard_actions: ^3.3.1+1
|
||||||
dropdown_search: ^0.4.8
|
dropdown_search: ^0.4.8
|
||||||
badges: ^1.1.4
|
badges: ^1.1.4
|
||||||
|
#health: ^2.0.9
|
||||||
|
|
||||||
|
|
||||||
firebase_core: ^0.5.2
|
firebase_core: ^0.5.2
|
||||||
#firebase_analytics: ^6.2.0
|
#firebase_analytics: ^6.2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user