mirror of
https://gitlab.com/openlp/openlp-mobile-remote.git
synced 2024-12-22 20:02:53 +00:00
one service listview
This commit is contained in:
parent
821b95e442
commit
f9c97303a3
@ -5,7 +5,6 @@ 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
|
||||||
@ -19,7 +18,7 @@ class _OpenLPRemoteAppState extends State<OpenLPRemoteApp>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
tabController = TabController(length: 3, vsync: this);
|
tabController = TabController(length: 2, vsync: this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -40,7 +39,6 @@ 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,7 +48,6 @@ class _OpenLPRemoteAppState extends State<OpenLPRemoteApp>
|
|||||||
controller: tabController,
|
controller: tabController,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ServiceListView(),
|
ServiceListView(),
|
||||||
ServiceListViewV2(),
|
|
||||||
Container(),
|
Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -54,43 +54,30 @@ class _ServiceListViewState extends State<ServiceListView> {
|
|||||||
itemCount: serviceItems.length,
|
itemCount: serviceItems.length,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
ServiceItem item = serviceItems[i];
|
ServiceItem item = serviceItems[i];
|
||||||
return Padding(
|
return ListTile(
|
||||||
padding:
|
contentPadding: EdgeInsets.all(10),
|
||||||
EdgeInsets.all(item.selected ? 15 : 25).copyWith(bottom: 0),
|
selected: item.selected,
|
||||||
child: Card(
|
leading: ClipRRect(
|
||||||
elevation: item.selected ? 10 : 1,
|
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||||
child: InkWell(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: <Widget>[
|
|
||||||
AspectRatio(
|
|
||||||
aspectRatio: 3 / 1,
|
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.black12,
|
height: 50,
|
||||||
|
width: 50,
|
||||||
child: item.plugin.id == 'images'
|
child: item.plugin.id == 'images'
|
||||||
? FittedBox(
|
? FittedBox(
|
||||||
child:
|
child: Image.network('https://picsum.photos/500'),
|
||||||
Image.network('https://picsum.photos/500'),
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
)
|
)
|
||||||
: Icon(item.plugin.icon()),
|
: Icon(item.plugin.icon()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
title: Text(item.title),
|
title: Text(item.title),
|
||||||
|
subtitle: Text(item.plugin.id),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(Icons.delete),
|
||||||
Icons.delete,
|
|
||||||
color: Colors.red,
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
),
|
);
|
||||||
));
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
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.builder(
|
|
||||||
padding: EdgeInsets.only(bottom: 35),
|
|
||||||
itemCount: serviceItems.length,
|
|
||||||
itemBuilder: (context, i) {
|
|
||||||
ServiceItem item = serviceItems[i];
|
|
||||||
return ListTile(
|
|
||||||
contentPadding: EdgeInsets.all(10),
|
|
||||||
selected: item.selected,
|
|
||||||
leading: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7)),
|
|
||||||
child: Container(
|
|
||||||
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),
|
|
||||||
subtitle: Text(item.plugin.id),
|
|
||||||
trailing: IconButton(
|
|
||||||
icon: Icon(Icons.delete),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
onTap: () {},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user