openlp-mobile-remote/lib/src/openlp_mobile_remote_app.dart

83 lines
3.0 KiB
Dart

// OpenLP Mobile Remote
// ---------------------------------------------------------------------------
// Copyright (c) 2008-2019 OpenLP Developers
// ---------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
import 'package:flutter/material.dart';
import 'configurations/app_localizations.dart';
import 'widgets/bottom_navigation_bar.dart';
import 'widgets/search_floating_button.dart';
import 'screens/service_list_view.dart';
import 'screens/slides_list_view.dart';
class OpenLPMobileRemoteApp extends StatefulWidget {
@override
_OpenLPMobileRemoteAppState createState() => _OpenLPMobileRemoteAppState();
}
class _OpenLPMobileRemoteAppState extends State<OpenLPMobileRemoteApp>
with SingleTickerProviderStateMixin {
TabController tabController;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
void initState() {
super.initState();
tabController = TabController(length: 2, vsync: this);
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text('OpenLP Remote'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.settings),
onPressed: () {
Navigator.of(context).pushNamed('/settings');
},
tooltip: 'Settings',
),
],
bottom: TabBar(
tabs: <Widget>[
Tab(text: AppLocalizations.of(context).translate('tab_service')),
Tab(text: AppLocalizations.of(context).translate('tab_slides')),
],
controller: tabController,
),
),
body: TabBarView(
controller: tabController,
children: <Widget>[
ServiceListView(),
SlidesListView(),
],
),
floatingActionButton: SearchFloatingButton(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: AppBottomNavigationBar(_scaffoldKey),
);
}
}