Merge ssh://git.aitrainer.app:6622/bossanyit/aitrainer_app
This commit is contained in:
@@ -1,21 +1,11 @@
|
||||
import 'dart:async';
|
||||
|
||||
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:aitrainer_app/util/common.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||
import 'package:rainbow_color/rainbow_color.dart';
|
||||
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AppBarMin extends StatefulWidget implements PreferredSizeWidget {
|
||||
class AppBarMin extends StatefulWidget implements PreferredSizeWidget {
|
||||
bool back = false;
|
||||
AppBarMin({this.back = false });
|
||||
AppBarMin({this.back = false});
|
||||
|
||||
@override
|
||||
_AppBarNav createState() => _AppBarNav();
|
||||
@@ -24,7 +14,7 @@ class AppBarMin extends StatefulWidget implements PreferredSizeWidget {
|
||||
Size get preferredSize => const Size.fromHeight(50);
|
||||
}
|
||||
|
||||
class _AppBarNav extends State<AppBarMin> with Common {
|
||||
class _AppBarNav extends State<AppBarMin> with Common {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -32,7 +22,6 @@ class _AppBarNav extends State<AppBarMin> with Common {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return AppBar(
|
||||
backgroundColor: Colors.black,
|
||||
title: Row(
|
||||
@@ -47,19 +36,14 @@ class _AppBarNav extends State<AppBarMin> with Common {
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: widget.back ? Colors.white : Colors.black),
|
||||
onPressed: () =>
|
||||
{
|
||||
if ( widget.back ) {
|
||||
Navigator.of(context).pop()
|
||||
}
|
||||
onPressed: () => {
|
||||
if (widget.back) {Navigator.of(context).pop()}
|
||||
},
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:animated_widgets/widgets/rotation_animated.dart';
|
||||
import 'package:flurry/flurry.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@@ -70,6 +71,7 @@ class _BMIState extends State<BMI> with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
Flurry.logEvent("BMI");
|
||||
widget.exerciseBloc.getBMI();
|
||||
return Form(
|
||||
child: Scaffold(
|
||||
@@ -91,7 +93,7 @@ class _BMIState extends State<BMI> with Trans {
|
||||
child:
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
getWeightInput(),
|
||||
Text(AppLocalizations.of(context).translate("Body Mass Index"),
|
||||
Text(t("Body Mass Index"),
|
||||
style: GoogleFonts.archivoBlack(
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/fitness_state.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:flurry/flurry.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@@ -74,6 +75,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
Flurry.logEvent("BMR");
|
||||
return Form(
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
|
||||
+43
-34
@@ -1,4 +1,8 @@
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flurry/flurry.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gradient_bottom_navigation_bar/gradient_bottom_navigation_bar.dart';
|
||||
|
||||
@@ -13,7 +17,7 @@ class BottomNavigator extends StatefulWidget {
|
||||
_NawDrawerWidget createState() => _NawDrawerWidget();
|
||||
}
|
||||
|
||||
class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
class _NawDrawerWidget extends State<BottomNavigator> with Trans {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -25,32 +29,19 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
final Color bgrColorEnd = Colors.blue;
|
||||
final Color active = Colors.black;
|
||||
final Color inactive = Colors.black26;
|
||||
|
||||
/*final Color bgrColor = Colors.black;
|
||||
final Color active = Colors.yellowAccent;
|
||||
final Color inactive = Colors.white60;*/
|
||||
//
|
||||
setContext(context);
|
||||
|
||||
return GradientBottomNavigationBar(
|
||||
currentIndex:
|
||||
widget.bottomNavIndex, // this will be set when a new tab is tapped
|
||||
currentIndex: widget.bottomNavIndex, // this will be set when a new tab is tapped
|
||||
backgroundColorStart: bgrColorEnd,
|
||||
backgroundColorEnd: bgrColor,
|
||||
fixedColor: active,
|
||||
//selectedItemColor: active,
|
||||
//unselectedItemColor: inactive,
|
||||
//showSelectedLabels: true,
|
||||
//showUnselectedLabels: true,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
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)),
|
||||
icon: badgedIcon(inactive, Icons.home, "home"),
|
||||
activeIcon: badgedIcon(active, Icons.home, "home"),
|
||||
title: new Text(t("Home"), style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: bgrColor,
|
||||
@@ -60,8 +51,8 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
color: active,
|
||||
),
|
||||
title: new Text(
|
||||
AppLocalizations.of(context).translate("My Development"),
|
||||
style: TextStyle(fontSize: 9),
|
||||
t("My Development"),
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
@@ -72,23 +63,17 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
color: active,
|
||||
),
|
||||
title: new Text(
|
||||
AppLocalizations.of(context).translate("My Training Plan"),
|
||||
style: TextStyle(fontSize: 9),
|
||||
t("My Training Plan"),
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: bgrColor,
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
color: inactive,
|
||||
),
|
||||
activeIcon: new Icon(
|
||||
Icons.person,
|
||||
color: active,
|
||||
),
|
||||
icon: badgedIcon(inactive, Icons.person, "account"),
|
||||
activeIcon: badgedIcon(active, Icons.person, "account"),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).translate("Account"),
|
||||
style: TextStyle(fontSize: 9),
|
||||
style: TextStyle(fontSize: 12),
|
||||
)),
|
||||
BottomNavigationBarItem(
|
||||
backgroundColor: bgrColor,
|
||||
@@ -97,8 +82,7 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
Icons.settings,
|
||||
color: active,
|
||||
),
|
||||
title: Text(AppLocalizations.of(context).translate("Settings"),
|
||||
style: TextStyle(fontSize: 9)))
|
||||
title: Text(t("Settings"), style: TextStyle(fontSize: 12)))
|
||||
],
|
||||
onTap: (index) {
|
||||
setState(() {
|
||||
@@ -106,25 +90,30 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
switch (index) {
|
||||
case 0:
|
||||
Navigator.of(context).pop();
|
||||
Flurry.logEvent("Home");
|
||||
Navigator.of(context).pushNamed('home');
|
||||
|
||||
break;
|
||||
case 1:
|
||||
Navigator.of(context).pop();
|
||||
Flurry.logEvent("myDevelopment");
|
||||
Navigator.of(context).pushNamed('myDevelopment');
|
||||
break;
|
||||
case 2:
|
||||
Navigator.of(context).pop();
|
||||
Flurry.logEvent("myExercisePlan");
|
||||
Navigator.of(context).pushNamed('myExercisePlan');
|
||||
|
||||
break;
|
||||
case 3:
|
||||
Navigator.of(context).pop();
|
||||
Flurry.logEvent("Account");
|
||||
Navigator.of(context).pushNamed('account');
|
||||
|
||||
break;
|
||||
case 4:
|
||||
Navigator.of(context).pop();
|
||||
Flurry.logEvent("Settings");
|
||||
Navigator.of(context).pushNamed('settings');
|
||||
|
||||
break;
|
||||
@@ -132,4 +121,24 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Widget badgedIcon(Color color, IconData icon, String badgeKey) {
|
||||
bool show = Cache().getBadges()[badgeKey] != null;
|
||||
int counter = Cache().getBadges()[badgeKey] != null ? Cache().getBadges()[badgeKey] : 0;
|
||||
return Badge(
|
||||
position: BadgePosition.topEnd(top: -10, end: -10),
|
||||
animationDuration: Duration(milliseconds: 500),
|
||||
animationType: BadgeAnimationType.slide,
|
||||
badgeColor: Colors.red,
|
||||
showBadge: show,
|
||||
badgeContent: Text(
|
||||
counter.toString(),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: color,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class ImageButton extends StatelessWidget {
|
||||
@@ -10,13 +13,15 @@ class ImageButton extends StatelessWidget {
|
||||
final String image;
|
||||
final double top;
|
||||
final double left;
|
||||
final double height;
|
||||
double width = 180;
|
||||
final bool isShape;
|
||||
double height;
|
||||
double width;
|
||||
bool isShape;
|
||||
final Bloc bloc;
|
||||
final Alignment textAlignment;
|
||||
final VoidCallback onTap;
|
||||
bool isLocked;
|
||||
bool isMarked;
|
||||
int buttonIndex;
|
||||
|
||||
ImageButton(
|
||||
{this.text,
|
||||
@@ -30,20 +35,23 @@ class ImageButton extends StatelessWidget {
|
||||
this.isShape,
|
||||
this.textAlignment,
|
||||
this.onTap,
|
||||
this.buttonIndex,
|
||||
this.isMarked,
|
||||
@required this.isLocked}) {
|
||||
width = width ?? 180;
|
||||
style = style ?? TextStyle(fontSize: 14, fontFamily: "Roboto Mono");
|
||||
height = height ?? 180;
|
||||
isMarked = isMarked ?? false;
|
||||
style = style ??
|
||||
GoogleFonts.archivoBlack(
|
||||
fontSize: 14,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double top = width - (style.fontSize - 5) * text.length - 2 * left < 0
|
||||
? width - 2 * style.fontSize - 10
|
||||
: width - style.fontSize - 10;
|
||||
print("Top: " +
|
||||
top.toStringAsFixed(0) +
|
||||
" length: " +
|
||||
((style.fontSize - 5) * text.length).toString());
|
||||
double top =
|
||||
height - (style.fontSize - 5) * text.length - 2 * left < 0 ? height - 2 * style.fontSize - 22 : height - style.fontSize - 17;
|
||||
//print("Top: " + top.toStringAsFixed(0) + " length: " + ((style.fontSize - 5) * text.length).toString());
|
||||
return Stack(
|
||||
//alignment: textAlignment,
|
||||
fit: StackFit.passthrough,
|
||||
@@ -52,24 +60,27 @@ class ImageButton extends StatelessWidget {
|
||||
FlatButton(
|
||||
child: image == null
|
||||
? _getButtonImage("asset/image/WT_menu_dark.png")
|
||||
: _getButtonImage(image),
|
||||
: isMarked
|
||||
? Stack(
|
||||
children: [
|
||||
_getButtonImage(image),
|
||||
Container(
|
||||
width: width,
|
||||
height: height,
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 1, sigmaY: 1),
|
||||
child: Container(
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: _getButtonImage(image),
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
shape: getShape(isShape),
|
||||
onPressed: onTap ?? onTap,
|
||||
),
|
||||
Stack(alignment: Alignment.topLeft, children: [
|
||||
Positioned(
|
||||
top: 50,
|
||||
left: 50,
|
||||
child: this.isLocked
|
||||
? Image.asset(
|
||||
'asset/image/lock.png',
|
||||
height: 60,
|
||||
width: 60,
|
||||
)
|
||||
: Container(),
|
||||
)
|
||||
]),
|
||||
Positioned(
|
||||
top: top,
|
||||
left: left,
|
||||
@@ -87,6 +98,31 @@ class ImageButton extends StatelessWidget {
|
||||
color: Colors.transparent,
|
||||
),
|
||||
),
|
||||
Stack(alignment: Alignment.topLeft, children: [
|
||||
Positioned(
|
||||
top: height / 2 - 30,
|
||||
left: width / 2 - 30,
|
||||
child: this.isLocked
|
||||
? GestureDetector(
|
||||
child: Image.asset(
|
||||
'asset/image/lock.png',
|
||||
height: 60,
|
||||
width: 60,
|
||||
),
|
||||
onTap: onTap ?? onTap,
|
||||
)
|
||||
: isMarked
|
||||
? GestureDetector(
|
||||
child: Image.asset(
|
||||
'asset/image/haken.png',
|
||||
height: 70,
|
||||
width: 70,
|
||||
),
|
||||
onTap: onTap ?? onTap,
|
||||
)
|
||||
: Container(),
|
||||
)
|
||||
]),
|
||||
]
|
||||
//)
|
||||
// )
|
||||
@@ -110,12 +146,8 @@ class ImageButton extends StatelessWidget {
|
||||
fit: BoxFit.fitWidth,
|
||||
alignment: Alignment.center,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
String url = Cache.mediaUrl + 'images/' + imageName.substring(11);
|
||||
Widget image = FadeInImage.assetNetwork(
|
||||
placeholder: 'asset/image/dots.gif',
|
||||
image: url,
|
||||
height: 180,
|
||||
);
|
||||
String url = Cache.mediaUrl + '/' + imageName; //.substring(11);
|
||||
Widget image = FadeInImage.assetNetwork(placeholder: 'asset/image/dots.gif', image: url, height: this.height);
|
||||
return image;
|
||||
},
|
||||
);
|
||||
@@ -124,7 +156,7 @@ class ImageButton extends StatelessWidget {
|
||||
image = FadeInImage.assetNetwork(
|
||||
placeholder: 'asset/image/dots.gif',
|
||||
image: url,
|
||||
height: 180,
|
||||
height: 50,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
@@ -24,15 +25,13 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
MenuBloc menuBloc = BlocProvider.of<MenuBloc>(context);
|
||||
setContext(context);
|
||||
|
||||
return CustomScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
slivers: <Widget>[buildMenuColumn(parent, context, menuBloc)]);
|
||||
return CustomScrollView(scrollDirection: Axis.vertical, slivers: <Widget>[buildMenuColumn(parent, context, menuBloc)]);
|
||||
}
|
||||
|
||||
SliverList buildMenuColumn(int parent, BuildContext context, MenuBloc menuBloc) {
|
||||
final List<Widget> _columnChildren = List();
|
||||
|
||||
if ( context != null ) {
|
||||
if (context != null) {
|
||||
menuBloc.setContext(context);
|
||||
menuBloc.setMenuInfo();
|
||||
|
||||
@@ -52,62 +51,50 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
_columnChildren.add(info);
|
||||
}
|
||||
|
||||
|
||||
menuBloc.menuTreeRepository
|
||||
.getBranch(menuBloc.parent)
|
||||
.forEach((treeName, value) {
|
||||
menuBloc.menuTreeRepository.getBranch(menuBloc.parent).forEach((treeName, value) {
|
||||
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
|
||||
_columnChildren.add(Container(
|
||||
padding: EdgeInsets.only(top: 16.0),
|
||||
child: Center(
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomLeft,
|
||||
//clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
children: [
|
||||
FlatButton(
|
||||
child: _getButtonImage(workoutTree),
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
shape: getShape(workoutTree),
|
||||
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
||||
),
|
||||
Positioned(
|
||||
top: workoutTree.name.length > 20 ? 130 : 145,
|
||||
left: 5,
|
||||
child: Container(
|
||||
height: 300,
|
||||
width: 280,
|
||||
child: InkWell(
|
||||
onTap:() => menuClick(workoutTree, menuBloc, context),
|
||||
child: Text(
|
||||
" " + workoutTree.name,
|
||||
maxLines: 2,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
color: workoutTree.color,
|
||||
fontSize: workoutTree.fontSize,
|
||||
),
|
||||
child: Stack(alignment: Alignment.bottomLeft,
|
||||
//clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
children: [
|
||||
FlatButton(
|
||||
child: badgedIcon(workoutTree),
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
shape: getShape(workoutTree),
|
||||
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
||||
),
|
||||
Positioned(
|
||||
top: workoutTree.name.length > 20 ? 130 : 145,
|
||||
left: 5,
|
||||
child: Container(
|
||||
height: 300,
|
||||
width: 280,
|
||||
child: InkWell(
|
||||
onTap: () => menuClick(workoutTree, menuBloc, context),
|
||||
child: Text(
|
||||
" " + workoutTree.name,
|
||||
maxLines: 2,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
color: workoutTree.color,
|
||||
fontSize: workoutTree.fontSize,
|
||||
),
|
||||
|
||||
highlightColor: workoutTree.color,
|
||||
),
|
||||
color: Colors.transparent,
|
||||
highlightColor: workoutTree.color,
|
||||
),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
),
|
||||
]))));
|
||||
});
|
||||
|
||||
SliverList sliverList =
|
||||
SliverList(delegate: SliverChildListDelegate(_columnChildren));
|
||||
SliverList sliverList = SliverList(delegate: SliverChildListDelegate(_columnChildren));
|
||||
|
||||
return sliverList;
|
||||
}
|
||||
|
||||
void menuClick(
|
||||
WorkoutMenuTree workoutTree, MenuBloc menuBloc, BuildContext context) {
|
||||
void menuClick(WorkoutMenuTree workoutTree, MenuBloc menuBloc, BuildContext context) {
|
||||
print("Hi!, Menu clicked " + workoutTree.id.toString());
|
||||
if (workoutTree.child == false) {
|
||||
menuBloc.add(MenuTreeDown(item: workoutTree, parent: workoutTree.id));
|
||||
@@ -116,16 +103,12 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
if (Cache().userLoggedIn == null) {
|
||||
Scaffold.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.exerciseType.name == "Custom" && Cache().userLoggedIn.admin == 1) {
|
||||
Navigator.of(context).pushNamed('exerciseCustomPage',
|
||||
arguments: workoutTree.exerciseType);
|
||||
Navigator.of(context).pushNamed('exerciseCustomPage', arguments: workoutTree.exerciseType);
|
||||
} else {
|
||||
Navigator.of(context).pushNamed('exerciseNewPage',
|
||||
arguments: workoutTree.exerciseType);
|
||||
Navigator.of(context).pushNamed('exerciseNewPage', arguments: workoutTree.exerciseType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,8 +131,7 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
workoutTree.imageName,
|
||||
height: 180,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
String url =
|
||||
Cache.mediaUrl + 'images/' + workoutTree.imageName.substring(11);
|
||||
String url = Cache.mediaUrl + 'images/' + workoutTree.imageName.substring(11);
|
||||
Widget image = FadeInImage.assetNetwork(
|
||||
placeholder: 'asset/image/dots.gif',
|
||||
image: url,
|
||||
@@ -169,4 +151,24 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
Widget badgedIcon(WorkoutMenuTree workoutMenuTree) {
|
||||
String badgeKey = workoutMenuTree.nameEnglish;
|
||||
bool show = Cache().getBadges()[badgeKey] != null;
|
||||
int counter = Cache().getBadges()[badgeKey] != null ? Cache().getBadges()[badgeKey] : 0;
|
||||
return Badge(
|
||||
padding: EdgeInsets.all(8),
|
||||
position: BadgePosition.topEnd(top: 3, end: 3),
|
||||
animationDuration: Duration(milliseconds: 500),
|
||||
animationType: BadgeAnimationType.slide,
|
||||
badgeColor: Colors.red,
|
||||
showBadge: show,
|
||||
badgeContent: Text(counter.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
)),
|
||||
child: _getButtonImage(workoutMenuTree),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class _SizeState extends State<SizeWidget> with Trans {
|
||||
List<Widget> getSizeFigure() {
|
||||
double mediaWidth = MediaQuery.of(context).size.width * .8;
|
||||
double mediaHeight = MediaQuery.of(context).size.height * .8;
|
||||
print("w " + mediaWidth.toString() + "h " + mediaHeight.toString());
|
||||
//print("w " + mediaWidth.toString() + "h " + mediaHeight.toString());
|
||||
widget.exerciseBloc.setMediaDimensions(mediaWidth, mediaHeight);
|
||||
List<Widget> list = List();
|
||||
list.add(GestureDetector(
|
||||
|
||||
Reference in New Issue
Block a user