backup. before shop update
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_wisetronic/generated/l10n.dart';
|
||||
import 'package:flutter_wisetronic/widgets/general/text_link.dart';
|
||||
import 'package:flutter_wisetronic/widgets/mobile/mobile_navigation_drawer_header.dart';
|
||||
import '../../routes.dart';
|
||||
import '../../store/store.dart';
|
||||
import '../../events/eventbus.dart';
|
||||
import '../../events/events.dart';
|
||||
import '../../generated/l10n.dart';
|
||||
import '../../models/user.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../../widgets/general/text_link.dart';
|
||||
import '../../widgets/mobile/mobile_navigation_drawer_header.dart';
|
||||
|
||||
import '../../constants.dart';
|
||||
|
||||
@@ -17,6 +23,8 @@ class MobileNavigationDrawer extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
|
||||
User _user;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String currentRoute = ModalRoute.of(context).settings.name;
|
||||
@@ -53,18 +61,19 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
|
||||
),
|
||||
TextLink(
|
||||
S.of(context).tutorials,
|
||||
'/tutorials',
|
||||
Constants.TUTORIAL_URL,
|
||||
paddingVertical: 10.0,
|
||||
paddingHorizontal: 15.0,
|
||||
selected: currentRoute == '/tutorials',
|
||||
closeDrawer: true,
|
||||
isLink: true,
|
||||
),
|
||||
TextLink(
|
||||
S.of(context).support,
|
||||
'/support',
|
||||
'/my-support/${Constants.BUSINESS_ID}',
|
||||
paddingVertical: 10.0,
|
||||
paddingHorizontal: 15.0,
|
||||
selected: currentRoute == '/support',
|
||||
selected: currentRoute == '/my-support/${Constants.BUSINESS_ID}',
|
||||
closeDrawer: true,
|
||||
),
|
||||
TextLink(
|
||||
@@ -77,12 +86,41 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
|
||||
),
|
||||
TextLink(
|
||||
S.of(context).blog,
|
||||
'/blog',
|
||||
'/blog/${Constants.BUSINESS_ID}',
|
||||
paddingVertical: 10.0,
|
||||
paddingHorizontal: 15.0,
|
||||
selected: currentRoute == '/blog',
|
||||
selected: currentRoute == '/blog/${Constants.BUSINESS_ID}',
|
||||
closeDrawer: true,
|
||||
),
|
||||
_user != null ?
|
||||
(currentRoute == '/me') ?
|
||||
GestureDetector(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
S.of(context).logout,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.logout,
|
||||
)
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
|
||||
},
|
||||
) : IconButton(
|
||||
icon: Icon(
|
||||
Icons.account_circle,
|
||||
color: Colors.lightBlueAccent,
|
||||
),
|
||||
onPressed: () {
|
||||
Routes.router.navigateTo(context, '/me');
|
||||
},
|
||||
) :
|
||||
TextLink(
|
||||
S.of(context).login,
|
||||
'/login',
|
||||
@@ -109,28 +147,28 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
|
||||
),
|
||||
TextLink(
|
||||
S.of(context).service_policy,
|
||||
'/service_policy',
|
||||
'/service-policy',
|
||||
paddingVertical: 5.0,
|
||||
paddingHorizontal: 10.0,
|
||||
closeDrawer: true,
|
||||
),
|
||||
TextLink(
|
||||
S.of(context).return_policy,
|
||||
'/return_policy',
|
||||
'/return-policy',
|
||||
paddingVertical: 5.0,
|
||||
paddingHorizontal: 10.0,
|
||||
closeDrawer: true,
|
||||
),
|
||||
TextLink(
|
||||
S.of(context).privacy_policy,
|
||||
'/privacy_policy',
|
||||
'/privacy-policy',
|
||||
paddingVertical: 5.0,
|
||||
paddingHorizontal: 10.0,
|
||||
closeDrawer: true,
|
||||
),
|
||||
TextLink(
|
||||
S.of(context).license_agreement,
|
||||
'/license_agreement',
|
||||
'/end-user-license-agreement',
|
||||
paddingVertical: 5.0,
|
||||
paddingHorizontal: 10.0,
|
||||
closeDrawer: true,
|
||||
@@ -147,10 +185,10 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
|
||||
),
|
||||
),
|
||||
TextLink(S.of(context).wiki, '/wiki', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).support_ticket, '/support_ticket', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).contact_us, '/contact_us', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).about_us, '/about_us', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).renew_license, '/renew_license', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).support_ticket, '/my-support/${Constants.BUSINESS_ID}', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).contact_us, '/contact-us', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).about_us, '/about-us', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
TextLink(S.of(context).renew_license, '/renew-license', paddingVertical: 5.0, paddingHorizontal: 10.0, closeDrawer: true,),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 20.0, bottom: 10.0),
|
||||
child: Text(
|
||||
@@ -238,10 +276,66 @@ class MobileNavigationDrawerState extends State<MobileNavigationDrawer> {
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 6.0, right: 6.0, top: 12.0, bottom: 18.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
'© 2007-${DateTime.now().year} wisetronic.com. All Rights Reserved.',
|
||||
style: TextStyle(
|
||||
fontSize: 10.0,
|
||||
color: Colors.black38,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 6.0),
|
||||
child: Text(
|
||||
'All logos shown are registered trademark, copyrighted and belong to their respective owners.',
|
||||
style: TextStyle(
|
||||
fontSize: 8.0,
|
||||
color: Colors.black38,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
eventBus.on<OnCurrentUserUpdated>().listen((event) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_user = store.state.user;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
eventBus.on<OnGetCurrentUserFailed>().listen((event) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_user = null;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_user = store.state.user;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user