WT1.1.11 Null-Safe migration
This commit is contained in:
+17
-18
@@ -16,10 +16,10 @@ import 'package:rainbow_color/rainbow_color.dart';
|
||||
import 'dialog_html.dart';
|
||||
|
||||
class AppBarNav extends StatefulWidget implements PreferredSizeWidget {
|
||||
final MenuBloc menuBloc;
|
||||
final bool isMenu;
|
||||
final int depth;
|
||||
const AppBarNav({this.menuBloc, this.isMenu, this.depth});
|
||||
final MenuBloc? menuBloc;
|
||||
final bool? isMenu;
|
||||
final int? depth;
|
||||
AppBarNav({this.menuBloc, this.isMenu, this.depth});
|
||||
|
||||
@override
|
||||
_AppBarNav createState() => _AppBarNav();
|
||||
@@ -29,9 +29,9 @@ class AppBarNav extends StatefulWidget implements PreferredSizeWidget {
|
||||
}
|
||||
|
||||
class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, Common {
|
||||
Animation<Color> colorAnim;
|
||||
AnimationController colorController;
|
||||
MenuBloc menuBloc;
|
||||
late Animation<Color> colorAnim;
|
||||
late AnimationController colorController;
|
||||
late MenuBloc menuBloc;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -83,7 +83,6 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, C
|
||||
children: [
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
//fit: BoxFit.cover,
|
||||
height: 45.0,
|
||||
),
|
||||
getTestServer(),
|
||||
@@ -94,12 +93,12 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, C
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => {
|
||||
timerBloc.add(TimerEnd()),
|
||||
timerBloc.add(TimerEnd(duration: 0)),
|
||||
if (widget.isMenu != null)
|
||||
{
|
||||
if (menuBloc.workoutItem != null)
|
||||
{
|
||||
menuBloc.add(MenuTreeUp(parent: menuBloc.workoutItem.parent)),
|
||||
menuBloc.add(MenuTreeUp(parent: menuBloc.workoutItem!.parent)),
|
||||
}
|
||||
}
|
||||
else if (widget.depth != null)
|
||||
@@ -148,18 +147,18 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, C
|
||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
exerciseRepository.getBaseExerciseFinishedPercent();
|
||||
percent = Cache().getPercentExercises();
|
||||
if (percent == null || percent == -1) {
|
||||
if (percent == -1) {
|
||||
percent = 0;
|
||||
}
|
||||
}
|
||||
if (percent == null || percent.isNaN) {
|
||||
if (percent.isNaN) {
|
||||
percent = 0;
|
||||
}
|
||||
int sizeExerciseList = Cache().getExercises() == null ? 0 : Cache().getExercises().length;
|
||||
int sizeExerciseList = Cache().getExercises() == null ? 0 : Cache().getExercises()!.length;
|
||||
if (sizeExerciseList == 0) {
|
||||
String text = AppLocalizations.of(context).translate("Make your first test");
|
||||
String text = AppLocalizations.of(context)!.translate("Make your first test");
|
||||
double fontSize = text.length > 24 ? 13 : 16;
|
||||
return Stack(alignment: Alignment.topLeft, overflow: Overflow.clip, children: [
|
||||
return Stack(alignment: Alignment.topLeft, children: [
|
||||
GestureDetector(
|
||||
onTap: () => progressExplanation(),
|
||||
child: Text(
|
||||
@@ -178,7 +177,7 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, C
|
||||
lineHeight: 14.0,
|
||||
percent: percent,
|
||||
center: Text(
|
||||
(percent * 100).toStringAsFixed(0) + "% " + AppLocalizations.of(context).translate("finished"),
|
||||
(percent * 100).toStringAsFixed(0) + "% " + AppLocalizations.of(context)!.translate("finished"),
|
||||
style: new TextStyle(fontSize: 10.0),
|
||||
),
|
||||
trailing: Icon(
|
||||
@@ -201,8 +200,8 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, C
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogHTML(
|
||||
title: AppLocalizations.of(context).translate("Progressindicator for the tests"),
|
||||
htmlData: AppLocalizations.of(context).translate("Progressindicator_desc"),
|
||||
title: AppLocalizations.of(context)!.translate("Progressindicator for the tests"),
|
||||
htmlData: AppLocalizations.of(context)!.translate("Progressindicator_desc"),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ class _AppBarNav extends State<AppBarMin> with Common {
|
||||
children: [
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
//fit: BoxFit.cover,
|
||||
height: 45.0,
|
||||
),
|
||||
getTestServer(),
|
||||
@@ -48,7 +47,7 @@ class _AppBarNav extends State<AppBarMin> with Common {
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: widget.back ? Colors.white : Colors.black),
|
||||
onPressed: () => {
|
||||
timerBloc.add(TimerEnd()),
|
||||
timerBloc.add(TimerEnd(duration: 0)),
|
||||
if (widget.back) {Navigator.of(context).pop()}
|
||||
},
|
||||
));
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:liquid_progress_indicator/liquid_progress_indicator.dart';
|
||||
class AppBarProgress extends StatefulWidget implements PreferredSizeWidget {
|
||||
final int max;
|
||||
final int min;
|
||||
const AppBarProgress({this.max, this.min});
|
||||
const AppBarProgress({required this.max, required this.min});
|
||||
|
||||
@override
|
||||
_AppBarNav createState() => _AppBarNav();
|
||||
@@ -18,7 +18,7 @@ class AppBarProgress extends StatefulWidget implements PreferredSizeWidget {
|
||||
}
|
||||
|
||||
class _AppBarNav extends State<AppBarProgress> with SingleTickerProviderStateMixin, Common {
|
||||
AnimationController _animationController;
|
||||
late AnimationController _animationController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -50,7 +50,7 @@ class _AppBarNav extends State<AppBarProgress> with SingleTickerProviderStateMix
|
||||
title: getAnimatedWidget(),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => {timerBloc.add(TimerEnd()), Navigator.of(context).pop()},
|
||||
onPressed: () => {timerBloc.add(TimerEnd(duration: 0)), Navigator.of(context).pop()},
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
|
||||
import 'package:aitrainer_app/util/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';
|
||||
@@ -12,7 +11,7 @@ import 'package:keyboard_actions/keyboard_actions.dart';
|
||||
// ignore: must_be_immutable
|
||||
class BMI extends StatefulWidget {
|
||||
final ExerciseNewBloc exerciseBloc;
|
||||
BMI({this.exerciseBloc});
|
||||
BMI({required this.exerciseBloc});
|
||||
|
||||
@override
|
||||
_BMIState createState() => _BMIState();
|
||||
@@ -37,7 +36,7 @@ class _BMIState extends State<BMI> with Trans {
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Colors.orange[500],
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Done"),
|
||||
AppLocalizations.of(context)!.translate("Done"),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
@@ -55,7 +54,7 @@ class _BMIState extends State<BMI> with Trans {
|
||||
color: Colors.orange,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Done"),
|
||||
AppLocalizations.of(context)!.translate("Done"),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
@@ -147,7 +146,8 @@ class _BMIState extends State<BMI> with Trans {
|
||||
Positioned(
|
||||
top: widget.exerciseBloc.bmiTop,
|
||||
left: widget.exerciseBloc.bmiLeft,
|
||||
child: RotationAnimatedWidget.tween(
|
||||
child:
|
||||
Container() /* RotationAnimatedWidget.tween(
|
||||
enabled: true,
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
rotationDisabled: Rotation.deg(),
|
||||
@@ -155,7 +155,8 @@ class _BMIState extends State<BMI> with Trans {
|
||||
child: Image.asset(
|
||||
"asset/image/BMI_mutato.png",
|
||||
width: 65,
|
||||
)))
|
||||
)) */
|
||||
)
|
||||
]),
|
||||
Divider(color: Colors.transparent),
|
||||
Container(
|
||||
@@ -240,13 +241,13 @@ class _BMIState extends State<BMI> with Trans {
|
||||
}
|
||||
|
||||
Widget getHeightInput() {
|
||||
if (widget.exerciseBloc.customerRepository.customer.birthYear < 2003) {
|
||||
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"),
|
||||
labelText: AppLocalizations.of(context)!.translate("Actual Height"),
|
||||
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
|
||||
fillColor: Colors.black38,
|
||||
filled: true,
|
||||
@@ -283,7 +284,7 @@ class _BMIState extends State<BMI> with Trans {
|
||||
focusNode: _nodeText1,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 15, top: 5, bottom: 5),
|
||||
labelText: AppLocalizations.of(context).translate("Actual Weight"),
|
||||
labelText: AppLocalizations.of(context)!.translate("Actual Weight"),
|
||||
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
|
||||
fillColor: Colors.black38,
|
||||
filled: true,
|
||||
|
||||
+11
-10
@@ -1,8 +1,9 @@
|
||||
import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
|
||||
import 'package:aitrainer_app/library/dropdown_search.dart';
|
||||
//import 'package:aitrainer_app/library/dropdown_search.dart';
|
||||
import 'package:aitrainer_app/util/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/fitness_state.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:dropdown_search/dropdown_search.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@@ -14,7 +15,7 @@ import 'package:keyboard_actions/keyboard_actions.dart';
|
||||
class BMR extends StatefulWidget {
|
||||
final ExerciseNewBloc exerciseBloc;
|
||||
|
||||
BMR({this.exerciseBloc});
|
||||
BMR({required this.exerciseBloc});
|
||||
|
||||
@override
|
||||
_BMRState createState() => _BMRState();
|
||||
@@ -42,7 +43,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Colors.orange[500],
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Done"),
|
||||
AppLocalizations.of(context)!.translate("Done"),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
@@ -57,7 +58,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Colors.orange[500],
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Done"),
|
||||
AppLocalizations.of(context)!.translate("Done"),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
@@ -75,7 +76,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
color: Colors.orange,
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Done"),
|
||||
AppLocalizations.of(context)!.translate("Done"),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
@@ -195,13 +196,13 @@ class _BMRState extends State<BMR> with Trans {
|
||||
}
|
||||
|
||||
Widget getHeightInput() {
|
||||
if (widget.exerciseBloc.customerRepository.customer.birthYear < 2003) {
|
||||
if (widget.exerciseBloc.customerRepository.customer.birthYear! < 2003) {
|
||||
return Flexible(
|
||||
child: TextFormField(
|
||||
focusNode: _nodeText2,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 10, top: 5, bottom: 5),
|
||||
labelText: AppLocalizations.of(context).translate("Actual Height"),
|
||||
labelText: AppLocalizations.of(context)!.translate("Actual Height"),
|
||||
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
|
||||
fillColor: Colors.black38,
|
||||
filled: true,
|
||||
@@ -228,7 +229,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
focusNode: _nodeText3,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 10, top: 5, bottom: 5),
|
||||
labelText: AppLocalizations.of(context).translate("Birth Year"),
|
||||
labelText: AppLocalizations.of(context)!.translate("Birth Year"),
|
||||
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
|
||||
fillColor: Colors.black38,
|
||||
filled: true,
|
||||
@@ -306,7 +307,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _customDropDownItem(BuildContext context, FitnessState item, String itemDesignation) {
|
||||
Widget _customDropDownItem(BuildContext context, FitnessState? item, String itemDesignation) {
|
||||
return Container(
|
||||
child: (item == null)
|
||||
? ListTile(
|
||||
@@ -350,7 +351,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
focusNode: _nodeText1,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 10, top: 5, bottom: 5),
|
||||
labelText: AppLocalizations.of(context).translate("Actual Weight"),
|
||||
labelText: AppLocalizations.of(context)!.translate("Actual Weight"),
|
||||
labelStyle: GoogleFonts.inter(fontSize: 16, color: Colors.yellow[50]),
|
||||
fillColor: Colors.black38,
|
||||
filled: true,
|
||||
|
||||
@@ -14,14 +14,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:modal_progress_hud/modal_progress_hud.dart';
|
||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class BottomBarMultipleExercises extends StatefulWidget {
|
||||
bool isSet = false;
|
||||
final List<ExercisePlanDetail> details;
|
||||
int exerciseTypeId;
|
||||
bool? isSet = false;
|
||||
final List<ExercisePlanDetail>? details;
|
||||
int? exerciseTypeId;
|
||||
|
||||
BottomBarMultipleExercises({this.details, this.isSet, this.exerciseTypeId});
|
||||
@override
|
||||
@@ -33,19 +33,19 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
final Color bgrColorEnd = Colors.blue;
|
||||
final Color active = Colors.black;
|
||||
final Color inactive = Colors.black26;
|
||||
ScrollController _controller;
|
||||
ScrollController? _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
||||
_controller = ScrollController();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
_controller!.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
// ignore: close_sinks
|
||||
final TestSetExecuteBloc bloc = BlocProvider.of<TestSetExecuteBloc>(context);
|
||||
bloc.menuBloc = menuBloc;
|
||||
bloc.setExerciseTypeId(widget.exerciseTypeId);
|
||||
bloc.setExerciseTypeId(widget.exerciseTypeId!);
|
||||
bloc.add(TestSetExecuteLoad());
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -74,7 +74,7 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
height: 90,
|
||||
child: BlocConsumer<TestSetExecuteBloc, TestSetExecuteState>(listener: (context, state) {
|
||||
if (state is TestSetExecuteError) {
|
||||
Scaffold.of(context)
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
@@ -107,8 +107,8 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
}
|
||||
|
||||
List<Widget> getChildren(TestSetExecuteBloc bloc) {
|
||||
final List<Widget> list = List();
|
||||
if (!widget.isSet && !bloc.hasBegun()) {
|
||||
final List<Widget> list = [];
|
||||
if (!widget.isSet! && !bloc.hasBegun()) {
|
||||
list.add(GestureDetector(
|
||||
onTap: () => newExercise(bloc),
|
||||
child: ClipRRect(
|
||||
@@ -131,10 +131,10 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
|
||||
//if (bloc.miniTestSet && widget.isSet || bloc.paralellTest && !widget.isSet) {
|
||||
if (bloc.exercisePlanDetails != null) {
|
||||
bloc.exercisePlanDetails.forEach((element) {
|
||||
bloc.exercisePlanDetails!.forEach((element) {
|
||||
final bool highlighted = element.exerciseTypeId == widget.exerciseTypeId;
|
||||
list.add(getImageStack(element.exerciseType.nameTranslation, bloc, element.exerciseTypeId,
|
||||
bloc.getActualImageName(element.exerciseType.exerciseTypeId),
|
||||
list.add(getImageStack(element.exerciseType!.nameTranslation, bloc, element.exerciseTypeId,
|
||||
bloc.getActualImageName(element.exerciseType!.exerciseTypeId),
|
||||
highlighted: highlighted));
|
||||
});
|
||||
// }
|
||||
@@ -179,11 +179,11 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
),
|
||||
]))),
|
||||
actions: [
|
||||
FlatButton(
|
||||
TextButton(
|
||||
child: Text(t("No")),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
FlatButton(
|
||||
TextButton(
|
||||
child: Text(t("Yes")),
|
||||
onPressed: () => {
|
||||
Navigator.pop(context),
|
||||
@@ -198,7 +198,7 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
}
|
||||
|
||||
void addNewExercise(TestSetExecuteBloc bloc) {
|
||||
WorkoutMenuTree foundMenuItem;
|
||||
WorkoutMenuTree? foundMenuItem;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@@ -207,9 +207,9 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
if (foundMenuItem != null)
|
||||
{
|
||||
bloc.add(TestSetExecuteDeleteActive()),
|
||||
bloc.add(TestSetExecuteNewExercise(exerciseTypeId: widget.exerciseTypeId)),
|
||||
bloc.add(TestSetExecuteNewExercise(exerciseTypeId: foundMenuItem.exerciseTypeId)),
|
||||
Track().track(TrackingEvent.exercise_new_paralell, eventValue: foundMenuItem.exerciseType.name),
|
||||
bloc.add(TestSetExecuteNewExercise(exerciseTypeId: widget.exerciseTypeId!)),
|
||||
bloc.add(TestSetExecuteNewExercise(exerciseTypeId: foundMenuItem!.exerciseTypeId)),
|
||||
Track().track(TrackingEvent.exercise_new_paralell, eventValue: foundMenuItem!.exerciseType!.name),
|
||||
},
|
||||
Navigator.pop(context),
|
||||
},
|
||||
@@ -225,7 +225,7 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
}
|
||||
|
||||
List<Widget> imageSliders(TestSetExecuteBloc bloc) {
|
||||
List<Widget> list = List();
|
||||
List<Widget> list = [];
|
||||
final Widget widget = ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
child: GestureDetector(
|
||||
@@ -265,7 +265,7 @@ class _BottomBarMultipleExercisesState extends State<BottomBarMultipleExercises>
|
||||
//color: Colors.transparent,
|
||||
child: Image.asset(image),
|
||||
)),
|
||||
!widget.isSet && !bloc.hasBegun()
|
||||
!widget.isSet! && !bloc.hasBegun()
|
||||
? Positioned(
|
||||
top: -8,
|
||||
child: GestureDetector(
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
|
||||
// ignore: must_be_immutable
|
||||
class BottomNavigator extends StatefulWidget {
|
||||
int bottomNavIndex = 0;
|
||||
BottomNavigator({this.bottomNavIndex}) {
|
||||
BottomNavigator({required this.bottomNavIndex}) {
|
||||
this.bottomNavIndex = bottomNavIndex;
|
||||
}
|
||||
|
||||
@@ -45,11 +45,10 @@ class _NawDrawerWidget extends State<BottomNavigator> with Trans, Logging {
|
||||
fixedColor: active,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: bgrColor,
|
||||
icon: Common.badgedIcon(inactive, Icons.home, "home"),
|
||||
activeIcon: Common.badgedIcon(active, Icons.home, "home"),
|
||||
title: Text(t("Home"), style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
backgroundColor: bgrColor,
|
||||
icon: Common.badgedIcon(inactive, Icons.home, "home"),
|
||||
activeIcon: Common.badgedIcon(active, Icons.home, "home"),
|
||||
title: Text(t("Home"), style: TextStyle(fontSize: 12))),
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: bgrColor,
|
||||
icon: Common.badgedIcon(inactive, Icons.trending_up, "development"),
|
||||
|
||||
@@ -6,12 +6,20 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
class DialogCommon extends StatefulWidget {
|
||||
final String title, descriptions, text;
|
||||
final VoidCallback onTap;
|
||||
final VoidCallback onCancel;
|
||||
String description2, description3;
|
||||
final Image img;
|
||||
final VoidCallback? onCancel;
|
||||
String? description2, description3;
|
||||
final Image? img;
|
||||
|
||||
DialogCommon(
|
||||
{Key key, this.title, this.descriptions, this.description2, this.description3, this.text, this.img, this.onTap, this.onCancel})
|
||||
{Key? key,
|
||||
required this.title,
|
||||
required this.descriptions,
|
||||
this.description2,
|
||||
this.description3,
|
||||
required this.text,
|
||||
this.img,
|
||||
required this.onTap,
|
||||
required this.onCancel})
|
||||
: super(key: key) {
|
||||
description2 = description2 ?? "";
|
||||
description3 = description3 ?? "";
|
||||
@@ -113,7 +121,7 @@ class _DialogPremiumState extends State<DialogCommon> with Trans {
|
||||
height: 15,
|
||||
),
|
||||
Text(
|
||||
widget.description2,
|
||||
widget.description2!,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
@@ -136,7 +144,7 @@ class _DialogPremiumState extends State<DialogCommon> with Trans {
|
||||
height: 15,
|
||||
),
|
||||
Text(
|
||||
widget.description3,
|
||||
widget.description3!,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
@@ -161,7 +169,7 @@ class _DialogPremiumState extends State<DialogCommon> with Trans {
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: widget.onTap ?? widget.onTap,
|
||||
onTap: widget.onTap,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
@@ -182,7 +190,7 @@ class _DialogPremiumState extends State<DialogCommon> with Trans {
|
||||
if (widget.onCancel == null) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
widget.onCancel();
|
||||
widget.onCancel!();
|
||||
}
|
||||
},
|
||||
child: CircleAvatar(
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
class DialogHTML extends StatefulWidget {
|
||||
final String title;
|
||||
final String htmlData;
|
||||
DialogHTML({Key key, this.title, this.htmlData}) : super(key: key);
|
||||
DialogHTML({Key? key, required this.title, required this.htmlData}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DialogPremiumState createState() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class DialogGDPR extends StatefulWidget {
|
||||
DialogGDPR({Key key}) : super(key: key);
|
||||
DialogGDPR({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DialogPremiumState createState() {
|
||||
|
||||
@@ -8,21 +8,21 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
// ignore: must_be_immutable
|
||||
class DialogPremium extends StatefulWidget {
|
||||
final VoidCallback onTap;
|
||||
final VoidCallback onCancel;
|
||||
String description, function, unlockedText;
|
||||
final VoidCallback? onCancel;
|
||||
String? description, function, unlockedText;
|
||||
final int unlockRound;
|
||||
|
||||
bool unlocked;
|
||||
|
||||
DialogPremium(
|
||||
{Key key,
|
||||
@required this.unlockRound,
|
||||
{Key? key,
|
||||
required this.unlockRound,
|
||||
this.description,
|
||||
this.onTap,
|
||||
required this.onTap,
|
||||
this.onCancel,
|
||||
@required this.unlocked,
|
||||
required this.unlocked,
|
||||
this.unlockedText,
|
||||
@required this.function})
|
||||
required this.function})
|
||||
: super(key: key) {
|
||||
description = description ?? "";
|
||||
function = function ?? "";
|
||||
@@ -36,7 +36,8 @@ class DialogPremium extends StatefulWidget {
|
||||
|
||||
class _DialogPremiumState extends State<DialogPremium> with Trans {
|
||||
bool isStart = true;
|
||||
Timer _timer;
|
||||
late Timer _timer;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
@@ -182,7 +183,7 @@ class _DialogPremiumState extends State<DialogPremium> with Trans {
|
||||
if (widget.onCancel == null) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
widget.onCancel();
|
||||
widget.onCancel!();
|
||||
}
|
||||
},
|
||||
child: CircleAvatar(
|
||||
@@ -221,7 +222,7 @@ class _DialogPremiumState extends State<DialogPremium> with Trans {
|
||||
}
|
||||
|
||||
List<TextSpan> getDescriptionText() {
|
||||
List<TextSpan> list = List();
|
||||
List<TextSpan> list = [];
|
||||
|
||||
if (widget.unlockedText != null) {
|
||||
list.add(TextSpan(text: widget.unlockedText));
|
||||
@@ -231,7 +232,7 @@ class _DialogPremiumState extends State<DialogPremium> with Trans {
|
||||
list.add(TextSpan(text: t(" ")));
|
||||
list.add(
|
||||
TextSpan(
|
||||
text: t(widget.function),
|
||||
text: t(widget.function!),
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -7,9 +7,10 @@ class DialogWidget extends StatefulWidget {
|
||||
final String title, description;
|
||||
final Widget widget;
|
||||
final VoidCallback onTap;
|
||||
final VoidCallback onCancel;
|
||||
final VoidCallback? onCancel;
|
||||
|
||||
DialogWidget({Key key, this.title, this.description, this.widget, this.onTap, this.onCancel}) : super(key: key);
|
||||
DialogWidget({Key? key, required this.title, required this.description, required this.widget, required this.onTap, this.onCancel})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_DialogPremiumState createState() {
|
||||
@@ -112,7 +113,7 @@ class _DialogPremiumState extends State<DialogWidget> with Trans {
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: widget.onTap ?? widget.onTap,
|
||||
onTap: widget.onTap,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
@@ -133,7 +134,7 @@ class _DialogPremiumState extends State<DialogWidget> with Trans {
|
||||
if (widget.onCancel == null) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
widget.onCancel();
|
||||
widget.onCancel!();
|
||||
}
|
||||
},
|
||||
child: CircleAvatar(
|
||||
|
||||
@@ -13,10 +13,10 @@ import 'dialog_html.dart';
|
||||
// ignore: must_be_immutable
|
||||
class ExerciseSave extends StatefulWidget {
|
||||
final ValueChanged<dynamic> onQuantityChanged;
|
||||
final ValueChanged<dynamic> onUnitQuantityChanged;
|
||||
final VoidCallback onSubmit;
|
||||
final ValueChanged<dynamic>? onUnitQuantityChanged;
|
||||
final VoidCallback? onSubmit;
|
||||
final bool hasUnitQuantity;
|
||||
final String unitQuantityUnit;
|
||||
final String? unitQuantityUnit;
|
||||
final String unit;
|
||||
final String exerciseName;
|
||||
final String exerciseDescription;
|
||||
@@ -24,16 +24,16 @@ class ExerciseSave extends StatefulWidget {
|
||||
final int exerciseTypeId;
|
||||
|
||||
ExerciseSave(
|
||||
{this.onQuantityChanged,
|
||||
{required this.onQuantityChanged,
|
||||
this.onUnitQuantityChanged,
|
||||
this.onSubmit,
|
||||
this.hasUnitQuantity,
|
||||
required this.hasUnitQuantity,
|
||||
this.unitQuantityUnit,
|
||||
this.unit,
|
||||
this.exerciseName,
|
||||
this.exerciseDescription,
|
||||
this.exerciseTask,
|
||||
this.exerciseTypeId});
|
||||
required this.unit,
|
||||
required this.exerciseName,
|
||||
required this.exerciseDescription,
|
||||
required this.exerciseTask,
|
||||
required this.exerciseTypeId});
|
||||
@override
|
||||
_ExerciseSaveState createState() => _ExerciseSaveState();
|
||||
}
|
||||
@@ -231,7 +231,7 @@ class _ExerciseSaveState extends State<ExerciseSave> with Trans {
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
/* FlatButton(
|
||||
/* TextButton(
|
||||
onPressed: () {
|
||||
widget.onSubmit();
|
||||
/* showDialog(
|
||||
@@ -265,7 +265,7 @@ class _ExerciseSaveState extends State<ExerciseSave> with Trans {
|
||||
controller: _controller1,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
||||
labelText: t(widget.unitQuantityUnit),
|
||||
labelText: t(widget.unitQuantityUnit!),
|
||||
labelStyle: GoogleFonts.inter(fontSize: 20, color: Colors.yellow[50]),
|
||||
fillColor: Colors.black38,
|
||||
filled: true,
|
||||
@@ -278,7 +278,7 @@ class _ExerciseSaveState extends State<ExerciseSave> with Trans {
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
textInputAction: TextInputAction.done,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 80, color: Colors.yellow[300]),
|
||||
onChanged: (value) => widget.onUnitQuantityChanged(value)),
|
||||
onChanged: (value) => widget.onUnitQuantityChanged!(value)),
|
||||
]);
|
||||
}
|
||||
return row;
|
||||
@@ -291,10 +291,10 @@ class _ExerciseSaveState extends State<ExerciseSave> with Trans {
|
||||
padding: const EdgeInsets.only(bottom: 0),
|
||||
child: StreamBuilder<int>(
|
||||
stream: stopWatchTimer.rawTime,
|
||||
initialData: stopWatchTimer.rawTime.value,
|
||||
initialData: stopWatchTimer.rawTime.valueWrapper?.value,
|
||||
builder: (context, snap) {
|
||||
final value = snap.data;
|
||||
final displayTime = StopWatchTimer.getDisplayTime(value, hours: false);
|
||||
final displayTime = StopWatchTimer.getDisplayTime(value!, hours: false);
|
||||
return Column(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
+9
-11
@@ -14,7 +14,7 @@ import 'loading.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AitrainerHome extends StatefulWidget {
|
||||
_HomePageState _state;
|
||||
late _HomePageState _state;
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
_state = new _HomePageState();
|
||||
@@ -30,22 +30,20 @@ class _HomePageState extends State<AitrainerHome> with Logging {
|
||||
super.initState();
|
||||
|
||||
/// We require the initializers to run after the loading screen is rendered
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
||||
runDelayedEvent();
|
||||
});
|
||||
}
|
||||
|
||||
Future runDelayedEvent() async {
|
||||
await Future.delayed(Duration(seconds: 2), () async {
|
||||
if (context != null) {
|
||||
// ignore: close_sinks
|
||||
SessionBloc sessionBloc = BlocProvider.of<SessionBloc>(context);
|
||||
if (sessionBloc.state != SessionReady()) {
|
||||
// ignore: close_sinks
|
||||
SessionBloc sessionBloc = BlocProvider.of<SessionBloc>(context);
|
||||
if (sessionBloc.state != SessionReady()) {
|
||||
// ignore: close_sinks
|
||||
SettingsBloc settingsBloc = BlocProvider.of<SettingsBloc>(context);
|
||||
settingsBloc.context = context;
|
||||
sessionBloc.add(SessionStart(settingsBloc: settingsBloc));
|
||||
}
|
||||
SettingsBloc settingsBloc = BlocProvider.of<SettingsBloc>(context);
|
||||
settingsBloc.context = context;
|
||||
sessionBloc.add(SessionStart(settingsBloc: settingsBloc));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -56,7 +54,7 @@ class _HomePageState extends State<AitrainerHome> with Logging {
|
||||
key: _scaffoldKey,
|
||||
body: BlocConsumer<SessionBloc, SessionState>(listener: (context, state) {
|
||||
if (state is SessionFailure) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
),
|
||||
|
||||
@@ -9,38 +9,39 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
// ignore: must_be_immutable
|
||||
class ImageButton extends StatelessWidget {
|
||||
final String text;
|
||||
TextStyle style = TextStyle(fontSize: 14);
|
||||
final String image;
|
||||
double top;
|
||||
TextStyle? style = TextStyle(fontSize: 14);
|
||||
final String? image;
|
||||
double? top;
|
||||
final double left;
|
||||
double height;
|
||||
double width;
|
||||
bool isShape;
|
||||
final Bloc bloc;
|
||||
double? height;
|
||||
double? width;
|
||||
bool? isShape;
|
||||
final Bloc? bloc;
|
||||
final Alignment textAlignment;
|
||||
final VoidCallback onTap;
|
||||
bool isLocked;
|
||||
bool isMarked;
|
||||
int buttonIndex;
|
||||
final VoidCallback? onTap;
|
||||
final bool? isLocked;
|
||||
bool? isMarked;
|
||||
int? buttonIndex;
|
||||
|
||||
ImageButton(
|
||||
{this.text,
|
||||
{required this.text,
|
||||
this.style,
|
||||
this.image,
|
||||
required this.image,
|
||||
this.top,
|
||||
this.left,
|
||||
required this.left,
|
||||
this.height,
|
||||
this.width,
|
||||
this.bloc,
|
||||
this.isShape,
|
||||
this.textAlignment,
|
||||
required this.textAlignment,
|
||||
this.onTap,
|
||||
this.buttonIndex,
|
||||
this.isMarked,
|
||||
@required this.isLocked}) {
|
||||
required this.isLocked}) {
|
||||
width = width ?? 180;
|
||||
height = height ?? 180;
|
||||
isMarked = isMarked ?? false;
|
||||
isShape = isShape ?? false;
|
||||
style = style ??
|
||||
GoogleFonts.archivoBlack(
|
||||
fontSize: 14,
|
||||
@@ -50,19 +51,25 @@ class ImageButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (top == null) {
|
||||
top = height - (style.fontSize - 5) * text.length - 2 * left < 0 ? height - 2 * style.fontSize - 22 : height - style.fontSize - 37;
|
||||
top = height! - (style!.fontSize! - 5) * text.length - 2 * left < 0
|
||||
? height! - 2 * style!.fontSize! - 22
|
||||
: height! - style!.fontSize! - 37;
|
||||
//print("Top: " + top.toStringAsFixed(0) + " length: " + ((style.fontSize - 5) * text.length).toString());
|
||||
}
|
||||
final double width = MediaQuery.of(context).size.width;
|
||||
//print("Mediawidth: " + width.toStringAsFixed(0));
|
||||
return Stack(alignment: AlignmentDirectional.bottomStart, children: [
|
||||
FlatButton(
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
shape: getShape(isShape!),
|
||||
),
|
||||
child: image == null
|
||||
? _getButtonImage("asset/image/WT_menu_dark.jpg")
|
||||
: isMarked
|
||||
: isMarked!
|
||||
? Stack(
|
||||
children: [
|
||||
_getButtonImage(image),
|
||||
_getButtonImage(image!),
|
||||
Container(
|
||||
width: width,
|
||||
height: height,
|
||||
@@ -75,9 +82,7 @@ class ImageButton extends StatelessWidget {
|
||||
)
|
||||
],
|
||||
)
|
||||
: _getButtonImage(image),
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
shape: getShape(isShape),
|
||||
: _getButtonImage(image!),
|
||||
onPressed: onTap ?? onTap,
|
||||
),
|
||||
Container(
|
||||
@@ -109,7 +114,7 @@ class ImageButton extends StatelessWidget {
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: (width / 2 - 30) / 2 - 75,
|
||||
child: !isLocked
|
||||
child: !isLocked!
|
||||
? Offstage()
|
||||
: GestureDetector(
|
||||
child: Image.asset(
|
||||
@@ -126,7 +131,7 @@ class ImageButton extends StatelessWidget {
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: (width / 2 - 30) / 2 - 75,
|
||||
child: isMarked
|
||||
child: isMarked!
|
||||
? GestureDetector(
|
||||
child: Image.asset(
|
||||
'asset/image/haken.png',
|
||||
|
||||
@@ -15,7 +15,7 @@ class InputDialog<Event> extends StatefulWidget {
|
||||
|
||||
final String subtitle;
|
||||
|
||||
const InputDialog({this.onChanged, this.initialValue, this.title, this.subtitle});
|
||||
const InputDialog({required this.onChanged, required this.initialValue, required this.title, required this.subtitle});
|
||||
|
||||
@override
|
||||
_InputDialogState<Event> createState() => _InputDialogState<Event>();
|
||||
@@ -165,25 +165,29 @@ class _InputDialogState<Event> extends State<InputDialog<Event>> with Trans {
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.black26,
|
||||
onSurface: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(t('Cancel')),
|
||||
color: Colors.black26,
|
||||
textColor: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.orange[600],
|
||||
onSurface: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
widget.onChanged(this.inputValue);
|
||||
return Navigator.of(context).pop(true);
|
||||
},
|
||||
child: Text(t('Save')),
|
||||
color: Colors.orange[600],
|
||||
textColor: Colors.white,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
@@ -2,20 +2,20 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:aitrainer_app/library/image_cache.dart' as wt;
|
||||
import 'package:transparent_image/transparent_image.dart';
|
||||
import 'package:aitrainer_app/library/transparent_image.dart';
|
||||
|
||||
class MenuImage extends StatelessWidget {
|
||||
final int workoutTreeId;
|
||||
final int? workoutTreeId;
|
||||
final String imageName;
|
||||
const MenuImage({this.workoutTreeId, this.imageName});
|
||||
const MenuImage({required this.workoutTreeId, required this.imageName});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (workoutTreeId == null) {
|
||||
return Offstage();
|
||||
}
|
||||
String imageString = this.getImage(workoutTreeId, imageName);
|
||||
Widget widget;
|
||||
String? imageString = this.getImage(workoutTreeId!, imageName);
|
||||
Widget? widget;
|
||||
if (imageString != null) {
|
||||
widget = ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
@@ -29,7 +29,7 @@ class MenuImage extends StatelessWidget {
|
||||
));
|
||||
} else {
|
||||
if (imageName.contains("https")) {
|
||||
if (!wt.ImageCache().existsImageInMap(workoutTreeId, imageName)) {
|
||||
if (!wt.ImageCache().existsImageInMap(workoutTreeId!, imageName)) {
|
||||
widget = ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
child: Container(
|
||||
@@ -56,8 +56,8 @@ class MenuImage extends StatelessWidget {
|
||||
return widget;
|
||||
}
|
||||
|
||||
String getImage(int id, String name) {
|
||||
String imageString;
|
||||
String? getImage(int id, String name) {
|
||||
String? imageString;
|
||||
if (name.contains("http")) {
|
||||
imageString = wt.ImageCache().getImageString(id, name);
|
||||
}
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MenuInfoWidget extends StatelessWidget with Common {
|
||||
final String title;
|
||||
final double titleSize;
|
||||
final Color titleColor;
|
||||
final FontWeight titleWeight;
|
||||
final String text;
|
||||
final double textSize;
|
||||
final Color textColor;
|
||||
final FontWeight textWeight;
|
||||
final Icon leadingIcon;
|
||||
final Color leadingIconColor;
|
||||
final String text2;
|
||||
final String text3;
|
||||
final String link;
|
||||
final int parentMenu;
|
||||
final MenuBloc bloc;
|
||||
|
||||
MenuInfoWidget(
|
||||
{this.title,
|
||||
this.titleSize,
|
||||
this.titleColor,
|
||||
this.titleWeight,
|
||||
@required this.text,
|
||||
this.textSize,
|
||||
this.textColor,
|
||||
this.textWeight,
|
||||
this.leadingIcon,
|
||||
this.leadingIconColor,
|
||||
this.text2,
|
||||
this.text3,
|
||||
this.link,
|
||||
this.parentMenu,
|
||||
this.bloc});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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(16.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), bloc.add(MenuTreeJump(parent: missingId))});
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import 'dialog_html.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MenuPageWidget extends StatefulWidget {
|
||||
int parent;
|
||||
int? parent;
|
||||
|
||||
MenuPageWidget({this.parent});
|
||||
|
||||
@@ -38,7 +38,7 @@ class MenuPageWidget extends StatefulWidget {
|
||||
class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
final double baseWidth = 312;
|
||||
final double baseHeight = 675.2;
|
||||
MenuBloc menuBloc;
|
||||
late MenuBloc menuBloc;
|
||||
final scrollController = ScrollController();
|
||||
final bool activeExercisePlan = Cache().activeExercisePlan != null;
|
||||
final EzAnimation animation = EzAnimation(35.0, 10.0, Duration(seconds: 2), reverseCurve: Curves.linear);
|
||||
@@ -58,7 +58,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
}
|
||||
|
||||
/// We require the initializers to run after the loading screen is rendered
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
||||
menuBloc.add(MenuCreate());
|
||||
});
|
||||
|
||||
@@ -79,15 +79,19 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
double cWidth = MediaQuery.of(context).size.width;
|
||||
double cHeight = MediaQuery.of(context).size.height;
|
||||
|
||||
if (widget.parent == null) {
|
||||
widget.parent = 0;
|
||||
}
|
||||
|
||||
return CustomScrollView(
|
||||
// Must add scrollController to sliver root
|
||||
controller: scrollController,
|
||||
scrollDirection: Axis.vertical,
|
||||
slivers: buildMenuColumn(widget.parent, context, menuBloc, cWidth, cHeight));
|
||||
slivers: buildMenuColumn(widget.parent!, context, menuBloc, cWidth, cHeight));
|
||||
}
|
||||
|
||||
List<Widget> buildMenuColumn(int parent, BuildContext context, MenuBloc menuBloc, double cWidth, double cHeight) {
|
||||
final List<Widget> slivers = List();
|
||||
final List<Widget> slivers = [];
|
||||
|
||||
bool isChild = menuBloc.menuTreeRepository.isChildAndGym(menuBloc.parent);
|
||||
if (!isChild) {
|
||||
@@ -97,14 +101,14 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
slivers.add(getFilterElements(menuBloc));
|
||||
}
|
||||
|
||||
final List<Widget> _columnChildren = List();
|
||||
final List<Widget> _columnChildren = [];
|
||||
|
||||
if (menuBloc.getFilteredBranch(menuBloc.parent).isEmpty) {
|
||||
_columnChildren.add(Container(
|
||||
padding: EdgeInsets.only(top: 15.0),
|
||||
child: Center(
|
||||
child: Stack(alignment: Alignment.bottomLeft, children: [
|
||||
Text(AppLocalizations.of(context).translate("All Exercises has been filtered out"),
|
||||
Text(AppLocalizations.of(context)!.translate("All Exercises has been filtered out"),
|
||||
style: GoogleFonts.inter(color: Colors.white)),
|
||||
]))));
|
||||
} else {
|
||||
@@ -118,9 +122,9 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
position: BadgePosition.bottomEnd(end: 0),
|
||||
animationDuration: Duration(milliseconds: 500),
|
||||
animationType: BadgeAnimationType.slide,
|
||||
badgeColor: Colors.orange[800],
|
||||
badgeColor: Colors.orange[800]!,
|
||||
showBadge: workoutTree.base,
|
||||
badgeContent: Text(AppLocalizations.of(context).translate("base"),
|
||||
badgeContent: Text(AppLocalizations.of(context)!.translate("base"),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
@@ -129,7 +133,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
showBadge: workoutTree.nameEnglish == "One Rep Max" || workoutTree.nameEnglish == "Endurance",
|
||||
animationDuration: Duration(milliseconds: 800),
|
||||
animationType: BadgeAnimationType.fade,
|
||||
badgeColor: Colors.blue[100],
|
||||
badgeColor: Colors.blue[100]!,
|
||||
badgeContent: GestureDetector(
|
||||
onTap: () => {
|
||||
showDialog(
|
||||
@@ -138,16 +142,15 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
return DialogHTML(
|
||||
title: workoutTree.name,
|
||||
htmlData: workoutTree.nameEnglish == "Endurance"
|
||||
? AppLocalizations.of(context).translate("Endurance_desc")
|
||||
: AppLocalizations.of(context).translate("OneRepMax_desc"),
|
||||
? AppLocalizations.of(context)!.translate("Endurance_desc")
|
||||
: AppLocalizations.of(context)!.translate("OneRepMax_desc"),
|
||||
);
|
||||
})
|
||||
},
|
||||
child: Icon(Icons.info_outline_rounded)),
|
||||
child: Stack(alignment: Alignment.bottomLeft, children: [
|
||||
FlatButton(
|
||||
TextButton(
|
||||
child: badgedIcon(workoutTree, cWidth, cHeight),
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
||||
),
|
||||
/* Container(
|
||||
@@ -197,7 +200,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
delegate: SliverChildListDelegate([
|
||||
Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).translate("Equipment Filter"),
|
||||
AppLocalizations.of(context)!.translate("Equipment Filter"),
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 24,
|
||||
@@ -229,7 +232,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
}
|
||||
|
||||
SliverGrid getFilterElements(MenuBloc menuBloc) {
|
||||
List<Widget> list = List();
|
||||
List<Widget> list = [];
|
||||
|
||||
menuBloc.exerciseDeviceRepository.getGymDevices().forEach((element) {
|
||||
String deviceName = AppLanguage().appLocal == Locale('en') ? element.name : element.nameTranslation;
|
||||
@@ -299,11 +302,11 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
listItems: menuBloc.menuTreeRepository.menuAsExercise,
|
||||
onFind: (value) {
|
||||
if (Cache().userLoggedIn == null) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
backgroundColor: Colors.orange,
|
||||
content: Text(AppLocalizations.of(context).translate('Please log in'), style: TextStyle(color: Colors.white))));
|
||||
content: Text(AppLocalizations.of(context)!.translate('Please log in'), style: TextStyle(color: Colors.white))));
|
||||
} else {
|
||||
Track().track(TrackingEvent.search, eventValue: value.exerciseType.name);
|
||||
Track().track(TrackingEvent.search, eventValue: value.exerciseType!.name);
|
||||
menuBloc.ability = ExerciseAbility.oneRepMax;
|
||||
Navigator.of(context).pushNamed('exerciseNewPage', arguments: value.exerciseType);
|
||||
}
|
||||
@@ -348,12 +351,12 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
|
||||
void menuClick(WorkoutMenuTree workoutTree, MenuBloc menuBloc, BuildContext context) {
|
||||
if (Cache().userLoggedIn == null) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
backgroundColor: Colors.orange,
|
||||
content: Text(AppLocalizations.of(context).translate('Please log in'), style: TextStyle(color: Colors.white))));
|
||||
content: Text(AppLocalizations.of(context)!.translate('Please log in'), style: TextStyle(color: Colors.white))));
|
||||
} else {
|
||||
if (workoutTree.child == false) {
|
||||
if (ExerciseAbility.mini_test_set.equalsTo(menuBloc.ability) && workoutTree.parent != 0) {
|
||||
if (menuBloc.ability != null && ExerciseAbility.mini_test_set.equalsTo(menuBloc.ability!) && workoutTree.parent != 0) {
|
||||
HashMap args = HashMap();
|
||||
args['templateName'] = workoutTree.nameEnglish;
|
||||
args['templateNameTranslation'] = workoutTree.name;
|
||||
@@ -363,7 +366,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
} else {
|
||||
menuBloc.add(MenuClickExercise(exerciseTypeId: workoutTree.id));
|
||||
|
||||
if (workoutTree.exerciseType.name == "Custom" && Cache().userLoggedIn.admin == 1) {
|
||||
if (workoutTree.exerciseType!.name == "Custom" && Cache().userLoggedIn!.admin == 1) {
|
||||
Navigator.of(context).pushNamed('exerciseCustomPage', arguments: workoutTree.exerciseType);
|
||||
} else {
|
||||
Navigator.of(context).pushNamed('exerciseNewPage', arguments: workoutTree.exerciseType);
|
||||
@@ -399,11 +402,7 @@ class _MenuPageWidgetState extends State<MenuPageWidget> with Trans, Logging {
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
)),
|
||||
child: buttonImage == null
|
||||
? Container(
|
||||
color: Colors.transparent,
|
||||
)
|
||||
: buttonImage,
|
||||
child: buttonImage,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ import 'dart:async';
|
||||
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/library/dropdown_search.dart';
|
||||
import 'package:dropdown_search/dropdown_search.dart';
|
||||
//import 'package:aitrainer_app/library/dropdown_search.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
@@ -25,10 +26,10 @@ class SearchBarStream {
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MenuSearchBar extends StatelessWidget {
|
||||
final List listItems;
|
||||
final List<WorkoutMenuTree> listItems;
|
||||
final Function(WorkoutMenuTree) onFind;
|
||||
bool showIcon;
|
||||
MenuSearchBar({@required this.listItems, this.onFind, this.showIcon = true});
|
||||
MenuSearchBar({required this.listItems, required this.onFind, this.showIcon = true});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -42,11 +43,11 @@ class MenuSearchBar extends StatelessWidget {
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AnimatedSearch extends StatefulWidget {
|
||||
final List listItems;
|
||||
final List<WorkoutMenuTree> listItems;
|
||||
final Function(WorkoutMenuTree) onFind;
|
||||
bool showIcon = true;
|
||||
|
||||
AnimatedSearch({this.listItems, this.onFind, this.showIcon});
|
||||
AnimatedSearch({required this.listItems, required this.onFind, required this.showIcon});
|
||||
|
||||
@override
|
||||
_AnimatedSearch createState() => _AnimatedSearch();
|
||||
@@ -117,10 +118,10 @@ class _AnimatedSearch extends State<AnimatedSearch> {
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class Search extends StatelessWidget with Trans {
|
||||
final List listItems;
|
||||
final List<WorkoutMenuTree> listItems;
|
||||
final Function(WorkoutMenuTree) onFind;
|
||||
|
||||
Search({this.listItems, this.onFind});
|
||||
Search({required this.listItems, required this.onFind});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -193,7 +194,7 @@ class Search extends StatelessWidget with Trans {
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.inter(color: Colors.yellow[200], fontSize: 16),
|
||||
)),
|
||||
dropdownBuilder: (context, WorkoutMenuTree item, itemDesignation) => Container(
|
||||
dropdownBuilder: (context, WorkoutMenuTree? item, itemDesignation) => Container(
|
||||
child: ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [
|
||||
(item == null)
|
||||
? Container(
|
||||
@@ -224,8 +225,8 @@ class AnimateExpansion extends StatefulWidget {
|
||||
final double axisAlignment;
|
||||
AnimateExpansion({
|
||||
this.animate = false,
|
||||
this.axisAlignment,
|
||||
this.child,
|
||||
required this.axisAlignment,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -233,8 +234,8 @@ class AnimateExpansion extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AnimateExpansionState extends State<AnimateExpansion> with SingleTickerProviderStateMixin {
|
||||
AnimationController _animationController;
|
||||
Animation<double> _animation;
|
||||
late AnimationController _animationController;
|
||||
late Animation<double> _animation;
|
||||
|
||||
void prepareAnimations() {
|
||||
_animationController = AnimationController(
|
||||
|
||||
@@ -10,9 +10,17 @@ class NumberPickerWidget extends StatefulWidget {
|
||||
final int initalValue;
|
||||
final String unit;
|
||||
final Color color;
|
||||
double fontSize;
|
||||
double? fontSize;
|
||||
|
||||
NumberPickerWidget({Key key, this.minValue, this.maxValue, this.initalValue, this.unit, this.fontSize, this.color, this.onChange})
|
||||
NumberPickerWidget(
|
||||
{Key? key,
|
||||
required this.minValue,
|
||||
required this.maxValue,
|
||||
required this.initalValue,
|
||||
required this.unit,
|
||||
this.fontSize,
|
||||
required this.color,
|
||||
required this.onChange})
|
||||
: super(key: key) {
|
||||
fontSize = fontSize ?? 20;
|
||||
}
|
||||
@@ -21,7 +29,7 @@ class NumberPickerWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _NumberPickerWidgetState extends State<NumberPickerWidget> with Trans {
|
||||
FixedExtentScrollController _scrollController;
|
||||
late FixedExtentScrollController _scrollController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -4,30 +4,30 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class SalesButton extends StatelessWidget {
|
||||
TextStyle style = TextStyle(fontSize: 14);
|
||||
TextStyle? style;
|
||||
TextStyle descStyle = TextStyle(fontSize: 14);
|
||||
final String title;
|
||||
final String price;
|
||||
final String desc1;
|
||||
final String desc2;
|
||||
final String desc3;
|
||||
String desc4;
|
||||
final String badgeText;
|
||||
String? desc4;
|
||||
final String? badgeText;
|
||||
final Color badgeColor;
|
||||
final VoidCallback onTap;
|
||||
|
||||
SalesButton(
|
||||
{this.title,
|
||||
this.price,
|
||||
this.desc1,
|
||||
this.desc2,
|
||||
this.desc3,
|
||||
{required this.title,
|
||||
required this.price,
|
||||
required this.desc1,
|
||||
required this.desc2,
|
||||
required this.desc3,
|
||||
this.desc4,
|
||||
this.badgeText,
|
||||
this.badgeColor,
|
||||
this.onTap,
|
||||
this.style,
|
||||
this.descStyle}) {
|
||||
required this.badgeColor,
|
||||
required this.onTap,
|
||||
required this.style,
|
||||
required this.descStyle}) {
|
||||
style = style ??
|
||||
GoogleFonts.archivoBlack(
|
||||
fontSize: 14,
|
||||
@@ -53,7 +53,7 @@ class SalesButton extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
shape: BadgeShape.square,
|
||||
badgeContent: badgeText != null
|
||||
? Text(badgeText,
|
||||
? Text(badgeText!,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
backgroundColor: badgeColor,
|
||||
@@ -89,7 +89,7 @@ class SalesButton extends StatelessWidget {
|
||||
Container(padding: EdgeInsets.only(left: 3, right: 3, bottom: 4), child: Text(desc3, maxLines: 2, style: descStyle)),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 3, right: 3),
|
||||
child: Text(desc4, maxLines: 2, style: GoogleFonts.inter(fontSize: 10, color: Colors.red[800])))
|
||||
child: Text(desc4!, maxLines: 2, style: GoogleFonts.inter(fontSize: 10, color: Colors.red[800])))
|
||||
],
|
||||
),
|
||||
)),
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'input_dialog_widget.dart';
|
||||
class SizeWidget extends StatefulWidget {
|
||||
final ExerciseNewBloc exerciseBloc;
|
||||
|
||||
SizeWidget({this.exerciseBloc});
|
||||
SizeWidget({required this.exerciseBloc});
|
||||
|
||||
@override
|
||||
_SizeState createState() => _SizeState();
|
||||
@@ -54,7 +54,7 @@ class _SizeState extends State<SizeWidget> with Trans {
|
||||
double mediaHeight = MediaQuery.of(context).size.height * .8;
|
||||
//print("w " + mediaWidth.toString() + "h " + mediaHeight.toString());
|
||||
widget.exerciseBloc.customerRepository.setMediaDimensions(mediaWidth, mediaHeight);
|
||||
List<Widget> list = List();
|
||||
List<Widget> list = [];
|
||||
list.add(GestureDetector(
|
||||
onTap: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())},
|
||||
child: SizedBox(
|
||||
@@ -76,13 +76,14 @@ class _SizeState extends State<SizeWidget> with Trans {
|
||||
),
|
||||
);
|
||||
list.add(Positioned(
|
||||
top: widget.exerciseBloc.customerRepository.getWeightCoordinate(widget.exerciseBloc.customerRepository.isMan, isTop: true).toDouble(),
|
||||
top:
|
||||
widget.exerciseBloc.customerRepository.getWeightCoordinate(widget.exerciseBloc.customerRepository.isMan, isTop: true)!.toDouble(),
|
||||
left: widget.exerciseBloc.customerRepository
|
||||
.getWeightCoordinate(widget.exerciseBloc.customerRepository.isMan, isTop: false, isLeft: true)
|
||||
.getWeightCoordinate(widget.exerciseBloc.customerRepository.isMan, isTop: false, isLeft: true)!
|
||||
.toDouble() -
|
||||
45,
|
||||
child: GestureDetector(
|
||||
onTap: () => onPressed(widget.exerciseBloc.customerRepository.getPropertyByName("Weight")),
|
||||
onTap: () => onPressed(widget.exerciseBloc.customerRepository.getPropertyByName("Weight")!),
|
||||
child: Image.asset(
|
||||
"asset/image/merleg.png",
|
||||
height: 120,
|
||||
@@ -130,13 +131,13 @@ class _SizeState extends State<SizeWidget> with Trans {
|
||||
}
|
||||
|
||||
List<Widget> getSizeElements() {
|
||||
List<Widget> list = List();
|
||||
List<Widget> list = [];
|
||||
|
||||
widget.exerciseBloc.customerRepository.manSizes.forEach((element) {
|
||||
list.add(
|
||||
Positioned(
|
||||
top: element.top.toDouble(),
|
||||
left: element.left.toDouble(),
|
||||
top: element.top!.toDouble(),
|
||||
left: element.left!.toDouble(),
|
||||
child: element.value != 0
|
||||
? Container(
|
||||
width: 20,
|
||||
@@ -186,7 +187,7 @@ class _SizeState extends State<SizeWidget> with Trans {
|
||||
builder: (context) => InputDialog(
|
||||
title: t("Size Of Your"),
|
||||
subtitle: element.propertyNameTranslation,
|
||||
initialValue: element.value,
|
||||
initialValue: element.value!,
|
||||
onChanged: (value) {
|
||||
widget.exerciseBloc.add(ExerciseNewSizeChange(propertyName: element.propertyName, value: value));
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
|
||||
class TimePickerWidget extends StatefulWidget {
|
||||
final Function(double) onChange;
|
||||
|
||||
const TimePickerWidget({Key key, this.onChange}) : super(key: key);
|
||||
const TimePickerWidget({Key? key, required this.onChange}) : super(key: key);
|
||||
@override
|
||||
_TimePickerWidgetState createState() => _TimePickerWidgetState();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class TimerWidget extends StatelessWidget {
|
||||
final TimerBloc bloc;
|
||||
const TimerWidget({this.bloc});
|
||||
const TimerWidget({required this.bloc});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -5,16 +5,16 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
class TreeviewParentWidget extends StatelessWidget {
|
||||
final String text;
|
||||
final Color backgroundColor;
|
||||
final Color color;
|
||||
final Color? color;
|
||||
//final DateTime lastModified;
|
||||
|
||||
TreeviewParentWidget({@required this.text, this.backgroundColor = Colors.white38, this.color});
|
||||
TreeviewParentWidget({required this.text, this.backgroundColor = Colors.white38, this.color});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget parentWidget = Text(
|
||||
this.text,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 24, color: color ?? Colors.blue[800], backgroundColor: Colors.transparent),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 24, color: color ?? Colors.blue[800]!, backgroundColor: Colors.transparent),
|
||||
);
|
||||
|
||||
Icon icon = Icon(Icons.person);
|
||||
|
||||
@@ -11,12 +11,12 @@ class VictoryConfetti extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _VictoryConfettiState extends State<VictoryConfetti> {
|
||||
ConfettiController _controllerBottomCenter;
|
||||
late ConfettiController _controllerBottomCenter;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controllerBottomCenter = ConfettiController(duration: const Duration(seconds: 2));
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
||||
Future.delayed(Duration(milliseconds: 500)).then((value) => _controllerBottomCenter.play());
|
||||
});
|
||||
super.initState();
|
||||
@@ -68,14 +68,14 @@ class _VictoryConfettiState extends State<VictoryConfetti> {
|
||||
}
|
||||
|
||||
class Victory extends StatefulWidget {
|
||||
final bool victory;
|
||||
final bool? victory;
|
||||
const Victory({this.victory});
|
||||
@override
|
||||
_VictoryState createState() => _VictoryState();
|
||||
}
|
||||
|
||||
class _VictoryState extends State<Victory> {
|
||||
final EzAnimation animation = EzAnimation(1.0, 200.0, Duration(seconds: 3), reverseCurve: null);
|
||||
final EzAnimation animation = EzAnimation(1.0, 200.0, Duration(seconds: 3), reverseCurve: Curves.easeIn);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -101,7 +101,7 @@ class _VictoryState extends State<Victory> {
|
||||
height: animation.value,
|
||||
child: Row(children: [
|
||||
VictoryConfetti(),
|
||||
widget.victory ? Image.asset("asset/image/WT_cup_victory400.png") : Offstage(),
|
||||
widget.victory != null && widget.victory == true ? Image.asset("asset/image/WT_cup_victory400.png") : Offstage(),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user