wt1.1d custom exercise, mydevelopment exercise list, environment for different databases
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:aitrainer_app/animations/test_progress_animation.dart';
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -29,9 +30,9 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
||||
//AnimationController sizeController;
|
||||
MenuBloc menuBloc;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
colorController =
|
||||
AnimationController(duration: Duration(seconds: 4), vsync: this);
|
||||
//sizeController =
|
||||
@@ -68,8 +69,10 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
||||
..addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
Timer(Duration(seconds: 10), () {
|
||||
colorController.reset();
|
||||
colorController.forward();
|
||||
//colorController.reset();
|
||||
if ( mounted ) {
|
||||
colorController.forward();
|
||||
}
|
||||
});
|
||||
} else if (status == AnimationStatus.dismissed) {
|
||||
colorController.forward();
|
||||
@@ -114,9 +117,14 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
||||
}
|
||||
|
||||
Widget getAnimatedWidget() {
|
||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
exerciseRepository.getExerciseList();
|
||||
if ( exerciseRepository.exerciseList == null || exerciseRepository.exerciseList.length == 0 ) {
|
||||
double percent = Cache().getPercentExercises();
|
||||
if ( percent == -1) {
|
||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
exerciseRepository.getBaseExerciseFinishedPercent();
|
||||
percent = Cache().getPercentExercises();
|
||||
}
|
||||
int sizeExerciseList = Cache().getExercises() == null? 0 : Cache().getExercises().length;
|
||||
if ( sizeExerciseList == 0 ) {
|
||||
return Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
@@ -128,7 +136,7 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
||||
]
|
||||
);
|
||||
} else {
|
||||
double percent = 0.61;//exerciseRepository.getBaseExerciseFinishedPercent();
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
|
||||
+72
-41
@@ -1,6 +1,8 @@
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gradient_bottom_navigation_bar/gradient_bottom_navigation_bar.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class BottomNavigator extends StatefulWidget {
|
||||
int bottomNavIndex = 0;
|
||||
BottomNavigator({this.bottomNavIndex}) {
|
||||
@@ -21,68 +23,97 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Color bgrColor = Color(0xffb4f500);
|
||||
final Color bgrColorEnd = Colors.blue;
|
||||
final Color active = Colors.black;
|
||||
final Color inactive = Colors.black26;
|
||||
|
||||
return BottomNavigationBar(
|
||||
/*final Color bgrColor = Colors.black;
|
||||
final Color active = Colors.yellowAccent;
|
||||
final Color inactive = Colors.white60;*/
|
||||
//
|
||||
|
||||
return GradientBottomNavigationBar(
|
||||
currentIndex: widget.bottomNavIndex, // this will be set when a new tab is tapped
|
||||
backgroundColor: Colors.transparent,
|
||||
selectedItemColor: Colors.yellow,
|
||||
unselectedItemColor: Colors.lightGreen,
|
||||
//type: BottomNavigationBarType.shifting,
|
||||
showSelectedLabels: true,
|
||||
showUnselectedLabels: true,
|
||||
backgroundColorStart: bgrColorEnd,
|
||||
backgroundColorEnd: bgrColor,
|
||||
fixedColor: active,
|
||||
//selectedItemColor: active,
|
||||
//unselectedItemColor: inactive,
|
||||
//showSelectedLabels: true,
|
||||
//showUnselectedLabels: true,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: Colors.black12,
|
||||
icon: new Icon(Icons.home, color: Colors.lightGreen),
|
||||
activeIcon: new Icon(Icons.home, color: Colors.yellow,),
|
||||
title: new Text(AppLocalizations.of(context).translate("Home")),
|
||||
backgroundColor: bgrColor,
|
||||
icon: new Icon(Icons.home, color: inactive),
|
||||
activeIcon: new Icon(Icons.home, color: active,),
|
||||
title: new Text(AppLocalizations.of(context).translate("Home"),
|
||||
style: TextStyle(fontSize: 9)),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: Colors.black12,
|
||||
icon: new Icon(Icons.confirmation_number, color: Colors.lightGreen),
|
||||
activeIcon: new Icon(Icons.event, color: Colors.yellow,),
|
||||
title: new Text(AppLocalizations.of(context).translate("Events")),
|
||||
backgroundColor: bgrColor,
|
||||
icon: new Icon(Icons.trending_up, color: inactive),
|
||||
activeIcon: new Icon(Icons.trending_up, color: active,),
|
||||
title: new Text(AppLocalizations.of(context).translate("My Development"),
|
||||
style: TextStyle(fontSize: 9),),
|
||||
),
|
||||
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: Colors.black12,
|
||||
icon: Icon(Icons.person, color: Colors.lightGreen,),
|
||||
activeIcon: new Icon(Icons.person, color: Colors.yellow,),
|
||||
title: Text(AppLocalizations.of(context).translate("Account"))
|
||||
backgroundColor: bgrColor,
|
||||
icon: new Icon(Icons.featured_play_list, color: inactive),
|
||||
activeIcon: new Icon(Icons.featured_play_list, color: active,),
|
||||
title: new Text(AppLocalizations.of(context).translate("My Training Plan"),
|
||||
style: TextStyle(fontSize: 9),),
|
||||
),
|
||||
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: bgrColor,
|
||||
icon: Icon(Icons.person, color: inactive,),
|
||||
activeIcon: new Icon(Icons.person, color: active,),
|
||||
title: Text(AppLocalizations.of(context).translate("Account"),
|
||||
style: TextStyle(fontSize: 9),)
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: Colors.black12,
|
||||
icon: Icon(Icons.settings, color: Colors.lightGreen),
|
||||
activeIcon: new Icon(Icons.settings, color: Colors.yellow,),
|
||||
title: Text(AppLocalizations.of(context).translate("Settings"))
|
||||
backgroundColor: bgrColor,
|
||||
icon: Icon(Icons.settings, color: inactive),
|
||||
activeIcon: new Icon(Icons.settings, color: active,),
|
||||
title: Text(AppLocalizations.of(context).translate("Settings"),
|
||||
style: TextStyle(fontSize: 9))
|
||||
)
|
||||
],
|
||||
onTap:(index) {
|
||||
setState(() {
|
||||
widget.bottomNavIndex = index;
|
||||
});
|
||||
switch (index) {
|
||||
case 0:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('home');
|
||||
switch (index) {
|
||||
case 0:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('home');
|
||||
|
||||
break;
|
||||
case 1:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('mydevelopment');
|
||||
break;
|
||||
case 2:
|
||||
|
||||
break;
|
||||
case 1:
|
||||
//throw new StateError('This is a Dart exception on event.');
|
||||
|
||||
break;
|
||||
case 2:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('account');
|
||||
break;
|
||||
case 3:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('account');
|
||||
|
||||
break;
|
||||
case 3:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('settings');
|
||||
break;
|
||||
case 4:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('settings');
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,12 +82,9 @@ class MenuPageWidget extends StatelessWidget {
|
||||
AppLocalizations.of(context).translate('Please log in'),
|
||||
style: TextStyle(color: Colors.white))));
|
||||
} else {
|
||||
if (workoutTree.exerciseType.name == "Custom") {
|
||||
if (workoutTree.exerciseType.name == "Custom" && Cache().userLoggedIn.admin == 1) {
|
||||
Navigator.of(context).pushNamed('exerciseCustomPage',
|
||||
arguments: workoutTree.exerciseType);
|
||||
} else if (workoutTree.exerciseType.name == "Control") {
|
||||
Navigator.of(context).pushNamed('exerciseControlPage',
|
||||
arguments: workoutTree.exerciseType);
|
||||
} else {
|
||||
Navigator.of(context).pushNamed('exerciseNewPage',
|
||||
arguments: workoutTree.exerciseType);
|
||||
@@ -108,17 +105,6 @@ class MenuPageWidget extends StatelessWidget {
|
||||
|
||||
dynamic _getButtonImage(WorkoutTree workoutTree) {
|
||||
dynamic image;
|
||||
/*String url = workoutTree.imageName;
|
||||
if ( workoutTree.imageName.startsWith("https") ) {
|
||||
image = FadeInImage.assetNetwork(
|
||||
placeholder: 'asset/image/dots.gif',
|
||||
image: url,
|
||||
height: 180,
|
||||
);
|
||||
} else {
|
||||
image = Image.asset(workoutTree.imageName, height: 180,);
|
||||
}*/
|
||||
|
||||
try {
|
||||
image = Image.asset(
|
||||
workoutTree.imageName,
|
||||
|
||||
Reference in New Issue
Block a user