WT 1.1.0+39 evaluation, health data
This commit is contained in:
@@ -3,7 +3,6 @@ import 'package:aitrainer_app/bloc/customer_change/customer_change_bloc.dart';
|
||||
import 'package:aitrainer_app/library/numberpicker.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar_min.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
@@ -0,0 +1,503 @@
|
||||
import 'dart:collection';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:aitrainer_app/bloc/result/result_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/exercise_ability.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_result_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar_min.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:aitrainer_app/model/result.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class EvaluationPage extends StatelessWidget with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LinkedHashMap arguments = ModalRoute.of(context).settings.arguments;
|
||||
ExerciseRepository exerciseRepository;
|
||||
// ignore: close_sinks
|
||||
if (arguments != null) {
|
||||
exerciseRepository = arguments['exerciseRepository'];
|
||||
} else {
|
||||
exerciseRepository = ExerciseRepository();
|
||||
}
|
||||
ResultType resultType = ResultType.none;
|
||||
String imageUrl = "";
|
||||
if (Cache().userLoggedIn.sex == "m") {
|
||||
resultType = ResultType.man;
|
||||
imageUrl = 'asset/image/WT_Results_for_men.png';
|
||||
} else {
|
||||
resultType = ResultType.man;
|
||||
imageUrl = 'asset/image/WT_Results_for_female.png';
|
||||
}
|
||||
if (exerciseRepository.exerciseType.getAbility().equalsTo(ExerciseAbility.running)) {
|
||||
resultType = ResultType.running;
|
||||
imageUrl = 'asset/image/WT_Results_for_runners.png';
|
||||
}
|
||||
print("ResultType: " + resultType.toString());
|
||||
setContext(context);
|
||||
return Scaffold(
|
||||
appBar: AppBarMin(
|
||||
back: true,
|
||||
),
|
||||
body: Container(
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(imageUrl),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.topCenter,
|
||||
),
|
||||
),
|
||||
child: BlocProvider(
|
||||
create: (context) =>
|
||||
ResultBloc(resultRepository: ExerciseResultRepository(resultType: resultType), exerciseRepository: exerciseRepository)
|
||||
..add(ResultLoad()),
|
||||
child: BlocConsumer<ResultBloc, ResultState>(listener: (context, state) {
|
||||
if (state is ResultError) {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.error, style: TextStyle(color: Colors.white))));
|
||||
} else if (state is ResultLoading) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
duration: Duration(milliseconds: 100),
|
||||
backgroundColor: Colors.transparent,
|
||||
content: Container(child: Center(child: CircularProgressIndicator()))));
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final resultBloc = BlocProvider.of<ResultBloc>(context);
|
||||
return getEvaluationWidgets(resultBloc);
|
||||
}))),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 0));
|
||||
}
|
||||
|
||||
Widget getEvaluationWidgets(ResultBloc resultBloc) {
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en")
|
||||
? resultBloc.exerciseRepository.exerciseType.name
|
||||
: resultBloc.exerciseRepository.exerciseType.nameTranslation;
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: CustomScrollView(scrollDirection: Axis.vertical, slivers: [
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
expandedHeight: 50.0,
|
||||
automaticallyImplyLeading: false,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
title: Text(exerciseName,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 3,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 24,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
Text(DateFormat('y-M-d HH:mm', AppLanguage().appLocal.toString()).format(resultBloc.exerciseRepository.start),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 20,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Divider(color: Colors.transparent),
|
||||
Divider(color: Colors.transparent),
|
||||
Text(t("Summary of your test"),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 20,
|
||||
color: Colors.yellow[300],
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
]),
|
||||
),
|
||||
getResultSummary(resultBloc),
|
||||
getSuggestionTitle(resultBloc),
|
||||
getSuggestion(resultBloc),
|
||||
emptySliver(),
|
||||
getResultTitle(resultBloc),
|
||||
getResults(resultBloc),
|
||||
]));
|
||||
}
|
||||
|
||||
Widget getSuggestionTitle(ResultBloc resultBloc) {
|
||||
if (resultBloc.exerciseRepository.exerciseType.unitQuantityUnit != null) {
|
||||
return SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
Divider(color: Colors.transparent),
|
||||
Divider(color: Colors.transparent),
|
||||
Text(t("Suggestions based on your test"),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 20,
|
||||
color: Colors.yellow[300],
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else
|
||||
return emptySliver();
|
||||
}
|
||||
|
||||
Widget getResultTitle(ResultBloc resultBloc) {
|
||||
return SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
Divider(color: Colors.transparent),
|
||||
Divider(color: Colors.transparent),
|
||||
Text(t("Health Data Summary"),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 20,
|
||||
color: Colors.yellow[300],
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Divider(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSuggestion(ResultBloc resultBloc) {
|
||||
if (resultBloc.exerciseRepository.exerciseType.unitQuantityUnit != null) {
|
||||
return SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
getSuggestionWidget(resultBloc, "Hypertrophy", "asset/image/pict_hypertrophy.png", "3x10-12", 0.9, "2"),
|
||||
Divider(color: Colors.transparent),
|
||||
getSuggestionWidget(resultBloc, "Gain Strength", "asset/image/pict_weight_volumen_tonna.png", "3x10-12", 0.75, "3-5"),
|
||||
Divider(color: Colors.transparent),
|
||||
getSuggestionWidget(resultBloc, "Endurance", "asset/image/pict_reps_volumen_db.png", "4x25-35", 0.50, "3"),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else
|
||||
return emptySliver();
|
||||
}
|
||||
|
||||
Widget emptySliver({int count = 1}) {
|
||||
return SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
Container(),
|
||||
Divider(color: Colors.transparent),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSuggestionWidget(ResultBloc resultBloc, String title, String picture, String repeats, double percent, String restTime) {
|
||||
String unitQuantityUnit = resultBloc.exerciseRepository.exerciseType.unitQuantityUnit == null
|
||||
? ""
|
||||
: resultBloc.exerciseRepository.exerciseType.unitQuantityUnit;
|
||||
return Column(
|
||||
children: [
|
||||
Text(t(title),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 30,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Row(children: [
|
||||
Image.asset(
|
||||
picture,
|
||||
height: 80,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(repeats + " " + t("repeats"),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 18,
|
||||
color: Colors.orange,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(t("Weight") + ": " + resultBloc.calculate1RM(percent: percent).toStringAsFixed(0) + " " + unitQuantityUnit,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 18,
|
||||
color: Colors.orange,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(t("Rest time") + ": " + restTime + " " + t("minutes"),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 18,
|
||||
color: Colors.orange,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
]),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSummary(ResultBloc bloc) {
|
||||
int index = 0;
|
||||
List<Text> resultList = List();
|
||||
bloc.exerciseRepository.actualExerciseList.forEach((exercise) {
|
||||
final String unit = t(bloc.exerciseRepository.exerciseType.unit);
|
||||
String exerciseElement = "";
|
||||
final String exerciseRepeats = exercise.quantity.toStringAsFixed(0);
|
||||
final String exerciseUnitQuantity = exercise.unitQuantity != null ? "x" + exercise.unitQuantity.toStringAsFixed(0) : "";
|
||||
if (index == 0) {
|
||||
exerciseElement = t("Test") + ": ";
|
||||
} else if (index == 1) {
|
||||
exerciseElement = t("1st Control") + ": ";
|
||||
} else if (index == 2) {
|
||||
exerciseElement = t("2nd Control") + ": ";
|
||||
} else if (index == 3) {
|
||||
exerciseElement = t("3rd Control") + ": ";
|
||||
}
|
||||
index++;
|
||||
resultList.add(
|
||||
Text(exerciseElement + exerciseRepeats + exerciseUnitQuantity + " " + unit,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 18,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
});
|
||||
return Column(children: resultList);
|
||||
}
|
||||
|
||||
Widget getResultSummary(ResultBloc resultBloc) {
|
||||
return SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[Divider(color: Colors.transparent), getSummary(resultBloc)],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getResults(ResultBloc resultBloc) {
|
||||
return SliverGrid(
|
||||
delegate: SliverChildListDelegate(
|
||||
getResultData(resultBloc),
|
||||
),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 5.0,
|
||||
crossAxisSpacing: 5.0,
|
||||
childAspectRatio: 1.1,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> getResultData(ResultBloc resultBloc) {
|
||||
List<Widget> data = List();
|
||||
|
||||
resultBloc.resultRepository.getResults().forEach((element) {
|
||||
data.add(getResultWidget(element));
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
Widget getResultWidget(ResultExt element) {
|
||||
bool hasHardware = Cache().hasHardware;
|
||||
bool blur = (!hasHardware && element.isHardware());
|
||||
/* print("Blur: " +
|
||||
element.getDescription() +
|
||||
": " +
|
||||
blur.toString() +
|
||||
" hasHardware:" +
|
||||
hasHardware.toString() +
|
||||
" isHw: " +
|
||||
element.isHardware().toString()); */
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
blur
|
||||
? Stack(children: [
|
||||
Image.asset(
|
||||
element.getImage(),
|
||||
height: 80,
|
||||
//color: Colors.white12,
|
||||
),
|
||||
Image.asset(
|
||||
element.getImage(),
|
||||
height: 80,
|
||||
color: Colors.black54,
|
||||
),
|
||||
])
|
||||
: Image.asset(
|
||||
element.getImage(),
|
||||
height: 80,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
element.data,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 28, color: blur ? Colors.white30 : Colors.white),
|
||||
),
|
||||
Text(
|
||||
t(element.getDescription()),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 14, color: blur ? Colors.white30 : Colors.white),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,17 @@ import 'dart:collection';
|
||||
|
||||
import 'package:aitrainer_app/bloc/exercise_control/exercise_control_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/number_picker.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:aitrainer_app/library/numberpicker.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class ExerciseControlPage extends StatefulWidget {
|
||||
@@ -32,16 +33,16 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
..add(ExerciseControlLoad()),
|
||||
child: BlocConsumer<ExerciseControlBloc, ExerciseControlState>(listener: (context, state) {
|
||||
if (state is ExerciseControlError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
} else if (state is ExerciseControlLoading) {
|
||||
//LoadingDialog.show(context);
|
||||
return LoadingDialog();
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final exerciseBloc = BlocProvider.of<ExerciseControlBloc>(context);
|
||||
if (state is ExerciseControlReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
if (state is ExerciseControlLoading) {
|
||||
return LoadingDialog();
|
||||
} else if (state is ExerciseControlReady) {
|
||||
return getControlForm(exerciseBloc);
|
||||
} else {
|
||||
return getControlForm(exerciseBloc);
|
||||
@@ -53,49 +54,80 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en")
|
||||
? exerciseBloc.exerciseRepository.exerciseType.name
|
||||
: exerciseBloc.exerciseRepository.exerciseType.nameTranslation;
|
||||
|
||||
return Form(
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
appBar: AppBarNav(depth: 1),
|
||||
body: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_black_background.png'),
|
||||
fit: BoxFit.fill,
|
||||
alignment: Alignment.center,
|
||||
image: Cache().userLoggedIn.sex == "m"
|
||||
? AssetImage("asset/image/WT_Results_for_men.png")
|
||||
: AssetImage("asset/image/WT_Results_for_female.png"),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.topCenter,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 25, left: 25, right: 25),
|
||||
padding: const EdgeInsets.only(top: 10, left: 25, right: 25),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
controller: ScrollController(
|
||||
initialScrollOffset: exerciseBloc.scrollOffset,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
exerciseName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.orange),
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(2.0, 2.0),
|
||||
blurRadius: 6.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
),
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
),
|
||||
FlatButton(
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
/* FlatButton(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.yellow[300],
|
||||
color: Colors.yellow[50],
|
||||
),
|
||||
Flexible(
|
||||
child: Text(t("Why do you need Exercise Control?"),
|
||||
style: TextStyle(color: Colors.yellow[300], fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
style: TextStyle(color: Colors.yellow[50], fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.yellow[300],
|
||||
color: Colors.yellow[50],
|
||||
),
|
||||
]),
|
||||
textColor: Colors.blueAccent,
|
||||
@@ -103,20 +135,21 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
onPressed: () => {
|
||||
//Navigator.of(context).pushNamed('exerciseTypeDescription', arguments: exerciseBloc.exerciseRepository),
|
||||
},
|
||||
),
|
||||
), */
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(t("Your 1RM:"),
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.yellow[300],
|
||||
fontSize: 18,
|
||||
)),
|
||||
Text(
|
||||
" " +
|
||||
exerciseBloc.initialRM.toStringAsFixed(0) +
|
||||
" " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit,
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontWeight: FontWeight.bold),
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -134,7 +167,7 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
}
|
||||
|
||||
Widget numberPickForm(ExerciseControlBloc exerciseBloc, int step) {
|
||||
String strTimes = step == 2 ? exerciseBloc.origQuantity.toString() : "max.";
|
||||
String strTimes = step == 2 ? exerciseBloc.origQuantity.toStringAsFixed(0) : "max.";
|
||||
String textInstruction = "";
|
||||
textInstruction = t("Please repeat with ") +
|
||||
exerciseBloc.unitQuantity.toStringAsFixed(0) +
|
||||
@@ -149,44 +182,46 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
);
|
||||
|
||||
String title = step.toString() + ". " + t("Control Exercise:");
|
||||
LinkedHashMap args = LinkedHashMap();
|
||||
|
||||
List<Widget> listWidgets = [
|
||||
Text(
|
||||
title,
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontWeight: FontWeight.bold),
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
textInstruction,
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontSize: 12),
|
||||
style: GoogleFonts.inter(color: Colors.yellow[300], fontSize: 16),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
NumberPicker.horizontal(
|
||||
highlightSelectedValue: step == exerciseBloc.step,
|
||||
initialValue: exerciseBloc.quantity.toInt(),
|
||||
minValue: 0,
|
||||
maxValue: 200,
|
||||
step: 1,
|
||||
onChanged: (value) => {exerciseBloc.add(ExerciseControlQuantityChange(quantity: value.toDouble(), step: step))},
|
||||
listViewHeight: 80,
|
||||
textStyleHighlighted: GoogleFonts.archivoBlack(color: Colors.orange[300], fontSize: 24),
|
||||
//decoration: _decoration,
|
||||
),
|
||||
NumberPickerWidget(
|
||||
minValue: 0,
|
||||
maxValue: 200,
|
||||
initalValue: exerciseBloc.quantity.toInt(),
|
||||
unit: t("reps"),
|
||||
color: Colors.yellow[50],
|
||||
onChange: (value) => {exerciseBloc.add(ExerciseControlQuantityChange(quantity: value.toDouble(), step: step))}),
|
||||
FlatButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
//color: step == exerciseBloc.step ? Colors.orange : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {
|
||||
exerciseBloc.add(ExerciseControlSubmit(step: step)),
|
||||
if (step == 3) {confirmationDialog(exerciseBloc)}
|
||||
if (step == 3)
|
||||
{
|
||||
//confirmationDialog(exerciseBloc)
|
||||
Navigator.of(context).pop(),
|
||||
args['exerciseRepository'] = exerciseBloc.exerciseRepository,
|
||||
Navigator.of(context).pushNamed('evaluationPage', arguments: args)
|
||||
}
|
||||
},
|
||||
child: step == exerciseBloc.step
|
||||
? Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Image.asset('asset/icon/gomb_orange_a.png', width: 140, height: 60),
|
||||
Image.asset('asset/icon/gomb_orange_c.png', width: 140, height: 60),
|
||||
Text(
|
||||
t("Save"),
|
||||
style: TextStyle(fontSize: 16, color: Colors.white),
|
||||
@@ -206,6 +241,7 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
|
||||
void confirmationDialog(ExerciseControlBloc bloc) {
|
||||
String unit = t(bloc.exerciseRepository.exerciseType.unit);
|
||||
LinkedHashMap args = LinkedHashMap();
|
||||
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: true,
|
||||
@@ -235,7 +271,11 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text(t("OK")),
|
||||
onPressed: () => {Navigator.of(context).pop(), Navigator.of(context).pop()},
|
||||
onPressed: () => {
|
||||
Navigator.of(context).pop(),
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
Navigator.of(context).pushNamed('evaluationPage', arguments: args)
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
|
||||
@@ -241,11 +241,11 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
style: (TextStyle(color: Colors.blue)),
|
||||
),
|
||||
Text(
|
||||
exercise.quantity.toStringAsFixed(0) +
|
||||
"x" +
|
||||
exercise.unitQuantity.toStringAsFixed(0) +
|
||||
" " +
|
||||
exerciseType.unitQuantityUnit,
|
||||
exercise.quantity.toStringAsFixed(0) + "x" + exercise.unitQuantity.toStringAsFixed(0) + " ",
|
||||
//+
|
||||
//exerciseType.unitQuantityUnit == null
|
||||
// ? ""
|
||||
// : exerciseType.unitQuantityUnit,
|
||||
style: (TextStyle(color: Colors.deepOrange)),
|
||||
),
|
||||
Text(
|
||||
|
||||
+121
-17
@@ -2,8 +2,10 @@ import 'dart:collection';
|
||||
|
||||
import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/exercise_ability.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
import 'package:aitrainer_app/repository/customer_repository.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
@@ -19,6 +21,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:keyboard_actions/keyboard_actions.dart';
|
||||
import 'package:stop_watch_timer/stop_watch_timer.dart';
|
||||
|
||||
class ExerciseNewPage extends StatefulWidget {
|
||||
_ExerciseNewPageState createState() => _ExerciseNewPageState();
|
||||
@@ -132,14 +135,19 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
return SizeWidget(exerciseBloc: exerciseBloc);
|
||||
}
|
||||
|
||||
bool isSecond = false;
|
||||
String exerciseTask = "";
|
||||
if (exerciseBloc.exerciseRepository.exerciseType.is1RM && menuBloc.ability.toString() == ExerciseAbility.oneRepMax.toString()) {
|
||||
exerciseTask = "Please take a relative bigger weight and repeat 12-20 times";
|
||||
exerciseBloc.quantity = 12;
|
||||
} else if (exerciseBloc.exerciseRepository.exerciseType.isEndurance &&
|
||||
menuBloc.ability.toString() == ExerciseAbility.endurance.toString()) {
|
||||
exerciseTask = "Please take a medium weight and repeat 20-30 times";
|
||||
exerciseBloc.quantity = 20;
|
||||
if (exerciseBloc.exerciseRepository.exerciseType.unit != "second") {
|
||||
if (exerciseBloc.exerciseRepository.exerciseType.is1RM() && menuBloc.ability.toString() == ExerciseAbility.oneRepMax.toString()) {
|
||||
exerciseTask = "Please take a relative bigger weight and repeat 12-20 times";
|
||||
exerciseBloc.quantity = 12;
|
||||
} else if (exerciseBloc.exerciseRepository.exerciseType.isEndurance() &&
|
||||
menuBloc.ability.toString() == ExerciseAbility.endurance.toString()) {
|
||||
exerciseTask = "Please take a medium weight and repeat 20-30 times";
|
||||
exerciseBloc.quantity = 20;
|
||||
}
|
||||
} else {
|
||||
isSecond = true;
|
||||
}
|
||||
|
||||
return Form(
|
||||
@@ -159,20 +167,34 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
child: KeyboardActions(
|
||||
config: _buildConfig(context),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 5, left: 55, right: 55),
|
||||
padding: const EdgeInsets.only(top: 25, left: 55, right: 55),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(t('Save Exercise'), style: TextStyle(fontSize: 14, color: Colors.blue[200])),
|
||||
Divider(),
|
||||
Text(
|
||||
exerciseName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.orange),
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
),
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 2,
|
||||
maxLines: 4,
|
||||
softWrap: true,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -235,7 +257,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Image.asset('asset/icon/gomb_orange_a.png', width: 140, height: 60),
|
||||
Image.asset('asset/icon/gomb_orange_c.png', width: 140, height: 60),
|
||||
Text(
|
||||
t("Save"),
|
||||
style: TextStyle(fontSize: 16, color: Colors.white),
|
||||
@@ -280,6 +302,80 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
Column columnQuantity(ExerciseNewBloc bloc) {
|
||||
if (bloc.exerciseRepository.exerciseType.unit == "second") {
|
||||
return Column(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 0),
|
||||
child: StreamBuilder<int>(
|
||||
stream: bloc.stopWatchTimer.rawTime,
|
||||
initialData: bloc.stopWatchTimer.rawTime.value,
|
||||
builder: (context, snap) {
|
||||
final value = snap.data;
|
||||
final displayTime = StopWatchTimer.getDisplayTime(value, hours: false);
|
||||
return Column(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
displayTime,
|
||||
style: const TextStyle(fontSize: 40, fontFamily: 'Helvetica', fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
),
|
||||
]);
|
||||
})),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: IconButton(
|
||||
padding: const EdgeInsets.all(2),
|
||||
color: Colors.white70,
|
||||
//shape: const StadiumBorder(),
|
||||
onPressed: () async {
|
||||
bloc.stopWatchTimer.onExecute.add(StopWatchExecute.start);
|
||||
},
|
||||
icon: Icon(CustomIcon.play_1),
|
||||
iconSize: 40,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: IconButton(
|
||||
padding: const EdgeInsets.all(2),
|
||||
iconSize: 40,
|
||||
color: Colors.white70,
|
||||
//shape: const StadiumBorder(),
|
||||
onPressed: () async {
|
||||
bloc.stopWatchTimer.onExecute.add(StopWatchExecute.stop);
|
||||
},
|
||||
icon: Icon(CustomIcon.stop),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: IconButton(
|
||||
padding: const EdgeInsets.all(2),
|
||||
iconSize: 40,
|
||||
color: Colors.white70,
|
||||
onPressed: () async {
|
||||
bloc.stopWatchTimer.onExecute.add(StopWatchExecute.reset);
|
||||
},
|
||||
icon: Icon(CustomIcon.creative_commons_zero),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Divider(),
|
||||
Text("Or type the time manually:", style: GoogleFonts.inter(color: Colors.white)),
|
||||
TimePickerWidget(
|
||||
onChange: (value) => {bloc.add(ExerciseNewQuantityChange(quantity: value))},
|
||||
)
|
||||
@@ -360,18 +456,26 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
child: Text(t("Yes")),
|
||||
onPressed: () => {
|
||||
bloc.exerciseRepository.setCustomer(Cache().userLoggedIn),
|
||||
bloc.exerciseRepository.addExercise(),
|
||||
bloc.add(ExerciseNewSubmit()),
|
||||
Navigator.pop(context),
|
||||
Navigator.pop(context),
|
||||
if (bloc.exerciseRepository.exerciseType.is1RM && menuBloc.ability.toString() == ExerciseAbility.oneRepMax.toString())
|
||||
print("Ability " +
|
||||
menuBloc.ability.toString() +
|
||||
" exerciseType 1rm " +
|
||||
bloc.exerciseRepository.exerciseType.is1RM().toString()),
|
||||
if (bloc.exerciseRepository.exerciseType.unitQuantityUnit == null)
|
||||
{
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
Navigator.of(context).pushNamed('evaluationPage', arguments: args)
|
||||
}
|
||||
else if (menuBloc.ability.equalsTo(ExerciseAbility.oneRepMax))
|
||||
{
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.75,
|
||||
args['readonly'] = false,
|
||||
Navigator.of(context).pushNamed('exerciseControlPage', arguments: args)
|
||||
}
|
||||
else if (bloc.exerciseRepository.exerciseType.isEndurance &&
|
||||
menuBloc.ability.toString() == ExerciseAbility.endurance.toString())
|
||||
else if (menuBloc.ability.equalsTo(ExerciseAbility.endurance))
|
||||
{
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.50,
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_plan_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -161,7 +160,7 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
|
||||
Text(
|
||||
exerciseName,
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 18, color: Colors.deepOrange),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 18, color: Colors.yellow[200]),
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 3,
|
||||
softWrap: true,
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/treeview_parent_widget.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
|
||||
+33
-13
@@ -1,5 +1,6 @@
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/settings/settings_bloc.dart';
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
@@ -36,20 +37,16 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
if (state is SettingsError) {
|
||||
} else if (state is SettingsReady) {
|
||||
menuBloc.add(MenuRecreateTree());
|
||||
} else if (state is SettingsLoading) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
duration: Duration(milliseconds: 100),
|
||||
backgroundColor: Colors.transparent,
|
||||
content: Container(child: Center(child: CircularProgressIndicator()))));
|
||||
}
|
||||
},
|
||||
// ignore: missing_return
|
||||
builder: (context, state) {
|
||||
if (state is SettingsLoading) {
|
||||
//LoadingDialog.show(context);
|
||||
} else if (state is SettingsInitial) {
|
||||
return settingsUI(context, settingsBloc, menuBloc);
|
||||
} else if (state is SettingsReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
return settingsUI(context, settingsBloc, menuBloc);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
return settingsUI(context, settingsBloc, menuBloc);
|
||||
}),
|
||||
),
|
||||
),
|
||||
@@ -72,11 +69,12 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
onChanged: (String lang) => {
|
||||
settingsBloc.add(SettingsChangeLanguage(language: lang)),
|
||||
})),
|
||||
getServer(),
|
||||
getServer(settingsBloc),
|
||||
getDevice(settingsBloc),
|
||||
]);
|
||||
}
|
||||
|
||||
ListTile getServer() {
|
||||
ListTile getServer(SettingsBloc settingsBloc) {
|
||||
if (Cache().userLoggedIn.admin != 1) {
|
||||
return ListTile(
|
||||
title: Container(),
|
||||
@@ -100,7 +98,29 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
inactiveFgColor: Colors.grey[900],
|
||||
labels: [t('Live-Server'), t('Test-Server')],
|
||||
onToggle: (index) {
|
||||
Cache().setServer(index == 0);
|
||||
//Cache().setServer(index == 0);
|
||||
settingsBloc.add(SettingsSetServer(live: index == 0));
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ListTile getDevice(SettingsBloc settingsBloc) {
|
||||
return ListTile(
|
||||
leading: Icon(CustomIcon.cog),
|
||||
subtitle: Text("Do you have Smart watch, or any device which collects the fit/health data?"),
|
||||
title: ToggleSwitch(
|
||||
minWidth: 120.0,
|
||||
minHeight: 30.0,
|
||||
fontSize: 14.0,
|
||||
initialLabelIndex: Cache().hasHardware ? 0 : 1,
|
||||
activeBgColor: Colors.indigo,
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.white60,
|
||||
inactiveFgColor: Colors.grey[900],
|
||||
labels: [t('Yes'), t('No')],
|
||||
onToggle: (index) {
|
||||
settingsBloc.add(SettingsSetHardware(hasHardware: index == 0));
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user