WT 1.26
This commit is contained in:
@@ -207,9 +207,7 @@ class CustomerModifyPage extends StatelessWidget with Trans {
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white24,
|
||||
border: Border.all(color: Colors.black, width: 0.4),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
color: Colors.white24, border: Border.all(color: Colors.black, width: 0.4), borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
child: Column(children: [
|
||||
Text(t("Birth Year"),
|
||||
style: GoogleFonts.inter(
|
||||
@@ -257,8 +255,8 @@ class CustomerModifyPage extends StatelessWidget with Trans {
|
||||
orientation: LinearGaugeOrientation.horizontal,
|
||||
majorTickStyle: LinearTickStyle(length: 20),
|
||||
axisLabelStyle: TextStyle(fontSize: 12.0, color: Colors.black),
|
||||
axisTrackStyle: LinearAxisTrackStyle(
|
||||
color: Colors.cyan, edgeStyle: LinearEdgeStyle.bothFlat, thickness: 1.0, borderColor: Colors.grey)),
|
||||
axisTrackStyle:
|
||||
LinearAxisTrackStyle(color: Colors.cyan, edgeStyle: LinearEdgeStyle.bothFlat, thickness: 1.0, borderColor: Colors.grey)),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
@@ -270,9 +268,7 @@ class CustomerModifyPage extends StatelessWidget with Trans {
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white24,
|
||||
border: Border.all(color: Colors.black, width: 0.4),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
color: Colors.white24, border: Border.all(color: Colors.black, width: 0.4), borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
child: Column(children: [
|
||||
Text(t("Weight"),
|
||||
style: GoogleFonts.inter(
|
||||
@@ -300,9 +296,7 @@ class CustomerModifyPage extends StatelessWidget with Trans {
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white24,
|
||||
border: Border.all(color: Colors.black, width: 0.4),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
color: Colors.white24, border: Border.all(color: Colors.black, width: 0.4), borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
child: Column(children: [
|
||||
Text(t("Height"),
|
||||
style: GoogleFonts.inter(
|
||||
@@ -376,14 +370,15 @@ class CustomerModifyPage extends StatelessWidget with Trans {
|
||||
minHeight: 50.0,
|
||||
fontSize: 14.0,
|
||||
initialLabelIndex: customerBloc.customerRepository.customer!.sex == "m" ? 0 : 1,
|
||||
activeBgColor: Colors.indigo,
|
||||
activeBgColor: [Colors.indigo],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.white30,
|
||||
inactiveFgColor: Colors.grey[900],
|
||||
labels: [t('Man'), t('Woman')],
|
||||
onToggle: (index) {
|
||||
customerBloc.add(CustomerGenderChange(gender: index));
|
||||
customerBloc.add(CustomerGenderChange(gender: index!));
|
||||
},
|
||||
totalSwitches: 2,
|
||||
),
|
||||
Divider(),
|
||||
Divider(),
|
||||
|
||||
@@ -34,8 +34,8 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
||||
create: (context) => TrainingLogBloc()..add(TrainingLogLoad()),
|
||||
child: BlocConsumer<TrainingLogBloc, TrainingLogState>(listener: (context, state) {
|
||||
if (state is TrainingLogError) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final bloc = BlocProvider.of<TrainingLogBloc>(context);
|
||||
@@ -88,7 +88,14 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
||||
Widget getCalendar(TrainingLogBloc bloc) {
|
||||
return Expanded(
|
||||
child: SfCalendarTheme(
|
||||
data: SfCalendarThemeData(brightness: Brightness.dark, backgroundColor: Colors.transparent),
|
||||
data: SfCalendarThemeData(
|
||||
brightness: Brightness.dark,
|
||||
backgroundColor: Colors.transparent,
|
||||
agendaDayTextStyle: GoogleFonts.inter(color: Colors.white),
|
||||
agendaDateTextStyle: GoogleFonts.inter(color: Colors.white),
|
||||
weekNumberTextStyle: GoogleFonts.inter(color: Colors.white),
|
||||
viewHeaderDayTextStyle: GoogleFonts.inter(color: Colors.white),
|
||||
),
|
||||
child: SfCalendar(
|
||||
dataSource: TrainingDataSource(bloc.results),
|
||||
allowedViews: [
|
||||
@@ -97,14 +104,22 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
||||
],
|
||||
view: CalendarView.month,
|
||||
monthViewSettings: MonthViewSettings(
|
||||
showAgenda: true,
|
||||
appointmentDisplayMode: MonthAppointmentDisplayMode.indicator,
|
||||
showTrailingAndLeadingDates: true,
|
||||
appointmentDisplayCount: 12,
|
||||
),
|
||||
showAgenda: true,
|
||||
appointmentDisplayMode: MonthAppointmentDisplayMode.indicator,
|
||||
showTrailingAndLeadingDates: true,
|
||||
appointmentDisplayCount: 12,
|
||||
monthCellStyle: MonthCellStyle(
|
||||
textStyle: GoogleFonts.inter(color: Colors.white),
|
||||
leadingDatesTextStyle: GoogleFonts.inter(color: Colors.white54),
|
||||
trailingDatesTextStyle: GoogleFonts.inter(color: Colors.white54),
|
||||
)),
|
||||
appointmentTimeTextFormat: 'HH:mm',
|
||||
headerDateFormat: "y MMMM",
|
||||
headerStyle: CalendarHeaderStyle(
|
||||
textStyle: GoogleFonts.inter(color: Colors.white),
|
||||
),
|
||||
firstDayOfWeek: 1, // Monday
|
||||
cellBorderColor: Colors.white54,
|
||||
selectionDecoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(color: Color(0xffb4f500), width: 2),
|
||||
@@ -145,8 +160,7 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
||||
fit: FlexFit.tight,
|
||||
flex: 30,
|
||||
child: Text(result.eventName,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: result.isExercise ? 14 : 16, color: result.color, fontWeight: FontWeight.bold)),
|
||||
style: GoogleFonts.inter(fontSize: result.isExercise ? 14 : 16, color: result.color, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Visibility(
|
||||
visible: result.isExercise,
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:aitrainer_app/widgets/treeview_parent_widget.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:aitrainer_app/bloc/development_by_muscle/development_by_muscle_bloc.dart';
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
@@ -21,7 +20,6 @@ class MyDevelopmentMusclePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Common, Trans {
|
||||
// ignore: close_sinks
|
||||
late DevelopmentByMuscleBloc bloc;
|
||||
late double cWidth;
|
||||
|
||||
@@ -88,7 +86,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
} else {
|
||||
return TreeView(
|
||||
startExpanded: false,
|
||||
children: _getTreeChildren(bloc.workoutTreeRepository.sortedTree, bloc),
|
||||
children: _getTreeChildren(bloc),
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -98,9 +96,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _getTreeChildren(SplayTreeMap tree, DevelopmentByMuscleBloc bloc) {
|
||||
List<Widget> exerciseTypes = [];
|
||||
|
||||
Card getExplanation(DevelopmentByMuscleBloc bloc) {
|
||||
Card explanation = Card(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
@@ -128,97 +124,27 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
t("Here you see you development in the last period."),
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ChoiceChip(
|
||||
avatar: Icon(
|
||||
Icons.bubble_chart,
|
||||
),
|
||||
label: Text(t('Sum Of Mass')),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.lightBlueAccent,
|
||||
selected: bloc.diagramType == DiagramType.sumMass,
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.sumMass))},
|
||||
),
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.accessibility_new),
|
||||
label: Text(t('One Rep Max')),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.lightBlueAccent,
|
||||
selected: bloc.diagramType == DiagramType.oneRepMax,
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.oneRepMax))},
|
||||
),
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.perm_device_information),
|
||||
label: Text(t('Percent')),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.lightBlueAccent,
|
||||
selected: bloc.diagramType == DiagramType.percent,
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.percent))},
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ChoiceChip(
|
||||
labelPadding: EdgeInsets.only(right: 5),
|
||||
avatar: Icon(Icons.timer),
|
||||
label: Text(t('Detailed')),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
disabledColor: Colors.black26,
|
||||
selectedColor: Colors.greenAccent,
|
||||
selected: bloc.dateRate == DateRate.daily,
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily))},
|
||||
),
|
||||
ChoiceChip(
|
||||
labelPadding: EdgeInsets.only(right: 5),
|
||||
avatar: Icon(Icons.timer),
|
||||
label: Text(t('Weekly')),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.greenAccent,
|
||||
disabledColor: Colors.white12,
|
||||
tooltip: "Heti bontás",
|
||||
selected: bloc.dateRate == DateRate.weekly,
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly))},
|
||||
),
|
||||
ChoiceChip(
|
||||
labelPadding: EdgeInsets.only(right: 5),
|
||||
avatar: Icon(Icons.timer),
|
||||
label: Text(t('Monthly')),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.greenAccent,
|
||||
disabledColor: Colors.black26,
|
||||
selected: bloc.dateRate == DateRate.monthly,
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly))},
|
||||
),
|
||||
ChoiceChip(
|
||||
labelPadding: EdgeInsets.only(right: 5),
|
||||
avatar: Icon(Icons.timer),
|
||||
label: Text(t('Yearly')),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.greenAccent,
|
||||
disabledColor: Colors.white70,
|
||||
selected: bloc.dateRate == DateRate.yearly,
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.yearly))},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
return explanation;
|
||||
}
|
||||
|
||||
List<Widget> _getTreeChildren(DevelopmentByMuscleBloc bloc) {
|
||||
List<Widget> exerciseTypes = [];
|
||||
|
||||
Card explanation = this.getExplanation(bloc);
|
||||
exerciseTypes.add(explanation);
|
||||
|
||||
LinkedHashMap<String, dynamic> rc = LinkedHashMap();
|
||||
tree.forEach((name, list) {
|
||||
bloc.workoutTreeRepository.sortedTree.forEach((name, list) {
|
||||
rc = _getChildList(list, bloc);
|
||||
final List<Widget> children = rc['list'];
|
||||
final bool hasNoData = rc['hasNoData'];
|
||||
exerciseTypes.add(Container(
|
||||
margin: const EdgeInsets.only(left: 4.0),
|
||||
margin: const EdgeInsets.only(left: 8.0),
|
||||
child: TreeViewChild(
|
||||
startExpanded: false,
|
||||
parent: _getExerciseWidget(exerciseTypeName: name, noData: hasNoData),
|
||||
parent: _getExerciseGroupWidget(exerciseTypeName: name, noData: hasNoData),
|
||||
children: children,
|
||||
)));
|
||||
});
|
||||
@@ -226,104 +152,47 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
return exerciseTypes;
|
||||
}
|
||||
|
||||
Widget _getExerciseGroupWidget({required String exerciseTypeName, bool noData = false}) {
|
||||
return TreeviewParentWidget(
|
||||
text: exerciseTypeName,
|
||||
backgroundColor: !noData ? Colors.white38 : Colors.white12,
|
||||
color: !noData ? Colors.blue[800] : Colors.blue[100],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getExerciseWidget({required String exerciseTypeName, bool noData = false}) {
|
||||
return TreeviewParentWidget(
|
||||
text: exerciseTypeName,
|
||||
backgroundColor: !noData ? Colors.white38 : Colors.white12,
|
||||
color: !noData ? Colors.blue[800] : Colors.grey[400]);
|
||||
text: exerciseTypeName,
|
||||
backgroundColor: !noData ? Colors.white38 : Colors.white12,
|
||||
color: !noData ? Colors.blue[700] : Colors.blue[100],
|
||||
fontSize: 16,
|
||||
);
|
||||
}
|
||||
|
||||
LinkedHashMap<String, dynamic> _getChildList(List<WorkoutMenuTree> listWorkoutTree, DevelopmentByMuscleBloc bloc) {
|
||||
LinkedHashMap<String, dynamic> rc = LinkedHashMap();
|
||||
List<Widget> list = [];
|
||||
bool hasSummaryNoData = true;
|
||||
listWorkoutTree.forEach((element) {
|
||||
final bool hasNoData = (bloc.listChartData[element.exerciseTypeId] == null);
|
||||
hasSummaryNoData = hasSummaryNoData && hasNoData;
|
||||
String unit = " kg";
|
||||
if (bloc.diagramType == DiagramType.percent) {
|
||||
unit = " %";
|
||||
}
|
||||
list.add(SizedBox(
|
||||
width: cWidth * 0.85,
|
||||
height: hasNoData ? 0 : 200,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 5, top: 5, right: 5, bottom: 5),
|
||||
color: Colors.white70,
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
hasNoData
|
||||
? Container()
|
||||
: Text(
|
||||
element.exerciseType!.nameTranslation,
|
||||
style: TextStyle(color: Colors.deepOrange),
|
||||
),
|
||||
hasNoData
|
||||
? Container(
|
||||
//child: Text("no data for " + element.exerciseType.nameTranslation),
|
||||
)
|
||||
: Expanded(
|
||||
//fit: FlexFit.loose,
|
||||
child: BarChart(
|
||||
BarChartData(
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
barTouchData: BarTouchData(
|
||||
touchTooltipData: BarTouchTooltipData(
|
||||
tooltipBgColor: Colors.white70,
|
||||
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||
return BarTooltipItem(
|
||||
rod.y.toStringAsFixed(0) + unit,
|
||||
TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
);
|
||||
}),
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
bottomTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey),
|
||||
getTitles: (double value) {
|
||||
var date = new DateTime.fromMillisecondsSinceEpoch(value.toInt());
|
||||
String strDate = getDatePart(date, bloc.dateRate);
|
||||
return strDate;
|
||||
},
|
||||
),
|
||||
leftTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey),
|
||||
interval: bloc.listChartData[element.exerciseTypeId] == null ||
|
||||
bloc.listChartData[element.exerciseTypeId]!.interval == 0
|
||||
? 100
|
||||
: bloc.listChartData[element.exerciseTypeId]!.interval,
|
||||
margin: 10,
|
||||
getTitles: (double value) {
|
||||
return value.toStringAsFixed(0) + unit;
|
||||
})),
|
||||
borderData: FlBorderData(
|
||||
show: false,
|
||||
),
|
||||
gridData: FlGridData(
|
||||
show: true,
|
||||
checkToShowHorizontalLine: (value) => value % bloc.listChartData[element.exerciseTypeId]!.gridInterval == 0,
|
||||
getDrawingHorizontalLine: (value) {
|
||||
return FlLine(
|
||||
color: Colors.black26,
|
||||
strokeWidth: 0.5,
|
||||
);
|
||||
},
|
||||
),
|
||||
groupsSpace: 2,
|
||||
barGroups:
|
||||
bloc.listChartData[element.exerciseTypeId] == null ? [] : bloc.listChartData[element.exerciseTypeId]!.data,
|
||||
),
|
||||
swapAnimationDuration: Duration(milliseconds: 1200),
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
));
|
||||
});
|
||||
rc['list'] = list;
|
||||
rc['hasNoData'] = hasSummaryNoData;
|
||||
rc['hasNoData'] = false;
|
||||
listWorkoutTree.forEach((element) {
|
||||
list.add(Container(
|
||||
margin: const EdgeInsets.only(left: 8.0),
|
||||
child: TreeViewChild(
|
||||
parent: _getExerciseWidget(exerciseTypeName: element.exerciseType!.nameTranslation),
|
||||
children: [],
|
||||
onTap: () => onPressed(bloc, element),
|
||||
)));
|
||||
});
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void onPressed(DevelopmentByMuscleBloc bloc, WorkoutMenuTree element) {
|
||||
HashMap<String, dynamic> args = HashMap();
|
||||
args['exerciseRepository'] = bloc.exerciseRepository;
|
||||
args['workoutTreeRepository'] = bloc.workoutTreeRepository;
|
||||
args['exerciseTypeId'] = element.exerciseTypeId;
|
||||
args['title'] = t("Muscle development") + ": " + "${element.exerciseType!.nameTranslation}";
|
||||
Navigator.of(context).pushNamed('developmentDiagramPage', arguments: args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@ import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/enums.dart';
|
||||
import 'package:aitrainer_app/util/track.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_common.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
@@ -68,10 +66,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
text: t("My Training Logs"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/edzesnaplom400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => Navigator.of(context).pushNamed('mydevelopmentLog', arguments: args),
|
||||
@@ -110,10 +105,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
text: t("My Whole Body Development"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4)),
|
||||
fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4)),
|
||||
),
|
||||
image: "asset/image/testemfejl400x400.jpg",
|
||||
left: 5,
|
||||
@@ -132,8 +124,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
warning: true,
|
||||
title: t("Warning"),
|
||||
descriptions: t("Please log in"),
|
||||
description2:
|
||||
t("because only that way can we show you the personalized development diagrams and analysises"),
|
||||
description2: t("because only that way can we show you the personalized development diagrams and analysises"),
|
||||
text: "OK",
|
||||
onTap: () => Navigator.of(context).popAndPushNamed("login"),
|
||||
onCancel: () => {
|
||||
@@ -199,65 +190,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
onTap: () => {Navigator.of(context).pushNamed('mydevelopmentMusclePage', arguments: args)},
|
||||
isLocked: true,
|
||||
))),
|
||||
Badge(
|
||||
elevation: 0,
|
||||
padding: EdgeInsets.all(0),
|
||||
position: BadgePosition.topStart(top: -12, start: -12),
|
||||
animationDuration: Duration(milliseconds: 1500),
|
||||
animationType: BadgeAnimationType.fade,
|
||||
badgeColor: Colors.transparent,
|
||||
showBadge: Cache().hasPurchased,
|
||||
badgeContent: IconButton(
|
||||
iconSize: 36,
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogCommon(
|
||||
title: t("Premium function"),
|
||||
descriptions: Cache().canTrial()
|
||||
? t("This is a premium function, you can reach it outside of the trial period only with a valid subscription")
|
||||
: t("This is a premium function, you can reach it only with a valid subscription"),
|
||||
onCancel: () => Navigator.of(context).pop(),
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
text: '',
|
||||
);
|
||||
}),
|
||||
icon: Icon(
|
||||
Icons.star,
|
||||
color: Colors.orange[600],
|
||||
)),
|
||||
child: ImageButton(
|
||||
width: imageWidth,
|
||||
left: 5,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Predictions"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/predictions.jpg",
|
||||
onTap: () => {
|
||||
if (Cache().userLoggedIn != null)
|
||||
{
|
||||
Track().track(TrackingEvent.prediction),
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
unlocked: Cache().hasPurchased,
|
||||
unlockRound: 12,
|
||||
function: "Predictions",
|
||||
unlockedText: null,
|
||||
onTap: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
})
|
||||
}
|
||||
},
|
||||
isLocked: true,
|
||||
)),
|
||||
//developmentWidget(imageWidth, "Development Size", "asset/image/predictions.jpg", TrackingEvent.my_size_development, args),
|
||||
developmentWidget(imageWidth, t("Development of My Sizes"), "asset/image/sizes_q.jpg", TrackingEvent.my_size_development, args),
|
||||
hiddenWidget(customerRepository, exerciseRepository),
|
||||
]),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
@@ -278,15 +211,14 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t(title),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle:
|
||||
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: imageUrl,
|
||||
onTap: () => {
|
||||
if (Cache().userLoggedIn != null)
|
||||
{
|
||||
Track().track(trackingEvent),
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]),
|
||||
Future.delayed(Duration(seconds: 400)),
|
||||
//SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]),
|
||||
//Future.delayed(Duration(seconds: 400)),
|
||||
Navigator.of(context).pushNamed('mydevelopmentSizesPage', arguments: args),
|
||||
|
||||
/* showDialog(
|
||||
@@ -302,7 +234,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
}) */
|
||||
}
|
||||
},
|
||||
isLocked: true,
|
||||
isLocked: false,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:aitrainer_app/bloc/development_sizes/development_sizes_bloc.dart';
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/model/property.dart';
|
||||
import 'package:aitrainer_app/repository/customer_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
@@ -7,7 +10,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||
import '../widgets/app_bar.dart';
|
||||
import '../widgets/input_dialog_widget.dart';
|
||||
|
||||
class SizesDevelopmentPage extends StatefulWidget {
|
||||
const SizesDevelopmentPage();
|
||||
@@ -24,8 +26,8 @@ class _SizeState extends State<SizesDevelopmentPage> with Trans {
|
||||
create: (context) => DevelopmentSizesBloc(customerRepository: CustomerRepository())..add(DevelopmentSizesLoad()),
|
||||
child: BlocConsumer<DevelopmentSizesBloc, DevelopmentSizesState>(listener: (context, state) {
|
||||
if (state is DevelopmentSizesError) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
(SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))));
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar((SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))));
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final bloc = BlocProvider.of<DevelopmentSizesBloc>(context);
|
||||
@@ -41,30 +43,31 @@ class _SizeState extends State<SizesDevelopmentPage> with Trans {
|
||||
}
|
||||
|
||||
Widget getForm(DevelopmentSizesBloc bloc) {
|
||||
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.jpg'),
|
||||
fit: BoxFit.fill,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
return 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.jpg'),
|
||||
fit: BoxFit.fill,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: getSizeFigure(bloc),
|
||||
)
|
||||
]))),
|
||||
)));
|
||||
getHeader(bloc),
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: getSizeFigure(bloc),
|
||||
)
|
||||
])))),
|
||||
));
|
||||
}
|
||||
|
||||
List<Widget> getSizeFigure(DevelopmentSizesBloc bloc) {
|
||||
@@ -91,7 +94,6 @@ class _SizeState extends State<SizesDevelopmentPage> with Trans {
|
||||
top: bloc.customerRepository.getWeightCoordinate(bloc.isMan, isTop: true)!.toDouble(),
|
||||
left: bloc.customerRepository.getWeightCoordinate(bloc.isMan, isTop: false, isLeft: true)!.toDouble() - 45,
|
||||
child: GestureDetector(
|
||||
//onTap: () => onPressed(bloc.customerRepository.getPropertyByName("Weight")),
|
||||
child: Image.asset(
|
||||
"asset/image/merleg.png",
|
||||
height: 120,
|
||||
@@ -101,30 +103,6 @@ class _SizeState extends State<SizesDevelopmentPage> with Trans {
|
||||
));
|
||||
|
||||
list.addAll(getSizeElements(bloc));
|
||||
list.add(
|
||||
Positioned(
|
||||
top: mediaHeight * .07,
|
||||
left: bloc.isMan ? mediaWidth * .62 : mediaWidth * .65,
|
||||
child: Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
SizedBox(height: 80, width: 100),
|
||||
Text(t("Your Size Diagrams"),
|
||||
maxLines: 2,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 3.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
fontSize: 20,
|
||||
color: Colors.orange[500],
|
||||
)),
|
||||
],
|
||||
)),
|
||||
);
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -139,21 +117,21 @@ class _SizeState extends State<SizesDevelopmentPage> with Trans {
|
||||
left: element.left!.toDouble(),
|
||||
child: element.value != 0
|
||||
? Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: bloc.isMan ? Colors.green[800] : Color(0xFFEA776C),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
Radius.circular(40),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.trending_up, color: Colors.green),
|
||||
padding: EdgeInsets.zero,
|
||||
color: Colors.red[800],
|
||||
splashColor: Colors.amber,
|
||||
onPressed: () => onPressed(element),
|
||||
padding: EdgeInsets.only(left: 1, top: 1, right: 1, bottom: 1),
|
||||
child: TextButton(
|
||||
child: Text(
|
||||
bloc.customerRepository.getCustomerProperty(element.propertyName)!.propertyValue.toStringAsFixed(0),
|
||||
style: GoogleFonts.inter(color: Colors.white, fontSize: 12),
|
||||
),
|
||||
onPressed: () => onPressed(element, bloc, element.propertyName),
|
||||
))
|
||||
: Container(
|
||||
width: 23,
|
||||
@@ -166,11 +144,11 @@ class _SizeState extends State<SizesDevelopmentPage> with Trans {
|
||||
),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.trending_up, color: Colors.red),
|
||||
icon: Icon(CustomIcon.minus_circle, color: Colors.red),
|
||||
padding: EdgeInsets.zero,
|
||||
color: Colors.red[800],
|
||||
splashColor: Colors.amber,
|
||||
onPressed: () => onPressed(element),
|
||||
onPressed: () => onPressed(element, bloc, element.propertyName),
|
||||
))),
|
||||
);
|
||||
});
|
||||
@@ -178,17 +156,53 @@ class _SizeState extends State<SizesDevelopmentPage> with Trans {
|
||||
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));
|
||||
},
|
||||
));
|
||||
void onPressed(Property element, DevelopmentSizesBloc bloc, String propertyName) {
|
||||
HashMap<String, dynamic> args = HashMap();
|
||||
args['customerRepository'] = bloc.customerRepository;
|
||||
args['property'] = element;
|
||||
args['title'] = t("Size development: ") + " " + propertyName;
|
||||
Navigator.of(context).pushNamed('developmentDiagramPage', arguments: args);
|
||||
}
|
||||
|
||||
Widget getHeader(DevelopmentSizesBloc bloc) {
|
||||
return Card(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_plainblack_background.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
),
|
||||
Text(" "),
|
||||
Text(
|
||||
t("Red icon means you have not saved this size."),
|
||||
overflow: TextOverflow.clip,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
t("Tap on the green icon to see your development in a diagram"),
|
||||
overflow: TextOverflow.clip,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
child: Form(
|
||||
child: BlocConsumer<SettingsBloc, SettingsState>(listener: (context, state) {
|
||||
if (state is SettingsError) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
} else if (state is SettingsReady) {
|
||||
menuBloc.add(MenuRecreateTree());
|
||||
Navigator.of(context).pushNamed("home");
|
||||
@@ -110,7 +110,7 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
? 1
|
||||
: 0
|
||||
: 1,
|
||||
activeBgColor: Colors.indigo,
|
||||
activeBgColor: [Colors.indigo],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.white60,
|
||||
inactiveFgColor: Colors.grey[900],
|
||||
@@ -120,6 +120,7 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
print("Server setting to: $live");
|
||||
settingsBloc.add(SettingsSetServer(live: index == 0));
|
||||
},
|
||||
totalSwitches: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -133,7 +134,7 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
minHeight: 30.0,
|
||||
fontSize: 14.0,
|
||||
initialLabelIndex: Cache().hasHardware! ? 0 : 1,
|
||||
activeBgColor: Colors.indigo,
|
||||
activeBgColor: [Colors.indigo],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.white60,
|
||||
inactiveFgColor: Colors.grey[900],
|
||||
@@ -141,6 +142,7 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
onToggle: (index) {
|
||||
settingsBloc.add(SettingsSetHardware(hasHardware: index == 0));
|
||||
},
|
||||
totalSwitches: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -155,7 +157,7 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
minHeight: 30.0,
|
||||
fontSize: 14.0,
|
||||
initialLabelIndex: 0,
|
||||
activeBgColor: Colors.indigo,
|
||||
activeBgColor: [Colors.indigo],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.white60,
|
||||
inactiveFgColor: Colors.grey[900],
|
||||
@@ -173,6 +175,7 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
tutorialBloc.add(TutorialStart());
|
||||
Track().track(TrackingEvent.tutorial_activate);
|
||||
},
|
||||
totalSwitches: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user