diff --git a/lib/src/openlp_remote_app.dart b/lib/src/openlp_remote_app.dart index 7064365..aad8861 100644 --- a/lib/src/openlp_remote_app.dart +++ b/lib/src/openlp_remote_app.dart @@ -5,6 +5,7 @@ import 'app_theme.dart'; import 'widgets/bottom_navigation_bar.dart'; import 'widgets/search_floating_button.dart'; import 'widgets/service_listview.dart'; +import 'widgets/service_listview_v2.dart'; class OpenLPRemoteApp extends StatefulWidget { @override @@ -14,13 +15,11 @@ class OpenLPRemoteApp extends StatefulWidget { class _OpenLPRemoteAppState extends State with SingleTickerProviderStateMixin { TabController tabController; - SearchFloatingButton searchActionButton; @override void initState() { super.initState(); - tabController = TabController(length: 2, vsync: this); - searchActionButton = SearchFloatingButton(); + tabController = TabController(length: 3, vsync: this); } @override @@ -41,6 +40,7 @@ class _OpenLPRemoteAppState extends State bottom: TabBar( tabs: [ Tab(text: 'SERVICE'), + Tab(text: 'SERVICE V2'), Tab(text: 'SLIDES'), ], controller: tabController, @@ -50,10 +50,11 @@ class _OpenLPRemoteAppState extends State controller: tabController, children: [ ServiceListView(), + ServiceListViewV2(), Container(), ], ), - floatingActionButton: searchActionButton, + floatingActionButton: SearchFloatingButton(), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, bottomNavigationBar: AppBottomNavigationBar(), ), diff --git a/lib/src/widgets/service_listview_v2.dart b/lib/src/widgets/service_listview_v2.dart new file mode 100644 index 0000000..c12a628 --- /dev/null +++ b/lib/src/widgets/service_listview_v2.dart @@ -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 { + List 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: () {}, + ); + }, + ); + } +}