Aitrainer_app 1.1.1
test menu, customer modification, exercise save images, localization
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BottomNavigator {
|
||||
BottomNavigationBar buildBottomNavigator(BuildContext context, State state) {
|
||||
return BottomNavigationBar(
|
||||
currentIndex: 0, // this will be set when a new tab is tapped
|
||||
backgroundColor: Colors.black12,
|
||||
selectedItemColor: Colors.yellow,
|
||||
unselectedItemColor: Colors.lightGreen,
|
||||
type: BottomNavigationBarType.shifting,
|
||||
showSelectedLabels: 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")),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: new Icon(Icons.event, color: Colors.lightGreen),
|
||||
activeIcon: new Icon(Icons.event, color: Colors.yellow,),
|
||||
title: new Text(AppLocalizations.of(context).translate("Events")),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person, color: Colors.lightGreen,),
|
||||
activeIcon: new Icon(Icons.person, color: Colors.yellow,),
|
||||
title: Text(AppLocalizations.of(context).translate("Account"))
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.settings, color: Colors.lightGreen),
|
||||
activeIcon: new Icon(Icons.settings, color: Colors.yellow,),
|
||||
title: Text(AppLocalizations.of(context).translate("Settings"))
|
||||
)
|
||||
],
|
||||
onTap:(index) {
|
||||
// ignore: invalid_use_of_protected_member
|
||||
switch (index) {
|
||||
case 0:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('home');
|
||||
|
||||
break;
|
||||
case 2:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('account');
|
||||
|
||||
break;
|
||||
case 3:
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed('settings');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ class _CustomerListWidget extends State<CustomerListWidget> {
|
||||
visible: customer.visibleDetails,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(customer.age.toString() + " years, " + customer.sex),
|
||||
Text(customer.birthYear.toString() + " years, " + customer.sex),
|
||||
new RaisedButton(
|
||||
child: new Text('Modify'),
|
||||
color: Color.fromRGBO(244, 122, 22, 0.9),
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/view/menu_page.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'bottom_nav.dart';
|
||||
import 'nav_drawer.dart';
|
||||
|
||||
class AitrainerHome extends StatefulWidget {
|
||||
_HomePageState _state;
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
_state = new _HomePageState();
|
||||
return _state;
|
||||
}
|
||||
|
||||
void callback() {
|
||||
_state.setLangNoContext();
|
||||
}
|
||||
}
|
||||
|
||||
class _HomePageState extends State<AitrainerHome> {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
final AppLanguage appLanguage = AppLanguage();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MenuPage menu = MenuPage();
|
||||
BottomNavigator bottomNav = BottomNavigator();
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
drawer: NavDrawer(),
|
||||
body:Container(
|
||||
child: MenuPage(parent: 0),
|
||||
),
|
||||
bottomNavigationBar: bottomNav.buildBottomNavigator(context, widget._state)
|
||||
);
|
||||
}
|
||||
|
||||
void setLangNoContext() {
|
||||
print("--- Callback ");
|
||||
setState(() {
|
||||
final AppLanguage appLanguage = AppLanguage();
|
||||
AppLocalizations.of(context).setLocale(appLanguage.appLocal);
|
||||
AppLocalizations.of(context).load();
|
||||
print("--- Lang for context reloaded");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import 'package:aitrainer_app/util/message_state.dart';
|
||||
import 'package:aitrainer_app/util/session.dart';
|
||||
import 'package:aitrainer_app/view/menu_page.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/home.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'file:///D:/projects/aitrainer/src/aitrainer_app/lib/util/loading_screen.dart';
|
||||
|
||||
class LoadingScreenMain extends StatefulWidget {
|
||||
@override
|
||||
LoadingScreenMainState createState() => LoadingScreenMainState();
|
||||
}
|
||||
|
||||
class LoadingScreenMainState extends State<LoadingScreenMain> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Image _backgroundImage = Image.asset('asset/WT01_loading_layers.png',
|
||||
fit: BoxFit.cover,
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
);
|
||||
dynamic _timer = <dynamic>[TimeMessages.timer];
|
||||
return Scaffold(
|
||||
body: LoadingScreen(
|
||||
initializers: _timer,
|
||||
navigateToWidget: AitrainerHome(),
|
||||
loaderColor: Colors.yellow,
|
||||
image: _backgroundImage,
|
||||
backgroundColor: Colors.black,
|
||||
styleTextUnderTheLoader: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.lightGreenAccent),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class TimeMessages {
|
||||
static Future timer(MessageState state, Function callback) async {
|
||||
//while (true) {
|
||||
await Future.delayed(Duration(seconds: 4), () {
|
||||
state.setMessage = DateTime.now().toIso8601String();
|
||||
print("---- TimeMessages initializer");
|
||||
Session session = Session();
|
||||
session.fetchSessionAndNavigate(callback);
|
||||
});
|
||||
//}
|
||||
}
|
||||
}
|
||||
+47
-15
@@ -1,8 +1,25 @@
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NavDrawer extends StatelessWidget {
|
||||
class NavDrawer extends StatefulWidget {
|
||||
|
||||
@override
|
||||
_NawDrawerWidget createState() => _NawDrawerWidget();
|
||||
}
|
||||
|
||||
class _NawDrawerWidget extends State<NavDrawer> {
|
||||
final Auth auth = Auth();
|
||||
final AppLanguage appLanguage = AppLanguage();
|
||||
Locale _locale;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
@@ -11,49 +28,64 @@ class NavDrawer extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
child: Text(
|
||||
'Customers And Exercises',
|
||||
AppLocalizations.of(context).translate('Customers And Exercises'),
|
||||
style: TextStyle(color: Colors.blue, fontSize: 25),
|
||||
),
|
||||
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.home),
|
||||
title: Text('Home'),
|
||||
title: Text( AppLocalizations.of(context).translate('Home')),
|
||||
onTap: () => Navigator.of(context).pushNamed('home'),
|
||||
),
|
||||
|
||||
ListTile(
|
||||
leading: Icon(Icons.people),
|
||||
title: Text('Customers'),
|
||||
//onTap: () => navigateToPage(context, 'customersPage'),
|
||||
title: Text( AppLocalizations.of(context).translate('Customers')),
|
||||
onTap: () => Navigator.of(context).pushNamed('customersPage'),
|
||||
),
|
||||
|
||||
ListTile(
|
||||
leading: Icon(Icons.directions_run),
|
||||
title: Text('Exercises'),
|
||||
onTap: () => Navigator.of(context).pushNamed('exerciseTypeListPage'),
|
||||
title: Text(AppLocalizations.of(context).translate('Exercises')),
|
||||
onTap: () =>
|
||||
Navigator.of(context).pushNamed('exerciseTypeListPage'),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.arrow_upward),
|
||||
title: Text("TRAINING!"),
|
||||
title: Text(AppLocalizations.of(context).translate("TRAINING!")),
|
||||
onTap: () => Navigator.of(context).pushNamed('exerciseNewPage'),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.perm_identity),
|
||||
title: Text('Login'),
|
||||
title: Text(AppLocalizations.of(context).translate('Login')),
|
||||
onTap: () => Navigator.of(context).pushNamed('login'),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.cancel),
|
||||
title: Text("Logout"),
|
||||
onTap: () => {
|
||||
auth.logout(),
|
||||
Navigator.of(context).pushNamed('home'),
|
||||
}
|
||||
leading: Icon(Icons.cancel),
|
||||
title: Text(AppLocalizations.of(context).translate('Logout')),
|
||||
onTap: () =>
|
||||
{
|
||||
auth.logout(),
|
||||
Navigator.of(context).pushNamed('home'),
|
||||
}
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.hearing),
|
||||
title: Text(AppLocalizations.of(context).translate('Change Language')),
|
||||
onTap: () => _tapped(),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _tapped() => {
|
||||
/* _locale = Locale("hu"),
|
||||
appLanguage.changeLanguage(_locale),
|
||||
AppLocalizations.of(context).setLocale(_locale),
|
||||
AppLocalizations.of(context).load() */
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user