backup. before shop update
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_wisetronic/events/eventbus.dart';
|
||||
import 'package:flutter_wisetronic/events/events.dart';
|
||||
import 'package:flutter_wisetronic/widgets/general/navigationbar_logo.dart';
|
||||
import '../../models/user.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../../events/eventbus.dart';
|
||||
import '../../events/events.dart';
|
||||
import '../../store/store.dart';
|
||||
import '../../widgets/general/navigationbar_logo.dart';
|
||||
|
||||
import '../../routes.dart';
|
||||
|
||||
class MobileNavigationBar extends StatefulWidget {
|
||||
final String title;
|
||||
final bool back;
|
||||
const MobileNavigationBar({Key key, this.title, this.back}) : super(key: key);
|
||||
final bool toHome;
|
||||
final bool showMe;
|
||||
const MobileNavigationBar({Key key, this.title, this.back, this.toHome, this.showMe}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -19,6 +24,7 @@ class MobileNavigationBar extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileNavigationBarState extends State<MobileNavigationBar> {
|
||||
User _user;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -30,7 +36,11 @@ class MobileNavigationBarState extends State<MobileNavigationBar> {
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
Routes.router.pop(context);
|
||||
if (widget.toHome) {
|
||||
Routes.router.navigateTo(context, '/', clearStack: true);
|
||||
} else {
|
||||
Routes.router.pop(context);
|
||||
}
|
||||
},
|
||||
) :
|
||||
IconButton(
|
||||
@@ -58,7 +68,53 @@ class MobileNavigationBarState extends State<MobileNavigationBar> {
|
||||
padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0),
|
||||
),
|
||||
centerTitle: true,
|
||||
actions: actions(),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> actions() {
|
||||
List<Widget> ws = [];
|
||||
// if (store.state.user != null && widget.showMe) {
|
||||
// if (ModalRoute.of(context).settings.name != '/me') {
|
||||
// ws.add(IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.account_circle,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// Routes.router.navigateTo(context, '/me');
|
||||
// }
|
||||
// ));
|
||||
// }
|
||||
// }
|
||||
return ws;
|
||||
}
|
||||
|
||||
@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