128 lines
3.8 KiB
Dart
128 lines
3.8 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 '../models/service_item.dart';
|
|
|
|
class ServiceListView extends StatefulWidget {
|
|
@override
|
|
_ServiceListViewState createState() => _ServiceListViewState();
|
|
}
|
|
|
|
class _ServiceListViewState extends State<ServiceListView> {
|
|
List<ServiceItem> serviceItems;
|
|
|
|
@override
|
|
void initState() {
|
|
serviceItems = [
|
|
ServiceItem(
|
|
id: '1',
|
|
plugin: 'songs',
|
|
selected: true,
|
|
title: 'Oceans',
|
|
notes: 'First music before the presentation.',
|
|
),
|
|
ServiceItem(
|
|
id: '2',
|
|
plugin: 'bibles',
|
|
selected: false,
|
|
title: 'John 3:16',
|
|
notes: 'This is the item notes.',
|
|
),
|
|
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',
|
|
),
|
|
];
|
|
// serviceItems = [];
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (serviceItems.isEmpty) {
|
|
return Center(
|
|
child: Container(
|
|
constraints: BoxConstraints(
|
|
maxHeight: 100,
|
|
maxWidth: 250,
|
|
),
|
|
child: Text(
|
|
AppLocalizations.of(context).translate('service_list_empty'),
|
|
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: Icon(item.plugin.icon()),
|
|
),
|
|
),
|
|
title: Text(item.title),
|
|
subtitle:
|
|
item.notes != null && item.notes != "" ? Text(item.notes) : null,
|
|
trailing: IconButton(
|
|
icon: Icon(Icons.delete),
|
|
onPressed: () {},
|
|
),
|
|
onTap: () {},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|