wt1.1.1 ExercisePlan + ExercisePlan detail, Trainee
This commit is contained in:
@@ -56,14 +56,15 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
||||
}
|
||||
}); */
|
||||
colorAnim = RainbowColorTween([Colors.white70,
|
||||
Colors.greenAccent,
|
||||
Colors.lightGreen,
|
||||
Colors.lightGreenAccent,
|
||||
Colors.yellow,
|
||||
Colors.blueGrey,
|
||||
Colors.blueAccent,
|
||||
Colors.lightBlue,
|
||||
Colors.lightBlueAccent,
|
||||
Colors.yellowAccent,
|
||||
Colors.orange,
|
||||
Colors.orangeAccent,
|
||||
Colors.white70])
|
||||
Colors.yellowAccent,
|
||||
Color(0xffcce6ff)])
|
||||
.animate(colorController)
|
||||
..addListener(() { setState(() {}); })
|
||||
..addStatusListener((status) {
|
||||
@@ -103,7 +104,9 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () =>
|
||||
{
|
||||
menuBloc.add(MenuTreeUp(parent: 0))
|
||||
if ( menuBloc != null ) {
|
||||
menuBloc.add(MenuTreeUp(parent: 0)),
|
||||
}
|
||||
},
|
||||
)
|
||||
);
|
||||
@@ -151,7 +154,7 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
||||
trailing: Icon(percent > 0.6 ? Icons.mood : Icons.mood_bad, color: colorAnim.value,),
|
||||
linearStrokeCap: LinearStrokeCap.roundAll,
|
||||
backgroundColor: colorAnim.value,
|
||||
progressColor: Colors.blue,
|
||||
progressColor: Color(0xff73e600),
|
||||
animation: true,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
import 'dart:async';
|
||||
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';
|
||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||
import 'package:rainbow_color/rainbow_color.dart';
|
||||
|
||||
|
||||
class AppBarCommonNav extends StatefulWidget implements PreferredSizeWidget {
|
||||
|
||||
@override
|
||||
_AppBarCommonNav createState() => _AppBarCommonNav();
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(60);
|
||||
}
|
||||
|
||||
class _AppBarCommonNav extends State<AppBarCommonNav> with SingleTickerProviderStateMixin {
|
||||
Animation<Color> colorAnim;
|
||||
AnimationController colorController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
colorController =
|
||||
AnimationController(duration: Duration(seconds: 4), vsync: this);
|
||||
|
||||
colorAnim = RainbowColorTween([Colors.white70,
|
||||
Colors.blueGrey,
|
||||
Colors.blueAccent,
|
||||
Colors.lightBlue,
|
||||
Colors.lightBlueAccent,
|
||||
Colors.yellowAccent,
|
||||
Colors.orange,
|
||||
Colors.orangeAccent,
|
||||
Colors.yellowAccent,
|
||||
Color(0xffcce6ff)])
|
||||
.animate(colorController)
|
||||
..addListener(() { setState(() {}); })
|
||||
..addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
Timer(Duration(seconds: 10), () {
|
||||
//colorController.reset();
|
||||
if ( mounted ) {
|
||||
colorController.forward();
|
||||
}
|
||||
});
|
||||
} else if (status == AnimationStatus.dismissed) {
|
||||
colorController.forward();
|
||||
}
|
||||
});
|
||||
colorController.forward();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: Colors.black,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
||||
getAnimatedWidget(),
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
fit: BoxFit.cover,
|
||||
height: 65.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () =>
|
||||
{
|
||||
Navigator.of(context).pop()
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
//sizeController.dispose();
|
||||
colorController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget getAnimatedWidget() {
|
||||
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: [
|
||||
Text(AppLocalizations.of(context).translate("Make your first test"),
|
||||
style: TextStyle(fontSize: 16, color: colorAnim.value, shadows: [Shadow(color: Colors.purple , blurRadius: 15)]),
|
||||
|
||||
),
|
||||
//TestProgress(animation: sizeAnim),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
LinearPercentIndicator(
|
||||
width: 120.0,
|
||||
lineHeight: 14.0,
|
||||
percent: percent,
|
||||
center: Text(
|
||||
(percent * 100).toStringAsFixed(0) + "% finished",
|
||||
style: new TextStyle(fontSize: 12.0),
|
||||
),
|
||||
trailing: Icon(percent > 0.6 ? Icons.mood : Icons.mood_bad, color: colorAnim.value,),
|
||||
linearStrokeCap: LinearStrokeCap.roundAll,
|
||||
backgroundColor: colorAnim.value,
|
||||
progressColor: Color(0xff73e600),
|
||||
animation: true,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,13 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
|
||||
break;
|
||||
case 1:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('mydevelopment');
|
||||
//Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('myDevelopment');
|
||||
break;
|
||||
case 2:
|
||||
|
||||
//throw new StateError('This is a Dart exception on event.');
|
||||
//Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('myExercisePlan');
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
||||
@@ -24,7 +24,6 @@ class AitrainerHome extends StatefulWidget {
|
||||
|
||||
class _HomePageState extends State<AitrainerHome> {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
final AppLanguage appLanguage = AppLanguage();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -45,7 +44,9 @@ class _HomePageState extends State<AitrainerHome> {
|
||||
sessionBloc.add(SessionStart());
|
||||
// ignore: close_sinks
|
||||
SettingsBloc settingsBloc = BlocProvider.of<SettingsBloc>(context);
|
||||
settingsBloc.loadLang();
|
||||
String lang = AppLanguage().appLocal.languageCode;
|
||||
print (" -- Loading delayed lang $lang");
|
||||
settingsBloc.add(SettingsChangeLanguage(language: lang));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,8 +6,8 @@ class LoadingScreenMain extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
Image _backgroundImage = Image.asset('asset/image/WT01_loading_layers.png',
|
||||
fit: BoxFit.cover,
|
||||
//height: double.infinity,
|
||||
//width: double.infinity,
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
);
|
||||
return Scaffold(
|
||||
|
||||
@@ -37,7 +37,7 @@ class MenuPageWidget extends StatelessWidget {
|
||||
child: Center(
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomLeft,
|
||||
fit: StackFit.loose,
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
children: [
|
||||
FlatButton(
|
||||
child: _getButtonImage(workoutTree),
|
||||
@@ -45,21 +45,35 @@ class MenuPageWidget extends StatelessWidget {
|
||||
shape: getShape(workoutTree),
|
||||
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
||||
),
|
||||
InkWell(
|
||||
onTap:() => menuClick(workoutTree, menuBloc, context),
|
||||
child: Text(
|
||||
" " + workoutTree.name,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
color: workoutTree.color,
|
||||
fontSize: workoutTree.fontSize,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
Positioned(
|
||||
top: workoutTree.name.length > 30 ? 140 : 150,
|
||||
left: 5,
|
||||
child: Container(
|
||||
height: 300,
|
||||
width: 280,
|
||||
child: InkWell(
|
||||
onTap:() => menuClick(workoutTree, menuBloc, context),
|
||||
child: Text(
|
||||
" " + workoutTree.name,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
color: workoutTree.color,
|
||||
fontSize: workoutTree.fontSize,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
),
|
||||
|
||||
highlightColor: workoutTree.color,
|
||||
),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
highlightColor: workoutTree.color,
|
||||
),
|
||||
|
||||
]))));
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
SliverList sliverList =
|
||||
|
||||
Reference in New Issue
Block a user