WT1.1.0+40 Premium feature settings
This commit is contained in:
@@ -245,7 +245,7 @@ class _BMIState extends State<BMI> with Trans {
|
||||
icon: Icon(Icons.save),
|
||||
hoverColor: Colors.blueAccent,
|
||||
color: widget.exerciseBloc.changedWeight ? Colors.blue[200] : Colors.black54,
|
||||
onPressed: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())})
|
||||
onPressed: () => {widget.exerciseBloc.add(ExerciseNewSaveWeight())})
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
@@ -191,7 +191,6 @@ class _BMRState extends State<BMR> with Trans {
|
||||
selectedItem: FitnessItem().getItem(fitnessLevel),
|
||||
itemAsString: (data) => t(data.stateText),
|
||||
onChanged: (data) {
|
||||
print(data);
|
||||
widget.exerciseBloc.add(ExerciseNewFitnessLevelChange(value: data.value));
|
||||
},
|
||||
dropdownBuilder: _customDropDownItem,
|
||||
@@ -290,7 +289,7 @@ class _BMRState extends State<BMR> with Trans {
|
||||
icon: Icon(Icons.save),
|
||||
hoverColor: Colors.blueAccent,
|
||||
color: widget.exerciseBloc.changedWeight ? Colors.blue[200] : Colors.black54,
|
||||
onPressed: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())})
|
||||
onPressed: () => {widget.exerciseBloc.add(ExerciseNewSaveWeight())})
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class DialogPremium extends StatefulWidget {
|
||||
final String title, descriptions, text;
|
||||
final VoidCallback onTap;
|
||||
final VoidCallback onCancel;
|
||||
String description2;
|
||||
final Image img;
|
||||
|
||||
DialogPremium({Key key, this.title, this.descriptions, this.description2, this.text, this.img, this.onTap, this.onCancel})
|
||||
: super(key: key) {
|
||||
description2 = description2 ?? "";
|
||||
}
|
||||
|
||||
@override
|
||||
_DialogPremiumState createState() {
|
||||
return _DialogPremiumState();
|
||||
}
|
||||
}
|
||||
|
||||
class _DialogPremiumState extends State<DialogPremium> with Trans {
|
||||
bool isStart = true;
|
||||
Timer _timer;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(31),
|
||||
),
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
child: contentBox(context),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
isStart = true;
|
||||
_timer = Timer.periodic(
|
||||
Duration(milliseconds: 1000),
|
||||
(Timer timer) => setState(() {
|
||||
isStart = !isStart;
|
||||
}));
|
||||
super.initState();
|
||||
}
|
||||
|
||||
contentBox(context) {
|
||||
return Stack(alignment: AlignmentDirectional.topStart, children: [
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20, top: 24, right: 20, bottom: 30),
|
||||
margin: EdgeInsets.only(top: 30),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: [BoxShadow(color: Colors.black, offset: Offset(0, 10), blurRadius: 10)],
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_black_G_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Stack(
|
||||
alignment: AlignmentDirectional.topEnd,
|
||||
children: [
|
||||
Text(
|
||||
widget.title + " ",
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 24,
|
||||
color: Colors.yellow[400],
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 3,
|
||||
top: 0,
|
||||
child: AnimatedSwitcher(
|
||||
duration: Duration(milliseconds: 900),
|
||||
//reverseDuration: Duration(milliseconds: 200),
|
||||
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||
return FadeTransition(child: child, opacity: animation);
|
||||
},
|
||||
child: isStart
|
||||
? Icon(
|
||||
CustomIcon.star_2,
|
||||
color: Colors.yellow[300],
|
||||
)
|
||||
: Offstage() /* Icon(
|
||||
CustomIcon.exclamation_circle,
|
||||
color: Colors.yellow[300],
|
||||
) */
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 35,
|
||||
),
|
||||
Text(
|
||||
widget.descriptions,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Text(
|
||||
widget.description2,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(
|
||||
height: 62,
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: widget.onTap ?? widget.onTap,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Image.asset('asset/icon/gomb_orange_c.png', width: 100, height: 45),
|
||||
Text(
|
||||
t("OK"),
|
||||
style: TextStyle(fontSize: 16, color: Colors.white),
|
||||
),
|
||||
],
|
||||
))),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onCancel == null ? Navigator.of(context).pop() : widget.onCancel,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.transparent,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
"X",
|
||||
style: GoogleFonts.archivoBlack(fontSize: 32, color: Colors.white54),
|
||||
),
|
||||
)),
|
||||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_timer.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
+32
-37
@@ -1,6 +1,7 @@
|
||||
import 'package:aitrainer_app/bloc/session/session_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/settings/settings_bloc.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/view/login.dart';
|
||||
import 'package:aitrainer_app/view/menu_page.dart';
|
||||
import 'package:aitrainer_app/view/registration.dart';
|
||||
@@ -11,7 +12,6 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'loading.dart';
|
||||
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AitrainerHome extends StatefulWidget {
|
||||
_HomePageState _state;
|
||||
@@ -22,7 +22,7 @@ class AitrainerHome extends StatefulWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _HomePageState extends State<AitrainerHome> {
|
||||
class _HomePageState extends State<AitrainerHome> with Logging {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
@@ -37,7 +37,7 @@ class _HomePageState extends State<AitrainerHome> {
|
||||
|
||||
Future runDelayedEvent() async {
|
||||
await Future.delayed(Duration(seconds: 2), () async {
|
||||
if ( context != null) {
|
||||
if (context != null) {
|
||||
// ignore: close_sinks
|
||||
SessionBloc sessionBloc = BlocProvider.of<SessionBloc>(context);
|
||||
if (sessionBloc.state != SessionReady()) {
|
||||
@@ -49,45 +49,40 @@ class _HomePageState extends State<AitrainerHome> {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
body: Container(
|
||||
child: BlocConsumer<SessionBloc, SessionState>(
|
||||
listener: (context, state) {
|
||||
if ( state is SessionFailure) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
),
|
||||
backgroundColor: Colors.orange,
|
||||
));
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is SessionInitial) {
|
||||
return LoadingScreenMain();
|
||||
} else if (state is SessionLoading) {
|
||||
print("loading");
|
||||
return LoadingScreenMain();
|
||||
} else if (state is SessionReady) {
|
||||
print("ready menu with " + Cache().startPage);
|
||||
if (Cache().startPage == 'login') {
|
||||
return LoginPage();
|
||||
} else if (Cache().startPage == 'registration') {
|
||||
return RegistrationPage();
|
||||
} else {
|
||||
return MenuPage(parent: 0);
|
||||
}
|
||||
} else {
|
||||
print("else");
|
||||
return MenuPage(parent: 0);
|
||||
}
|
||||
body: BlocConsumer<SessionBloc, SessionState>(listener: (context, state) {
|
||||
if (state is SessionFailure) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
),
|
||||
backgroundColor: Colors.orange,
|
||||
));
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
if (state is SessionInitial) {
|
||||
return LoadingScreenMain();
|
||||
} else if (state is SessionLoading) {
|
||||
log("loading");
|
||||
return LoadingScreenMain();
|
||||
} else if (state is SessionReady) {
|
||||
log("ready menu with " + Cache().startPage);
|
||||
if (Cache().startPage == 'login') {
|
||||
return LoginPage();
|
||||
} else if (Cache().startPage == 'registration') {
|
||||
return RegistrationPage();
|
||||
} else {
|
||||
return MenuPage(parent: 0);
|
||||
}
|
||||
),
|
||||
),
|
||||
//bottomNavigationBar: BottomNavigator(bottomNavIndex: 0),
|
||||
} else {
|
||||
log("else");
|
||||
return MenuPage(parent: 0);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class ImageButton extends StatelessWidget {
|
||||
final String text;
|
||||
TextStyle style = TextStyle(fontSize: 14);
|
||||
final String image;
|
||||
final double top;
|
||||
double top;
|
||||
final double left;
|
||||
double height;
|
||||
double width;
|
||||
@@ -49,9 +49,10 @@ class ImageButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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());
|
||||
if (top == null) {
|
||||
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,
|
||||
|
||||
@@ -94,10 +94,7 @@ class MenuInfoWidget extends StatelessWidget with Common {
|
||||
link,
|
||||
style: TextStyle(color: Colors.lightBlueAccent, fontSize: textSize, fontFamily: 'Arial', fontWeight: textWeight),
|
||||
),
|
||||
onTap: () => {
|
||||
missingId = bloc.menuTreeRepository.getMissingTreeIdByName(bloc.missingTreeName),
|
||||
print("menu " + missingId.toString()),
|
||||
bloc.add(MenuTreeJump(parent: missingId))
|
||||
});
|
||||
onTap: () =>
|
||||
{missingId = bloc.menuTreeRepository.getMissingTreeIdByName(bloc.missingTreeName), bloc.add(MenuTreeJump(parent: missingId))});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class SalesButton extends StatelessWidget {
|
||||
TextStyle style = TextStyle(fontSize: 14);
|
||||
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;
|
||||
final Color badgeColor;
|
||||
final VoidCallback onTap;
|
||||
|
||||
SalesButton(
|
||||
{this.title,
|
||||
this.price,
|
||||
this.desc1,
|
||||
this.desc2,
|
||||
this.desc3,
|
||||
this.desc4,
|
||||
this.badgeText,
|
||||
this.badgeColor,
|
||||
this.onTap,
|
||||
this.style,
|
||||
this.descStyle}) {
|
||||
style = style ??
|
||||
GoogleFonts.archivoBlack(
|
||||
fontSize: 14,
|
||||
);
|
||||
desc4 = desc4 ?? "";
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_sales_background_3x5.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: Badge(
|
||||
position: BadgePosition.topEnd(end: -3, top: -5),
|
||||
padding: EdgeInsets.all(5),
|
||||
badgeColor: badgeColor,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
shape: BadgeShape.square,
|
||||
badgeContent: badgeText != null
|
||||
? Text(badgeText,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
backgroundColor: badgeColor,
|
||||
fontSize: 12,
|
||||
))
|
||||
: Text("",
|
||||
style: TextStyle(
|
||||
color: Colors.transparent,
|
||||
backgroundColor: Colors.transparent,
|
||||
fontSize: 1,
|
||||
)),
|
||||
child: Container(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: GoogleFonts.archivoBlack(color: Colors.black54),
|
||||
),
|
||||
Text(
|
||||
price,
|
||||
style: style,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5, left: 3, right: 3, bottom: 4), child: Text(desc1, maxLines: 2, style: descStyle)),
|
||||
Container(padding: EdgeInsets.only(left: 3, right: 3, bottom: 4), child: Text(desc2, maxLines: 2, style: descStyle)),
|
||||
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])))
|
||||
],
|
||||
),
|
||||
)),
|
||||
)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user