services V2

This commit is contained in:
Daniel Borges 2019-08-05 18:06:39 -03:00
parent 41e0831bcc
commit 1d469f71cb
2 changed files with 92 additions and 4 deletions

View File

@ -5,6 +5,7 @@ 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';
import 'widgets/service_listview_v2.dart';
class OpenLPRemoteApp extends StatefulWidget { class OpenLPRemoteApp extends StatefulWidget {
@override @override
@ -14,13 +15,11 @@ class OpenLPRemoteApp extends StatefulWidget {
class _OpenLPRemoteAppState extends State<OpenLPRemoteApp> class _OpenLPRemoteAppState extends State<OpenLPRemoteApp>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
TabController tabController; TabController tabController;
SearchFloatingButton searchActionButton;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
tabController = TabController(length: 2, vsync: this); tabController = TabController(length: 3, vsync: this);
searchActionButton = SearchFloatingButton();
} }
@override @override
@ -41,6 +40,7 @@ class _OpenLPRemoteAppState extends State<OpenLPRemoteApp>
bottom: TabBar( bottom: TabBar(
tabs: <Widget>[ tabs: <Widget>[
Tab(text: 'SERVICE'), Tab(text: 'SERVICE'),
Tab(text: 'SERVICE V2'),
Tab(text: 'SLIDES'), Tab(text: 'SLIDES'),
], ],
controller: tabController, controller: tabController,
@ -50,10 +50,11 @@ class _OpenLPRemoteAppState extends State<OpenLPRemoteApp>
controller: tabController, controller: tabController,
children: <Widget>[ children: <Widget>[
ServiceListView(), ServiceListView(),
ServiceListViewV2(),
Container(), Container(),
], ],
), ),
floatingActionButton: searchActionButton, floatingActionButton: SearchFloatingButton(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: AppBottomNavigationBar(), bottomNavigationBar: AppBottomNavigationBar(),
), ),

View File

@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import '../models/service_item.dart';
class ServiceListViewV2 extends StatefulWidget {
@override
_ServiceListViewV2State createState() => _ServiceListViewV2State();
}
class _ServiceListViewV2State extends State<ServiceListViewV2> {
List<ServiceItem> serviceItems;
@override
void initState() {
serviceItems = [
ServiceItem(id: '1', plugin: 'songs', selected: false, title: 'Oceans'),
ServiceItem(
id: '2', plugin: 'bibles', selected: true, title: 'John 3:16'),
ServiceItem(
id: '3',
plugin: 'presentations',
selected: false,
title: 'Sunday service.pdf'),
ServiceItem(
id: '4', plugin: 'images', selected: false, title: 'Slogan.jpg'),
ServiceItem(
id: '5', plugin: 'media', selected: false, title: 'Video.mp4'),
ServiceItem(
id: '6', plugin: 'custom', selected: false, title: 'Custom alert'),
];
super.initState();
}
@override
Widget build(BuildContext context) {
if (serviceItems.isEmpty) {
return Center(
child: Container(
constraints: BoxConstraints(
maxHeight: 100,
maxWidth: 250,
),
child: Text(
'Any item added to service.\n' +
'Please, add a new service item tapping the "New service item" button.',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black38),
),
),
);
}
return ListView.separated(
padding: EdgeInsets.only(bottom: 35),
separatorBuilder: (context, i) {
return Divider();
},
itemCount: serviceItems.length,
itemBuilder: (context, i) {
ServiceItem item = serviceItems[i];
return ListTile(
contentPadding: EdgeInsets.all(10),
selected: item.selected,
leading: Container(
// color: Colors.black12,
height: 50,
width: 50,
child: item.plugin.id == 'images'
? FittedBox(
child: Image.network('https://picsum.photos/500'),
fit: BoxFit.cover,
)
: Icon(item.plugin.icon()),
),
title: Text(item.title),
trailing: IconButton(
icon: Icon(
Icons.delete,
// color: Colors.red,
),
onPressed: () {},
),
onTap: () {},
);
},
);
}
}