From e48f4b56861707d74b43a775e237d79ae1cf966b Mon Sep 17 00:00:00 2001 From: Daniel Borges Date: Tue, 6 Aug 2019 18:05:35 -0300 Subject: [PATCH] routes + some structure improvements --- lib/main.dart | 13 +++++++- lib/src/openlp_remote_app.dart | 56 ++++++++++++++++------------------ lib/src/widgets/settings.dart | 20 ++++++++++++ 3 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 lib/src/widgets/settings.dart diff --git a/lib/main.dart b/lib/main.dart index e999d2d..77b1fe5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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: { + '/': (context) => OpenLPRemoteApp(), + '/settings': (context) => Settings(), + }, + ), + ); diff --git a/lib/src/openlp_remote_app.dart b/lib/src/openlp_remote_app.dart index 01d6f16..d3ad085 100644 --- a/lib/src/openlp_remote_app.dart +++ b/lib/src/openlp_remote_app.dart @@ -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 @override Widget build(BuildContext context) { - return MaterialApp( - debugShowCheckedModeBanner: false, - theme: appTheme, - home: Scaffold( - appBar: AppBar( - title: Text('OpenLP Remote'), - actions: [ - IconButton( - icon: Icon(Icons.settings), - onPressed: () {}, - tooltip: 'Settings', - ), - ], - bottom: TabBar( - tabs: [ - Tab(text: 'SERVICE'), - Tab(text: 'SLIDES'), - ], - controller: tabController, + return Scaffold( + appBar: AppBar( + title: Text('OpenLP Remote'), + actions: [ + IconButton( + icon: Icon(Icons.settings), + onPressed: () { + Navigator.of(context).pushNamed('/settings'); + }, + tooltip: 'Settings', ), - ), - body: TabBarView( - controller: tabController, - children: [ - ServiceListView(), - SlideListView(), + ], + bottom: TabBar( + tabs: [ + Tab(text: 'SERVICE'), + Tab(text: 'SLIDES'), ], + controller: tabController, ), - floatingActionButton: SearchFloatingButton(), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - bottomNavigationBar: AppBottomNavigationBar(), ), + body: TabBarView( + controller: tabController, + children: [ + ServiceListView(), + SlideListView(), + ], + ), + floatingActionButton: SearchFloatingButton(), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: AppBottomNavigationBar(), ); } } diff --git a/lib/src/widgets/settings.dart b/lib/src/widgets/settings.dart new file mode 100644 index 0000000..cfe3299 --- /dev/null +++ b/lib/src/widgets/settings.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +class Settings extends StatefulWidget { + @override + State createState() => _SettingState(); + +} + +class _SettingState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Settings'), + ), + body: Container(), + ); + } + +} \ No newline at end of file