backup. before shop update
This commit is contained in:
143
lib/widgets/desktop/desktop_appbar_menu.dart
Normal file
143
lib/widgets/desktop/desktop_appbar_menu.dart
Normal file
@@ -0,0 +1,143 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
|
||||
import '../../constants.dart';
|
||||
import '../../dialog/logout_dialog.dart';
|
||||
import '../../generated/l10n.dart';
|
||||
import '../../models/user.dart';
|
||||
import '../../routes.dart';
|
||||
import '../../store/store.dart';
|
||||
import '../../widgets/general/navigationbar_logo.dart';
|
||||
import '../../widgets/general/text_link.dart';
|
||||
|
||||
class DesktopAppBarMenu extends StatelessWidget {
|
||||
User _user;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_user = store.state.user;
|
||||
String currentRoute = ModalRoute.of(context).settings.name;
|
||||
Widget menuBar = Container(
|
||||
height: 56.0,
|
||||
padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0),
|
||||
color: Colors.blue,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
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,
|
||||
Constants.TUTORIAL_URL,
|
||||
color: Colors.white,
|
||||
selected: currentRoute == '/tutorials',
|
||||
isLink: true,
|
||||
),
|
||||
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',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
return menuBar;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user