WT1.1.2f Purchase, Product, Property, BMR, BMI, Sizes

This commit is contained in:
bossanyit
2020-11-16 15:42:40 +01:00
parent 5fa5382e3f
commit e28f1edf50
48 changed files with 2631 additions and 1441 deletions
+7 -3
View File
@@ -12,8 +12,10 @@ import 'package:percent_indicator/linear_percent_indicator.dart';
import 'package:rainbow_color/rainbow_color.dart';
// ignore: must_be_immutable
class AppBarMin extends StatefulWidget implements PreferredSizeWidget {
const AppBarMin();
bool back = false;
AppBarMin({this.back = false });
@override
_AppBarNav createState() => _AppBarNav();
@@ -44,10 +46,12 @@ class _AppBarNav extends State<AppBarMin> with Common {
],
),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black),
icon: Icon(Icons.arrow_back, color: widget.back ? Colors.white : Colors.black),
onPressed: () =>
{
if ( widget.back ) {
Navigator.of(context).pop()
}
},
)
);
+246
View File
@@ -0,0 +1,246 @@
import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:animated_widgets/widgets/rotation_animated.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:google_fonts/google_fonts.dart';
import 'app_bar.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
// ignore: must_be_immutable
class BMI extends StatefulWidget {
final ExerciseNewBloc exerciseBloc;
BMI({this.exerciseBloc});
@override
_BMIState createState() => _BMIState();
}
class _BMIState extends State<BMI> with Trans {
final FocusNode _nodeText1 = FocusNode();
final FocusNode _nodeText2 = FocusNode();
KeyboardActionsConfig _buildConfig(BuildContext context) {
return KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.ALL,
keyboardBarColor: Colors.grey[200],
keyboardSeparatorColor: Colors.black26,
nextFocus: true,
actions: [
KeyboardActionsItem(focusNode: _nodeText2, toolbarButtons: [
(node) {
return GestureDetector(
onTap: () => node.unfocus(),
child: Container(
padding: EdgeInsets.all(8.0),
color: Colors.orange[500],
child: Text(
AppLocalizations.of(context).translate("Done"),
style: TextStyle(color: Colors.white),
),
),
);
}
]),
KeyboardActionsItem(
focusNode: _nodeText1,
toolbarButtons: [
//button 2
(node) {
return GestureDetector(
onTap: () => node.unfocus(),
child: Container(
color: Colors.orange,
padding: EdgeInsets.all(8.0),
child: Text(
AppLocalizations.of(context).translate("Done"),
style: TextStyle(color: Colors.white),
),
),
);
}
],
),
],
);
}
@override
Widget build(BuildContext context) {
setContext(context);
widget.exerciseBloc.getBMI();
return Form(
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBarNav(depth: 1),
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_black_background.png'),
fit: BoxFit.fill,
alignment: Alignment.center,
),
),
child: KeyboardActions(
config: _buildConfig(context),
child: SingleChildScrollView(
child:
Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [
getWeightInput(),
Text(AppLocalizations.of(context).translate("Body Mass Index"),
style: GoogleFonts.archivoBlack(
shadows: <Shadow>[
Shadow(
offset: Offset(5.0, 5.0),
blurRadius: 3.0,
color: Colors.black54,
),
],
fontSize: 30,
color: Colors.orange[500],
)),
Text(widget.exerciseBloc.bmi.toStringAsFixed(1) + "%",
style: GoogleFonts.archivoBlack(
shadows: <Shadow>[
Shadow(
offset: Offset(5.0, 5.0),
blurRadius: 3.0,
color: Colors.black54,
),
],
fontSize: 60,
color: Colors.orange[500],
)),
Divider(color: Colors.transparent),
Stack(alignment: Alignment.center, children: [
Container(
padding: EdgeInsets.only(left: 30, right: 30),
child: Image.asset(
"asset/image/BMI_graph_c.png",
),
),
Positioned(
top: widget.exerciseBloc.bmiTop,
left: widget.exerciseBloc.bmiLeft,
child: RotationAnimatedWidget.tween(
enabled: true,
duration: const Duration(milliseconds: 1000),
rotationDisabled: Rotation.deg(),
rotationEnabled: Rotation.deg(z: widget.exerciseBloc.bmiAngle),
child: Image.asset(
"asset/image/BMI_mutato.png",
width: 65,
)))
]),
Divider(color: Colors.transparent),
Container(
padding: EdgeInsets.only(left: 65, right: 65),
alignment: Alignment.center,
child: Text(t("Based on your weight and height your goal for BMI and weight:"),
textAlign: TextAlign.center,
style: GoogleFonts.inter(
fontSize: 16,
color: Colors.yellow[200],
)),
),
Text("BMI" + ": " + widget.exerciseBloc.goalBMI.toStringAsFixed(0),
style: GoogleFonts.archivoBlack(
fontSize: 40,
color: Colors.orange[500],
)),
Text(t("Weight") + ": " + widget.exerciseBloc.goalWeight.toStringAsFixed(0) + " kg",
style: GoogleFonts.archivoBlack(
fontSize: 30,
color: Colors.orange[200],
)),
]))))));
}
Widget buildAnimatedPointer() {
return TweenAnimationBuilder(
tween: IntTween(begin: 0, end: 30),
duration: Duration(milliseconds: 2000),
curve: Curves.linear,
builder: (context, val, child) {
return Image.asset(
"asset/image/BMI_mutato.png",
width: 65,
);
},
);
}
Widget getHeightInput() {
if (widget.exerciseBloc.customerRepository.customer.birthYear < 2003) {
return Flexible(
child: TextFormField(
focusNode: _nodeText2,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 5, bottom: 5),
labelText: AppLocalizations.of(context).translate("Actual Height"),
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
fillColor: Colors.black38,
filled: true,
border: OutlineInputBorder(
gapPadding: 4.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.white12, width: 0.4),
),
),
initialValue: widget.exerciseBloc.height.toStringAsFixed(0),
keyboardType: TextInputType.numberWithOptions(decimal: true),
textInputAction: TextInputAction.done,
style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.yellow[300]),
onChanged: (value) => {widget.exerciseBloc.add(ExerciseNewHeightChange(value: double.parse(value)))}),
);
} else {
return Container();
}
}
Widget getWeightInput() {
return Container(
padding: EdgeInsets.only(top: 15, left: 65, right: 65, bottom: 10),
alignment: Alignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
getHeightInput(),
SizedBox(
width: 10,
),
Flexible(
child: TextFormField(
focusNode: _nodeText1,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 5, bottom: 5),
labelText: AppLocalizations.of(context).translate("Actual Weight"),
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
fillColor: Colors.black38,
filled: true,
border: OutlineInputBorder(
gapPadding: 2.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.white12, width: 0.4),
),
),
initialValue: widget.exerciseBloc.weight.toStringAsFixed(0),
keyboardType: TextInputType.numberWithOptions(decimal: true),
textInputAction: TextInputAction.done,
style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.yellow[300]),
onChanged: (value) => {widget.exerciseBloc.add(ExerciseNewWeightChange(value: double.parse(value)))},
),
),
IconButton(
icon: Icon(Icons.save),
hoverColor: Colors.blueAccent,
color: widget.exerciseBloc.changedWeight ? Colors.blue[200] : Colors.black54,
onPressed: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())})
],
));
}
}
+68 -55
View File
@@ -14,8 +14,6 @@ class BottomNavigator extends StatefulWidget {
}
class _NawDrawerWidget extends State<BottomNavigator> {
@override
void initState() {
super.initState();
@@ -34,7 +32,8 @@ class _NawDrawerWidget extends State<BottomNavigator> {
//
return GradientBottomNavigationBar(
currentIndex: widget.bottomNavIndex, // this will be set when a new tab is tapped
currentIndex:
widget.bottomNavIndex, // this will be set when a new tab is tapped
backgroundColorStart: bgrColorEnd,
backgroundColorEnd: bgrColor,
fixedColor: active,
@@ -46,77 +45,91 @@ class _NawDrawerWidget extends State<BottomNavigator> {
BottomNavigationBarItem(
backgroundColor: bgrColor,
icon: new Icon(Icons.home, color: inactive),
activeIcon: new Icon(Icons.home, color: active,),
activeIcon: new Icon(
Icons.home,
color: active,
),
title: new Text(AppLocalizations.of(context).translate("Home"),
style: TextStyle(fontSize: 9)),
style: TextStyle(fontSize: 9)),
),
BottomNavigationBarItem(
backgroundColor: bgrColor,
icon: new Icon(Icons.trending_up, color: inactive),
activeIcon: new Icon(Icons.trending_up, color: active,),
title: new Text(AppLocalizations.of(context).translate("My Development"),
style: TextStyle(fontSize: 9),),
activeIcon: new Icon(
Icons.trending_up,
color: active,
),
title: new Text(
AppLocalizations.of(context).translate("My Development"),
style: TextStyle(fontSize: 9),
),
),
BottomNavigationBarItem(
backgroundColor: bgrColor,
icon: new Icon(Icons.featured_play_list, color: inactive),
activeIcon: new Icon(Icons.featured_play_list, color: active,),
title: new Text(AppLocalizations.of(context).translate("My Training Plan"),
style: TextStyle(fontSize: 9),),
activeIcon: new Icon(
Icons.featured_play_list,
color: active,
),
title: new Text(
AppLocalizations.of(context).translate("My Training Plan"),
style: TextStyle(fontSize: 9),
),
),
BottomNavigationBarItem(
backgroundColor: bgrColor,
icon: Icon(Icons.person, color: inactive,),
activeIcon: new Icon(Icons.person, color: active,),
title: Text(AppLocalizations.of(context).translate("Account"),
style: TextStyle(fontSize: 9),)
),
icon: Icon(
Icons.person,
color: inactive,
),
activeIcon: new Icon(
Icons.person,
color: active,
),
title: Text(
AppLocalizations.of(context).translate("Account"),
style: TextStyle(fontSize: 9),
)),
BottomNavigationBarItem(
backgroundColor: bgrColor,
icon: Icon(Icons.settings, color: inactive),
activeIcon: new Icon(Icons.settings, color: active,),
activeIcon: new Icon(
Icons.settings,
color: active,
),
title: Text(AppLocalizations.of(context).translate("Settings"),
style: TextStyle(fontSize: 9))
)
style: TextStyle(fontSize: 9)))
],
onTap:(index) {
setState(() {
widget.bottomNavIndex = index;
switch (index) {
case 0:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('home');
onTap: (index) {
setState(() {
widget.bottomNavIndex = index;
switch (index) {
case 0:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('home');
break;
case 1:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('myDevelopment');
break;
case 2:
break;
case 1:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('myDevelopment');
break;
case 2:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('myExercisePlan');
Navigator.of(context).pop();
Navigator.of(context).pushNamed('myExercisePlan');
break;
case 3:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('account');
break;
case 3:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('account');
break;
case 4:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('settings');
break;
case 4:
Navigator.of(context).pop();
Navigator.of(context).pushNamed('settings');
break;
}
});
}
);
break;
}
});
});
}
}
}
+35 -32
View File
@@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bloc/bloc.dart';
// ignore: must_be_immutable
class ImageButton extends StatelessWidget {
final String text;
TextStyle style = TextStyle(fontSize: 14);
@@ -17,62 +18,64 @@ class ImageButton extends StatelessWidget {
final VoidCallback onTap;
bool isLocked;
ImageButton({
this.text,
this.style,
this.image,
this.top,
this.left,
this.height,
this.width,
this.bloc,
this.isShape,
this.textAlignment,
this.onTap,
@required this.isLocked
}) {
ImageButton(
{this.text,
this.style,
this.image,
this.top,
this.left,
this.height,
this.width,
this.bloc,
this.isShape,
this.textAlignment,
this.onTap,
@required this.isLocked}) {
width = width ?? 180;
style = style ?? TextStyle(fontSize: 14, fontFamily: "Roboto Mono");
}
@override
Widget build(BuildContext context) {
double top = width - (style.fontSize - 5) * text.length - 2 * left < 0 ? width - 2 * style.fontSize - 10 : width - style.fontSize - 10;
print ("Top: " + top.toStringAsFixed(0) + " length: " + ((style.fontSize - 5) * text.length).toString());
double top = width - (style.fontSize - 5) * text.length - 2 * left < 0
? width - 2 * style.fontSize - 10
: width - style.fontSize - 10;
print("Top: " +
top.toStringAsFixed(0) +
" length: " +
((style.fontSize - 5) * text.length).toString());
return Stack(
//alignment: textAlignment,
fit: StackFit.passthrough,
overflow: Overflow.clip,
children: [
FlatButton(
child: image == null ?
_getButtonImage("asset/image/WT_menu_dark.png") :
_getButtonImage(image),
child: image == null
? _getButtonImage("asset/image/WT_menu_dark.png")
: _getButtonImage(image),
padding: EdgeInsets.only(left: 0.0, bottom: 0),
shape: getShape(isShape),
onPressed: onTap ?? onTap,
),
Stack(
alignment: Alignment.topLeft,
children: [
Stack(alignment: Alignment.topLeft, children: [
Positioned(
top: 50,
left: 50,
child: this.isLocked?
Image.asset(
'asset/image/lock.png',
height: 60,
width: 60,
)
: Container(),
)]
),
child: this.isLocked
? Image.asset(
'asset/image/lock.png',
height: 60,
width: 60,
)
: Container(),
)
]),
Positioned(
top: top,
left: left,
child: Container(
height: width - 2 * left,
width: width - 2 * left,
width: width - 2 * left,
child: InkWell(
onTap: onTap ?? onTap,
child: Text(
+134 -27
View File
@@ -1,6 +1,61 @@
import 'package:aitrainer_app/util/trans.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
/// Dialog for input any data and call of an [Event] of a [Bloc]
class InputDialog<Event> extends StatefulWidget {
final ValueChanged<dynamic> onChanged;
final double initialValue;
/// Dialog title
final String title;
final String subtitle;
const InputDialog({this.onChanged, this.initialValue, this.title, this.subtitle});
@override
_InputDialogState<Event> createState() => _InputDialogState<Event>();
}
class _InputDialogState<Event> extends State<InputDialog<Event>> with Trans {
final FocusNode _nodeText1 = FocusNode();
double inputValue = 0;
KeyboardActionsConfig _buildConfig(BuildContext context) {
setContext(context);
return KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.ALL,
keyboardBarColor: Colors.grey[200],
keyboardSeparatorColor: Colors.black26,
nextFocus: true,
actions: [
KeyboardActionsItem(
focusNode: _nodeText1,
toolbarButtons: [
//button 2
(node) {
return GestureDetector(
onTap: () => node.unfocus(),
child: Container(
color: Colors.orange,
padding: EdgeInsets.all(8.0),
child: Text(
t("Done"),
style: TextStyle(color: Colors.white),
),
),
);
}
],
),
],
);
}
class InputDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Dialog(
@@ -12,54 +67,105 @@ class InputDialog extends StatelessWidget {
}
_buildChild(BuildContext context) => Container(
height: 350,
decoration: BoxDecoration(color: Colors.redAccent, shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(12))),
height: 350,
decoration: BoxDecoration(color: Colors.white60, shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(12))),
child: KeyboardActions(
config: _buildConfig(context),
child: Column(
children: <Widget>[
Container(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Image.asset(
'assets/image/lock.png',
height: 120,
width: 120,
padding: const EdgeInsets.all(12.0),
child: Column(children: [
Text(
widget.title,
style: GoogleFonts.archivoBlack(
shadows: <Shadow>[
Shadow(
offset: Offset(3.0, 3.0),
blurRadius: 3.0,
color: Colors.black54,
),
],
fontSize: 25,
color: Colors.orange[500],
),
),
),
Text(
widget.subtitle,
style: GoogleFonts.archivoBlack(
shadows: <Shadow>[
Shadow(
offset: Offset(3.0, 3.0),
blurRadius: 3.0,
color: Colors.black54,
),
],
fontSize: 30,
color: Colors.orange[500],
),
),
]),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
color: Colors.white70,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12))),
),
SizedBox(
height: 24,
),
Text(
'Do you want to exit?',
style: TextStyle(fontSize: 20, color: Colors.white, fontWeight: FontWeight.bold),
),
SizedBox(
height: 8,
),
Padding(
padding: const EdgeInsets.only(right: 16, left: 16),
padding: const EdgeInsets.only(top: 20, right: 16, left: 16),
child: Text(
'If back button is pressed by mistake then click on no to continue.',
style: TextStyle(color: Colors.white),
t("Please type the following data:"),
style: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[200], shadows: <Shadow>[
Shadow(
offset: Offset(2.0, 2.0),
blurRadius: 3.0,
color: Colors.black54,
)
]),
textAlign: TextAlign.center,
),
),
SizedBox(
height: 24,
),
Padding(
padding: const EdgeInsets.only(left: 90, right: 90),
child: TextFormField(
focusNode: _nodeText1,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 5, bottom: 5),
labelText: widget.subtitle,
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
fillColor: Colors.black38,
filled: true,
border: OutlineInputBorder(
gapPadding: 2.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.white12, width: 0.4),
),
),
initialValue: widget.initialValue.toStringAsFixed(0),
keyboardType: TextInputType.numberWithOptions(decimal: true),
textInputAction: TextInputAction.done,
style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.yellow[300]),
onChanged: (value) => this.inputValue = double.parse(value),
),
),
SizedBox(
height: 24,
),
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
FlatButton(
RaisedButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('No'),
child: Text(t('Cancel')),
color: Colors.black26,
textColor: Colors.white,
),
SizedBox(
@@ -67,15 +173,16 @@ class InputDialog extends StatelessWidget {
),
RaisedButton(
onPressed: () {
widget.onChanged(this.inputValue);
return Navigator.of(context).pop(true);
},
child: Text('Yes'),
color: Colors.white,
textColor: Colors.redAccent,
child: Text(t('Save')),
color: Colors.orange[600],
textColor: Colors.white,
)
],
)
],
),
);
));
}
+60 -63
View File
@@ -42,75 +42,72 @@ class MenuInfoWidget extends StatelessWidget with Common {
@override
Widget build(BuildContext context) {
int length = title.length + text2.length + text3.length + link.length;
return /* Container(
height: length > 100? 350 : 250,
width: 180,
padding: EdgeInsets.all(25.0),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
"asset/menu/3.bcs1.png",
),
fit: BoxFit.contain),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 9, sigmaY: 9),
child:*/ Container(
padding: EdgeInsets.only(top: 10.0, left: 15, right: 10, bottom: 5),
return Container(
padding: EdgeInsets.only(top: 10.0, left: 15, right: 10, bottom: 5),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.5),
border: Border.all(color: Colors.white60),
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
title,
maxLines: 4,
textAlign: TextAlign.center,
style:
TextStyle(color: titleColor, fontSize: titleSize, fontWeight: titleWeight),
),
Divider(),
Text(
text,
maxLines: 6,
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
),
Divider(),
Text(
text2,
maxLines: 6,
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
),
Divider(),
Text(
text3,
maxLines: 6,
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
),
getLink(),
],
),
//),
// )
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.5),
border: Border.all(color: Colors.white60),
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
title,
maxLines: 4,
textAlign: TextAlign.center,
style: TextStyle(
color: titleColor,
fontSize: titleSize,
fontWeight: titleWeight),
),
Divider(),
Text(
text,
maxLines: 6,
style: TextStyle(
color: textColor, fontSize: textSize, fontWeight: textWeight),
),
Divider(),
Text(
text2,
maxLines: 6,
style: TextStyle(
color: textColor, fontSize: textSize, fontWeight: textWeight),
),
Divider(),
Text(
text3,
maxLines: 6,
style: TextStyle(
color: textColor, fontSize: textSize, fontWeight: textWeight),
),
getLink(),
],
),
//),
// )
);
}
Widget getLink() {
int missingId;
return InkWell(
child: new Text(link, style: TextStyle(color: Colors.lightBlueAccent, fontSize: textSize, fontFamily: 'Arial', fontWeight: textWeight),),
onTap: () =>
{
missingId = bloc.menuTreeRepository.getMissingTreeIdByName(bloc.missingTreeName),
print("menu " + missingId.toString()),
bloc.add(MenuTreeJump(parent: missingId))
}
);
child: new Text(
link,
style: TextStyle(
color: Colors.lightBlueAccent,
fontSize: textSize,
fontFamily: 'Arial',
fontWeight: textWeight),
),
onTap: () => {
missingId = bloc.menuTreeRepository
.getMissingTreeIdByName(bloc.missingTreeName),
print("menu " + missingId.toString()),
bloc.add(MenuTreeJump(parent: missingId))
});
}
}
+4 -4
View File
@@ -9,6 +9,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
import 'menu_info_widget.dart';
@@ -70,7 +71,7 @@ class MenuPageWidget extends StatelessWidget with Trans {
onPressed: () => menuClick(workoutTree, menuBloc, context),
),
Positioned(
top: workoutTree.name.length > 15 ? 140 : 150,
top: workoutTree.name.length > 20 ? 130 : 145,
left: 5,
child: Container(
height: 300,
@@ -80,11 +81,10 @@ class MenuPageWidget extends StatelessWidget with Trans {
child: Text(
" " + workoutTree.name,
maxLines: 2,
style: TextStyle(
style: GoogleFonts.archivoBlack(
color: workoutTree.color,
fontSize: workoutTree.fontSize,
fontFamily: 'Arial',
fontWeight: FontWeight.w900),
),
),
highlightColor: workoutTree.color,
+113 -108
View File
@@ -1,12 +1,13 @@
import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/library/custom_icon_icons.dart';
import 'package:aitrainer_app/model/property.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:google_fonts/google_fonts.dart';
import 'app_bar.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
import 'input_dialog_widget.dart';
// ignore: must_be_immutable
class SizeWidget extends StatefulWidget {
@@ -19,122 +20,126 @@ class SizeWidget extends StatefulWidget {
}
class _SizeState extends State<SizeWidget> with Trans {
double bmr = 0;
final FocusNode _nodeText1 = FocusNode();
KeyboardActionsConfig _buildConfig(BuildContext context) {
return KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.ALL,
keyboardBarColor: Colors.grey[200],
keyboardSeparatorColor: Colors.black26,
nextFocus: true,
actions: [
KeyboardActionsItem(
focusNode: _nodeText1,
toolbarButtons: [
//button 2
(node) {
return GestureDetector(
onTap: () => node.unfocus(),
child: Container(
color: Colors.orange,
padding: EdgeInsets.all(8.0),
child: Text(
AppLocalizations.of(context).translate("Done"),
style: TextStyle(color: Colors.white),
),
),
);
}
],
),
],
);
}
@override
Widget build(BuildContext context) {
setContext(context);
print("sex " + widget.exerciseBloc.customerRepository.sex);
return Form(
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBarNav(depth: 1),
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_black_background.png'),
fit: BoxFit.fill,
alignment: Alignment.center,
),
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_black_background.png'),
fit: BoxFit.fill,
alignment: Alignment.center,
),
child: KeyboardActions(
config: _buildConfig(context),
child: Container(
padding: EdgeInsets.only(top: 10),
child:
Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [
Stack(
children: [
widget.exerciseBloc.customerRepository.sex == "Man"
? Image.asset(
"asset/image/man_sizes.png",
height: MediaQuery.of(context).size.height * .85,
)
: Image.asset(
"asset/image/woman_sizes.png",
height: MediaQuery.of(context).size.height * .85,
),
Positioned(
top: 30,
left: 175,
child: Image.asset(
"asset/image/sizes_empty.png",
),
)
],
)
]))))));
),
child: SafeArea(
child: Container(
padding: EdgeInsets.only(top: 10),
child: Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [
Stack(
children: getSizeFigure(),
)
]))),
)));
}
Widget getWeightInput() {
return Container(
padding: EdgeInsets.only(top: 15, left: 65, right: 65, bottom: 10),
alignment: Alignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Flexible(
child: TextFormField(
focusNode: _nodeText1,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 5, bottom: 5),
labelText: AppLocalizations.of(context).translate("Actual Weight"),
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
fillColor: Colors.black38,
filled: true,
border: OutlineInputBorder(
gapPadding: 2.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.white12, width: 0.4),
),
),
initialValue: widget.exerciseBloc.weight.toStringAsFixed(0),
keyboardType: TextInputType.numberWithOptions(decimal: true),
textInputAction: TextInputAction.done,
style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.yellow[300]),
onChanged: (value) => {widget.exerciseBloc.add(ExerciseNewWeightChange(value: double.parse(value)))},
),
),
IconButton(
icon: Icon(Icons.save),
hoverColor: Colors.blueAccent,
color: widget.exerciseBloc.changedWeight ? Colors.blue[200] : Colors.black54,
onPressed: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())})
],
));
List<Widget> getSizeFigure() {
//print("w " + MediaQuery.of(context).size.width.toString() + "h " + MediaQuery.of(context).size.height.toString());
List<Widget> list = List();
list.add(SizedBox(
width: MediaQuery.of(context).size.width * .80,
height: MediaQuery.of(context).size.height * .80,
));
list.add(
Positioned(
top: 20,
left: 160,
child: Stack(
alignment: Alignment.topLeft,
children: [
SizedBox(height: 80, width: 100),
Text(t("Your Sizes"),
style: GoogleFonts.archivoBlack(
shadows: <Shadow>[
Shadow(
offset: Offset(5.0, 5.0),
blurRadius: 3.0,
color: Colors.black54,
),
],
fontSize: 22,
color: Colors.orange[500],
)),
Positioned(
top: 30,
left: 60,
child: IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.save),
iconSize: 40,
hoverColor: Colors.blueAccent,
color: widget.exerciseBloc.changedSizes ? Colors.orange[300] : Colors.black54,
onPressed: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())}))
],
)),
);
list.add(widget.exerciseBloc.customerRepository.sex == "Man"
? Image.asset(
"asset/image/man_sizes.png",
height: MediaQuery.of(context).size.height * .80,
)
: Image.asset(
"asset/image/woman_sizes.png",
height: MediaQuery.of(context).size.height * .80,
));
list.addAll(getSizeElements());
return list;
}
List<Widget> getSizeElements() {
List<Widget> list = List();
widget.exerciseBloc.manSizes.forEach((element) {
list.add(
Positioned(
top: element.top.toDouble(),
left: element.left.toDouble(),
child: element.value != 0
? IconButton(
icon: Icon(CustomIcon.ok_circled),
padding: EdgeInsets.zero,
color: Colors.green[200],
onPressed: () => onPressed(element),
)
: IconButton(
icon: Icon(CustomIcon.question),
padding: EdgeInsets.zero,
color: Colors.red[800],
onPressed: () => onPressed(element),
)),
);
});
return list;
}
void onPressed(Property element) {
print(element.propertyName);
showDialog(
context: context,
builder: (context) => InputDialog(
title: t("Size Of Your"),
subtitle: element.propertyNameTranslation,
initialValue: element.value,
onChanged: (value) {
widget.exerciseBloc.add(ExerciseNewSizeChange(propertyName: element.propertyName, value: value));
},
));
}
}
+3 -2
View File
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class TreeviewParentWidget extends StatelessWidget {
final String text;
@@ -11,7 +12,7 @@ class TreeviewParentWidget extends StatelessWidget {
Widget build(BuildContext context) {
Widget parentWidget = Text(
this.text,
style: TextStyle(fontWeight: FontWeight.w800, color: Colors.blueAccent, backgroundColor: Colors.transparent),
style: GoogleFonts.archivoBlack(fontSize: 24, color: Colors.blue[800], backgroundColor: Colors.transparent),
);
Icon icon = Icon(Icons.person);
@@ -27,4 +28,4 @@ class TreeviewParentWidget extends StatelessWidget {
),
);
}
}
}