backup. before shop update
This commit is contained in:
@@ -1,12 +1,29 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_wisetronic/generated/l10n.dart';
|
||||
import 'package:flutter_wisetronic/widgets/general/navigationbar_logo.dart';
|
||||
import 'package:flutter_wisetronic/widgets/general/text_link.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_wisetronic/widgets/desktop/desktop_appbar_menu.dart';
|
||||
import '../../widgets/general/breadcrumbs.dart';
|
||||
|
||||
import '../../constants.dart';
|
||||
import '../../dialog/logout_dialog.dart';
|
||||
import '../../events/eventbus.dart';
|
||||
import '../../events/events.dart';
|
||||
import '../../generated/l10n.dart';
|
||||
import '../../models/user.dart';
|
||||
import '../../routes.dart';
|
||||
import '../../store/store.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../../widgets/general/navigationbar_logo.dart';
|
||||
import '../../widgets/general/text_link.dart';
|
||||
|
||||
class DesktopNavigationBar extends StatefulWidget {
|
||||
const DesktopNavigationBar({Key key}) : super(key: key);
|
||||
final bool hasBack;
|
||||
final List<BreadCrumb> breadCrumbs;
|
||||
final Widget shoppingCart;
|
||||
|
||||
const DesktopNavigationBar({Key key, this.hasBack, this.breadCrumbs,
|
||||
this.shoppingCart}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -16,92 +33,201 @@ class DesktopNavigationBar extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopNavigationBarState extends State<DesktopNavigationBar> {
|
||||
User _user;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String currentRoute = ModalRoute.of(context).settings.name;
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.blue,
|
||||
height: 80.0,
|
||||
),
|
||||
Container(
|
||||
height: 80.0,
|
||||
padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
NavigationBarLogo(),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
padding: EdgeInsets.only(left: 8.0, right: 16.0),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(width: 20.0,),
|
||||
TextLink(
|
||||
S.of(context).home,
|
||||
'/',
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/',
|
||||
clearStack: true,
|
||||
),
|
||||
SizedBox(width: 15.0,),
|
||||
TextLink(
|
||||
S.of(context).download,
|
||||
'/download',
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/download',
|
||||
),
|
||||
SizedBox(width: 15.0,),
|
||||
TextLink(
|
||||
S.of(context).tutorials,
|
||||
'/tutorials',
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/tutorials',
|
||||
),
|
||||
SizedBox(width: 15.0,),
|
||||
TextLink(
|
||||
S.of(context).support,
|
||||
'/support',
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/support',
|
||||
),
|
||||
SizedBox(width: 15.0,),
|
||||
TextLink(
|
||||
S.of(context).shop,
|
||||
'/shop',
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/shop',
|
||||
),
|
||||
SizedBox(width: 15.0,),
|
||||
TextLink(
|
||||
S.of(context).blog,
|
||||
'/blog',
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/blog',
|
||||
),
|
||||
SizedBox(width: 15.0,),
|
||||
TextLink(
|
||||
S.of(context).login,
|
||||
'/login',
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/login',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// String currentRoute = ModalRoute.of(context).settings.name;
|
||||
// Stack stack = Stack(
|
||||
// children: [
|
||||
// Container(
|
||||
// color: Colors.blue,
|
||||
// height: 80.0,
|
||||
// ),
|
||||
// Container(
|
||||
// height: 80.0,
|
||||
// padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// NavigationBarLogo(),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerRight,
|
||||
// padding: EdgeInsets.only(left: 8.0, right: 16.0),
|
||||
// child: SingleChildScrollView(
|
||||
// scrollDirection: Axis.horizontal,
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// SizedBox(width: 20.0,),
|
||||
// TextLink(
|
||||
// S.of(context).home,
|
||||
// '/',
|
||||
// color: Colors.white,
|
||||
// selected: currentRoute == '/',
|
||||
// clearStack: true,
|
||||
// ),
|
||||
// SizedBox(width: 15.0,),
|
||||
// TextLink(
|
||||
// S.of(context).download,
|
||||
// '/download',
|
||||
// color: Colors.white,
|
||||
// selected: currentRoute == '/download',
|
||||
// ),
|
||||
// SizedBox(width: 15.0,),
|
||||
// TextLink(
|
||||
// S.of(context).tutorials,
|
||||
// '/tutorials',
|
||||
// color: Colors.white,
|
||||
// selected: currentRoute == '/tutorials',
|
||||
// ),
|
||||
// SizedBox(width: 15.0,),
|
||||
// TextLink(
|
||||
// S.of(context).support,
|
||||
// '/my-support/${Constants.BUSINESS_ID}',
|
||||
// color: Colors.white,
|
||||
// selected: currentRoute == '/my-support/${Constants.BUSINESS_ID}',
|
||||
// ),
|
||||
// SizedBox(width: 15.0,),
|
||||
// TextLink(
|
||||
// S.of(context).shop,
|
||||
// '/shop',
|
||||
// color: Colors.white,
|
||||
// selected: currentRoute == '/shop',
|
||||
// ),
|
||||
// SizedBox(width: 15.0,),
|
||||
// TextLink(
|
||||
// S.of(context).blog,
|
||||
// '/blog/${Constants.BUSINESS_ID}',
|
||||
// color: Colors.white,
|
||||
// selected: currentRoute == '/blog/${Constants.BUSINESS_ID}',
|
||||
// ),
|
||||
// SizedBox(width: 15.0,),
|
||||
// _user != null ?
|
||||
// (currentRoute == '/me') ?
|
||||
// MouseRegion(
|
||||
// cursor: SystemMouseCursors.click,
|
||||
// child: GestureDetector(
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(right: 4.0),
|
||||
// child: Text(
|
||||
// S.of(context).logout,
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Icon(
|
||||
// Icons.logout,
|
||||
// color: Colors.white,
|
||||
// size: 16.0,
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// onTap: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return logoutDialog(context);
|
||||
// }
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ) : IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.account_circle,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// Routes.router.navigateTo(context, '/me');
|
||||
// },
|
||||
// ) :
|
||||
// TextLink(
|
||||
// S.of(context).login,
|
||||
// '/login',
|
||||
// color: Colors.white,
|
||||
// selected: currentRoute == '/login',
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
Widget sc = SizedBox.shrink();
|
||||
if (widget.shoppingCart != null) {
|
||||
sc = widget.shoppingCart;
|
||||
}
|
||||
Widget breadCrumbBar = SizedBox.shrink();
|
||||
if (widget.breadCrumbs != null && widget.breadCrumbs.length > 0) {
|
||||
breadCrumbBar = Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 38.0,
|
||||
color: Color(0xFF4FB0C6),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: BreadCrumbs(
|
||||
widget.hasBack ?? false,
|
||||
breadCrumbs: widget.breadCrumbs,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
sc,
|
||||
Container(
|
||||
width: 1.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
// stack.children.add(
|
||||
// Positioned(
|
||||
// top: 90.0,
|
||||
// child: breadCrumbBar,
|
||||
// ),
|
||||
// );
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
DesktopAppBarMenu(),
|
||||
breadCrumbBar,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@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) {
|
||||
Utils.getCurrentUser();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user