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