WT 1.1.0+35 Design, Menü filter, Test Server
This commit is contained in:
+83
-58
@@ -8,11 +8,11 @@ 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:google_fonts/google_fonts.dart';
|
||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||
import 'package:rainbow_color/rainbow_color.dart';
|
||||
|
||||
|
||||
class AppBarNav extends StatefulWidget implements PreferredSizeWidget {
|
||||
class AppBarNav extends StatefulWidget implements PreferredSizeWidget {
|
||||
final MenuBloc menuBloc;
|
||||
final bool isMenu;
|
||||
final int depth;
|
||||
@@ -25,18 +25,17 @@ class AppBarNav extends StatefulWidget implements PreferredSizeWidget {
|
||||
Size get preferredSize => const Size.fromHeight(50);
|
||||
}
|
||||
|
||||
class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, Common {
|
||||
class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin, Common {
|
||||
Animation<Color> colorAnim;
|
||||
AnimationController colorController;
|
||||
MenuBloc menuBloc;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
colorController = AnimationController(duration: Duration(seconds: 4), vsync: this);
|
||||
|
||||
colorController =
|
||||
AnimationController(duration: Duration(seconds: 4), vsync:this);
|
||||
|
||||
colorAnim = RainbowColorTween([Colors.white70,
|
||||
colorAnim = RainbowColorTween([
|
||||
Colors.white70,
|
||||
Colors.blueGrey,
|
||||
Colors.blueAccent,
|
||||
Colors.lightBlue,
|
||||
@@ -45,18 +44,20 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin,
|
||||
Colors.orange,
|
||||
Colors.orangeAccent,
|
||||
Colors.yellowAccent,
|
||||
Color(0xffcce6ff)])
|
||||
.animate(colorController)
|
||||
..addListener(() { setState(() {}); })
|
||||
Color(0xffcce6ff)
|
||||
]).animate(colorController)
|
||||
..addListener(() {
|
||||
setState(() {});
|
||||
})
|
||||
..addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
Timer(Duration(seconds: 10), () {
|
||||
if ( mounted ) {
|
||||
if (mounted) {
|
||||
colorController.forward();
|
||||
}
|
||||
});
|
||||
} else if (status == AnimationStatus.dismissed) {
|
||||
colorController.forward();
|
||||
colorController.forward();
|
||||
}
|
||||
});
|
||||
colorController.forward();
|
||||
@@ -72,33 +73,35 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
||||
getAnimatedWidget(),
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
//fit: BoxFit.cover,
|
||||
height: 45.0,
|
||||
Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
//fit: BoxFit.cover,
|
||||
height: 45.0,
|
||||
),
|
||||
getTestServer(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () =>
|
||||
{
|
||||
if ( widget.isMenu != null ) {
|
||||
if ( menuBloc.workoutItem != null ) {
|
||||
menuBloc.add(MenuTreeUp(parent: menuBloc.workoutItem.parent)),
|
||||
onPressed: () => {
|
||||
if (widget.isMenu != null)
|
||||
{
|
||||
if (menuBloc.workoutItem != null)
|
||||
{
|
||||
menuBloc.add(MenuTreeUp(parent: menuBloc.workoutItem.parent)),
|
||||
}
|
||||
}
|
||||
} else if ( widget.depth != null ) {
|
||||
if ( widget.depth == 0 ) {
|
||||
Navigator.of(context).pushNamed('home')
|
||||
} else {
|
||||
Navigator.of(context).pop()
|
||||
else if (widget.depth != null)
|
||||
{
|
||||
if (widget.depth == 0) {Navigator.of(context).pushNamed('home')} else {Navigator.of(context).pop()}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -107,48 +110,70 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin,
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget getTestServer() {
|
||||
if (Cache().liveServer) {
|
||||
return Container();
|
||||
} else {
|
||||
return Text("TEST",
|
||||
style: GoogleFonts.archivoBlack(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Widget getAnimatedWidget() {
|
||||
double cWidth = mediaSizeWidth(context);
|
||||
double percent = Cache().getPercentExercises();
|
||||
if ( percent == -1) {
|
||||
if (percent == -1) {
|
||||
menuBloc.menuTreeRepository.createTree();
|
||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
exerciseRepository.getBaseExerciseFinishedPercent();
|
||||
percent = Cache().getPercentExercises();
|
||||
}
|
||||
int sizeExerciseList = Cache().getExercises() == null? 0 : Cache().getExercises().length;
|
||||
if ( sizeExerciseList == 0 ) {
|
||||
int sizeExerciseList = Cache().getExercises() == null ? 0 : Cache().getExercises().length;
|
||||
if (sizeExerciseList == 0) {
|
||||
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: [
|
||||
Text(text,
|
||||
style: TextStyle(fontSize: fontSize, color: colorAnim.value, shadows: [Shadow(color: Colors.purple , blurRadius: 15)]),
|
||||
|
||||
),
|
||||
//TestProgress(animation: sizeAnim),
|
||||
]
|
||||
);
|
||||
return Stack(alignment: Alignment.topLeft, overflow: Overflow.clip, children: [
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: fontSize, color: colorAnim.value, shadows: [Shadow(color: Colors.purple, blurRadius: 15)]),
|
||||
),
|
||||
//TestProgress(animation: sizeAnim),
|
||||
]);
|
||||
} else {
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
LinearPercentIndicator(
|
||||
width: cWidth / 4,
|
||||
lineHeight: 14.0,
|
||||
percent: percent,
|
||||
center: Text(
|
||||
(percent * 100).toStringAsFixed(0) + "% " + AppLocalizations.of(context).translate("finished"),
|
||||
style: new TextStyle(fontSize: 10.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,
|
||||
LinearPercentIndicator(
|
||||
width: cWidth / 4,
|
||||
lineHeight: 14.0,
|
||||
percent: percent,
|
||||
center: Text(
|
||||
(percent * 100).toStringAsFixed(0) + "% " + AppLocalizations.of(context).translate("finished"),
|
||||
style: new TextStyle(fontSize: 10.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,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AppBarMin extends StatefulWidget implements PreferredSizeWidget {
|
||||
@@ -27,10 +29,15 @@ class _AppBarNav extends State<AppBarMin> with Common {
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
//fit: BoxFit.cover,
|
||||
height: 45.0,
|
||||
Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
//fit: BoxFit.cover,
|
||||
height: 45.0,
|
||||
),
|
||||
getTestServer(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -46,4 +53,28 @@ class _AppBarNav extends State<AppBarMin> with Common {
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget getTestServer() {
|
||||
if (Cache().liveServer) {
|
||||
return Container();
|
||||
} else {
|
||||
return Text("TEST",
|
||||
style: GoogleFonts.archivoBlack(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,31 +58,26 @@ class MenuInfoWidget extends StatelessWidget with Common {
|
||||
title,
|
||||
maxLines: 4,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: titleColor,
|
||||
fontSize: titleSize,
|
||||
fontWeight: titleWeight),
|
||||
style: TextStyle(color: titleColor, fontSize: titleSize, fontWeight: titleWeight),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
text,
|
||||
maxLines: 6,
|
||||
style: TextStyle(
|
||||
color: textColor, fontSize: textSize, fontWeight: textWeight),
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
|
||||
),
|
||||
Divider(),
|
||||
/* 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),
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
|
||||
),
|
||||
getLink(),
|
||||
],
|
||||
@@ -97,15 +92,10 @@ class MenuInfoWidget extends StatelessWidget with Common {
|
||||
return InkWell(
|
||||
child: new Text(
|
||||
link,
|
||||
style: TextStyle(
|
||||
color: Colors.lightBlueAccent,
|
||||
fontSize: textSize,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: textWeight),
|
||||
style: TextStyle(color: Colors.lightBlueAccent, fontSize: textSize, fontFamily: 'Arial', fontWeight: textWeight),
|
||||
),
|
||||
onTap: () => {
|
||||
missingId = bloc.menuTreeRepository
|
||||
.getMissingTreeIdByName(bloc.missingTreeName),
|
||||
missingId = bloc.menuTreeRepository.getMissingTreeIdByName(bloc.missingTreeName),
|
||||
print("menu " + missingId.toString()),
|
||||
bloc.add(MenuTreeJump(parent: missingId))
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
@@ -17,6 +18,8 @@ import 'menu_info_widget.dart';
|
||||
// ignore: must_be_immutable
|
||||
class MenuPageWidget extends StatelessWidget with Trans {
|
||||
int parent;
|
||||
final double baseWidth = 312;
|
||||
final double baseHeight = 675.2;
|
||||
|
||||
MenuPageWidget({this.parent});
|
||||
|
||||
@@ -27,13 +30,172 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
double cWidth = MediaQuery.of(context).size.width;
|
||||
double cHeight = MediaQuery.of(context).size.height;
|
||||
|
||||
return CustomScrollView(
|
||||
scrollDirection: Axis.vertical, slivers: <Widget>[buildMenuColumn(parent, context, menuBloc, cWidth, cHeight)]);
|
||||
return CustomScrollView(scrollDirection: Axis.vertical, slivers: buildMenuColumn(parent, context, menuBloc, cWidth, cHeight));
|
||||
}
|
||||
|
||||
SliverGrid buildMenuColumn(int parent, BuildContext context, MenuBloc menuBloc, double cWidth, double cHeight) {
|
||||
final List<Widget> _columnChildren = List();
|
||||
List<Widget> buildMenuColumn(int parent, BuildContext context, MenuBloc menuBloc, double cWidth, double cHeight) {
|
||||
final List<Widget> slivers = List();
|
||||
|
||||
bool isChild = menuBloc.menuTreeRepository.isChildAndGym(menuBloc.parent);
|
||||
if (!isChild) {
|
||||
slivers.add(getInfoWidget(context, menuBloc));
|
||||
} else {
|
||||
slivers.add(getFilterWidget(parent, menuBloc));
|
||||
slivers.add(getFilterElements(menuBloc));
|
||||
}
|
||||
|
||||
final List<Widget> _columnChildren = List();
|
||||
final double distortionHeight = cHeight / baseHeight;
|
||||
|
||||
if (menuBloc.getFilteredBranch(menuBloc.parent).isEmpty) {
|
||||
_columnChildren.add(Container(
|
||||
padding: EdgeInsets.only(top: 15.0),
|
||||
child: Center(
|
||||
child: Stack(alignment: Alignment.bottomLeft, children: [
|
||||
Text(t("All Exercises has been filtered out"), style: GoogleFonts.inter(color: Colors.white)),
|
||||
]))));
|
||||
} else {
|
||||
menuBloc.getFilteredBranch(menuBloc.parent).forEach((treeName, value) {
|
||||
WorkoutMenuTree workoutTree = value;
|
||||
/* double textLength = workoutTree.name.length * workoutTree.fontSize;
|
||||
double top = textLength < cWidth - 30
|
||||
? (cHeight / 3 - 2.5 * workoutTree.fontSize) / distortionHeight
|
||||
: (cHeight / 3 - 3.6 * workoutTree.fontSize) / distortionHeight;
|
||||
|
||||
print(" dH: " +
|
||||
distortionHeight.toStringAsFixed(1) +
|
||||
" W: " +
|
||||
cWidth.toStringAsFixed(0) +
|
||||
" H: " +
|
||||
cHeight.toStringAsFixed(0) +
|
||||
" TOP: " +
|
||||
top.toStringAsFixed(0) +
|
||||
" tL: " +
|
||||
textLength.toStringAsFixed(0)); */
|
||||
_columnChildren.add(Container(
|
||||
padding: EdgeInsets.only(top: 15.0, left: 15, right: 15),
|
||||
height: 225, //cHeight / 3 * distortionHeight,
|
||||
child: Badge(
|
||||
padding: EdgeInsets.all(8),
|
||||
position: BadgePosition.bottomEnd(end: 0),
|
||||
animationDuration: Duration(milliseconds: 500),
|
||||
animationType: BadgeAnimationType.slide,
|
||||
badgeColor: Colors.orange[800],
|
||||
showBadge: workoutTree.base,
|
||||
badgeContent: Text(t("base"),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
)),
|
||||
child: Stack(alignment: Alignment.bottomLeft, children: [
|
||||
FlatButton(
|
||||
child: badgedIcon(workoutTree, cWidth, cHeight),
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15, bottom: 10),
|
||||
child: InkWell(
|
||||
onTap: () => menuClick(workoutTree, menuBloc, context),
|
||||
child: Text(
|
||||
workoutTree.name,
|
||||
maxLines: 3,
|
||||
style: GoogleFonts.archivoBlack(color: workoutTree.color, fontSize: workoutTree.fontSize, height: 1.1),
|
||||
),
|
||||
highlightColor: workoutTree.color,
|
||||
),
|
||||
),
|
||||
]))));
|
||||
});
|
||||
}
|
||||
|
||||
SliverList sliverList = SliverList(
|
||||
delegate: SliverChildListDelegate(_columnChildren),
|
||||
/* gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1,
|
||||
mainAxisSpacing: 6.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: cWidth > 375 ? 1.8 : 1.8,
|
||||
) */
|
||||
);
|
||||
|
||||
slivers.add(sliverList);
|
||||
return slivers;
|
||||
}
|
||||
|
||||
SliverGrid getFilterWidget(int parent, MenuBloc menuBloc) {
|
||||
SliverGrid sliverList = SliverGrid(
|
||||
delegate: SliverChildListDelegate([
|
||||
Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Text(
|
||||
t("Equipment Filter"),
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 24,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
])
|
||||
]),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1,
|
||||
mainAxisSpacing: 5.0,
|
||||
crossAxisSpacing: 5.0,
|
||||
childAspectRatio: 9,
|
||||
));
|
||||
|
||||
return sliverList;
|
||||
}
|
||||
|
||||
SliverGrid getFilterElements(MenuBloc menuBloc) {
|
||||
List<Widget> list = List();
|
||||
|
||||
menuBloc.exerciseDeviceRepository.getGymDevices().forEach((element) {
|
||||
String deviceName = AppLanguage().appLocal == Locale('en') ? element.name : element.nameTranslation;
|
||||
ChoiceChip chip = ChoiceChip(
|
||||
//padding: EdgeInsets.zero,
|
||||
labelPadding: EdgeInsets.only(right: 5),
|
||||
avatar: Icon(
|
||||
Icons.remove_circle_outline,
|
||||
color: Colors.orange,
|
||||
size: 18,
|
||||
),
|
||||
label: Text(deviceName),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.white,
|
||||
selected: menuBloc.selectedDevice(element.exerciseDeviceId),
|
||||
backgroundColor: Colors.blue[100],
|
||||
shadowColor: Colors.black54,
|
||||
onSelected: (value) => menuBloc.add(MenuFilterExerciseType(deviceId: element.exerciseDeviceId)),
|
||||
);
|
||||
list.add(chip);
|
||||
});
|
||||
|
||||
SliverGrid sliverList = SliverGrid(
|
||||
delegate: SliverChildListDelegate(list),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 1.0,
|
||||
crossAxisSpacing: 1.0,
|
||||
childAspectRatio: 3,
|
||||
));
|
||||
return sliverList;
|
||||
}
|
||||
|
||||
SliverGrid getInfoWidget(BuildContext context, MenuBloc menuBloc) {
|
||||
final List<Widget> _columnChildren = List();
|
||||
if (context != null) {
|
||||
menuBloc.setContext(context);
|
||||
menuBloc.setMenuInfo();
|
||||
@@ -53,55 +215,14 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
);
|
||||
_columnChildren.add(info);
|
||||
}
|
||||
|
||||
menuBloc.menuTreeRepository.getBranch(menuBloc.parent).forEach((treeName, value) {
|
||||
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
|
||||
_columnChildren.add(Container(
|
||||
padding: EdgeInsets.only(top: 15.0),
|
||||
child: Center(
|
||||
child: Stack(alignment: Alignment.bottomLeft,
|
||||
//clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
children: [
|
||||
FlatButton(
|
||||
child: badgedIcon(workoutTree, cWidth, cHeight),
|
||||
padding: EdgeInsets.only(left: 0.0, bottom: 0),
|
||||
shape: getShape(workoutTree),
|
||||
onPressed: () => menuClick(workoutTree, menuBloc, context),
|
||||
),
|
||||
Positioned(
|
||||
top: workoutTree.name.length > 15 ?
|
||||
workoutTree.fontSize > 25 ? 130 : 140 :
|
||||
workoutTree.fontSize > 25 ? 165 : 175,
|
||||
left: 8,
|
||||
child: Container(
|
||||
height: cWidth * .95,
|
||||
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,
|
||||
),
|
||||
),
|
||||
]))));
|
||||
});
|
||||
|
||||
SliverGrid sliverList = SliverGrid(
|
||||
delegate: SliverChildListDelegate(_columnChildren),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1,
|
||||
mainAxisSpacing: 8.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: cWidth > 375 ? 1.8 : 2.0,
|
||||
mainAxisSpacing: 5.0,
|
||||
crossAxisSpacing: 5.0,
|
||||
childAspectRatio: 2,
|
||||
));
|
||||
|
||||
return sliverList;
|
||||
}
|
||||
|
||||
@@ -114,8 +235,7 @@ 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);
|
||||
@@ -130,11 +250,9 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
bool base = workoutTree.base;
|
||||
dynamic returnCode = (base == true)
|
||||
? RoundedRectangleBorder(
|
||||
side: BorderSide(width: 4, color: Colors.orangeAccent),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)))
|
||||
side: BorderSide(width: 6, color: Colors.orangeAccent), borderRadius: BorderRadius.all(Radius.circular(24.0)))
|
||||
: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: Colors.transparent),
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)));
|
||||
side: BorderSide(width: 1, color: Colors.transparent), borderRadius: BorderRadius.all(Radius.circular(8.0)));
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
@@ -142,10 +260,10 @@ class MenuPageWidget extends StatelessWidget with Trans {
|
||||
dynamic image;
|
||||
try {
|
||||
image = ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
child: Image.asset(
|
||||
workoutTree.imageName,
|
||||
height: cHeight * 0.85,
|
||||
height: cHeight,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
String url = Cache.mediaUrl + 'images/' + workoutTree.imageName.substring(11);
|
||||
Widget image = FadeInImage.assetNetwork(
|
||||
|
||||
Reference in New Issue
Block a user