64 lines
1.5 KiB
Dart
64 lines
1.5 KiB
Dart
|
|
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 '../../routes.dart';
|
|
|
|
class MobileNavigationBar extends StatefulWidget {
|
|
final String title;
|
|
final bool back;
|
|
const MobileNavigationBar({Key key, this.title, this.back}) : super(key: key);
|
|
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
return MobileNavigationBarState();
|
|
}
|
|
|
|
}
|
|
|
|
class MobileNavigationBarState extends State<MobileNavigationBar> {
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppBar(
|
|
leading: widget.back ?
|
|
IconButton(
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: Colors.white,
|
|
),
|
|
onPressed: () {
|
|
Routes.router.pop(context);
|
|
},
|
|
) :
|
|
IconButton(
|
|
icon: Icon(
|
|
Icons.menu,
|
|
color: Colors.white,
|
|
),
|
|
onPressed: () {
|
|
eventBus.fire(OpenDrawer());
|
|
},
|
|
),
|
|
title: Container(
|
|
child: widget.title.isNotEmpty ?
|
|
Container(
|
|
child: Text(
|
|
'${widget.title}',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 24.0,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
) :
|
|
NavigationBarLogo(),
|
|
padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0),
|
|
),
|
|
centerTitle: true,
|
|
);
|
|
}
|
|
|
|
} |