routes + some structure improvements

This commit is contained in:
Daniel Borges 2019-08-06 18:05:35 -03:00
parent 8eeb37c28c
commit e48f4b5686
3 changed files with 58 additions and 31 deletions

View File

@ -1,5 +1,16 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'src/openlp_remote_app.dart'; import 'src/openlp_remote_app.dart';
import 'src/app_theme.dart';
import 'src/widgets/settings.dart';
void main() => runApp(OpenLPRemoteApp()); void main() => runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
theme: appTheme,
routes: <String, WidgetBuilder>{
'/': (context) => OpenLPRemoteApp(),
'/settings': (context) => Settings(),
},
),
);

View File

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'app_theme.dart';
import 'widgets/bottom_navigation_bar.dart'; import 'widgets/bottom_navigation_bar.dart';
import 'widgets/search_floating_button.dart'; import 'widgets/search_floating_button.dart';
import 'widgets/service_listview.dart'; import 'widgets/service_listview.dart';
@ -24,38 +22,36 @@ class _OpenLPRemoteAppState extends State<OpenLPRemoteApp>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return Scaffold(
debugShowCheckedModeBanner: false, appBar: AppBar(
theme: appTheme, title: Text('OpenLP Remote'),
home: Scaffold( actions: <Widget>[
appBar: AppBar( IconButton(
title: Text('OpenLP Remote'), icon: Icon(Icons.settings),
actions: <Widget>[ onPressed: () {
IconButton( Navigator.of(context).pushNamed('/settings');
icon: Icon(Icons.settings), },
onPressed: () {}, tooltip: 'Settings',
tooltip: 'Settings',
),
],
bottom: TabBar(
tabs: <Widget>[
Tab(text: 'SERVICE'),
Tab(text: 'SLIDES'),
],
controller: tabController,
), ),
), ],
body: TabBarView( bottom: TabBar(
controller: tabController, tabs: <Widget>[
children: <Widget>[ Tab(text: 'SERVICE'),
ServiceListView(), Tab(text: 'SLIDES'),
SlideListView(),
], ],
controller: tabController,
), ),
floatingActionButton: SearchFloatingButton(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: AppBottomNavigationBar(),
), ),
body: TabBarView(
controller: tabController,
children: <Widget>[
ServiceListView(),
SlideListView(),
],
),
floatingActionButton: SearchFloatingButton(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: AppBottomNavigationBar(),
); );
} }
} }

View File

@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
class Settings extends StatefulWidget {
@override
State<StatefulWidget> createState() => _SettingState();
}
class _SettingState extends State<Settings> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Settings'),
),
body: Container(),
);
}
}