50 lines
1.4 KiB
Dart
50 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:hiddingsel_app/appflow/view/menu_pages/start.dart';
|
|
import 'package:hiddingsel_app/appflow/view/navigation_drawer.dart' as nd;
|
|
|
|
import '../../main.dart';
|
|
|
|
class Home extends StatelessWidget {
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
PreferredSizeWidget? _appBar;
|
|
Widget? _body;
|
|
return StatefulBuilder(
|
|
builder: (context, setState) {
|
|
Function(PreferredSizeWidget appBar, Widget body) onChange =
|
|
(appBar, newBody) => setState(() {
|
|
_appBar = appBar;
|
|
_body = newBody;
|
|
},);
|
|
if(_appBar == null) {
|
|
StartView item = StartView(onChange);
|
|
_appBar = item.getAppBar();
|
|
_body = item;
|
|
}
|
|
return Scaffold(
|
|
appBar: _appBar,
|
|
body: _body,
|
|
drawer: nd.NavigationDrawer(onChange),
|
|
bottomNavigationBar: nd.NavigationBottomBar(onChange),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
static void openPage(nd.NavigationDrawerItem item, onChange, {String? optionalTitle}) {
|
|
navigatorKey.currentState?.push(
|
|
MaterialPageRoute(
|
|
builder: (context) => Scaffold(
|
|
appBar: item.getAppBar(optionalTitle: optionalTitle),
|
|
body: item,
|
|
bottomNavigationBar: nd.NavigationBottomBar((PreferredSizeWidget appBar, Widget body) {
|
|
Navigator.pop(context);
|
|
onChange(appBar, body);
|
|
}),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|