slides list view layout

This commit is contained in:
Daniel Borges 2019-08-06 11:26:06 -03:00
parent f9c97303a3
commit 714ff20f0b
4 changed files with 152 additions and 3 deletions

View File

@ -0,0 +1,14 @@
class SlideItem {
final String tag;
final String html;
final String text;
bool selected;
SlideItem({this.tag, this.html, this.text, this.selected});
SlideItem.fromJson(Map<String, dynamic> json)
: tag = json['tag'],
text = json['text'],
html = json['html'],
selected = json['selected'];
}

View File

@ -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/slides_listview.dart';
class OpenLPRemoteApp extends StatefulWidget {
@override
@ -48,7 +49,7 @@ class _OpenLPRemoteAppState extends State<OpenLPRemoteApp>
controller: tabController,
children: <Widget>[
ServiceListView(),
Container(),
SlideListView(),
],
),
floatingActionButton: SearchFloatingButton(),

View File

@ -13,9 +13,9 @@ class _ServiceListViewState extends State<ServiceListView> {
@override
void initState() {
serviceItems = [
ServiceItem(id: '1', plugin: 'songs', selected: false, title: 'Oceans'),
ServiceItem(id: '1', plugin: 'songs', selected: true, title: 'Oceans'),
ServiceItem(
id: '2', plugin: 'bibles', selected: true, title: 'John 3:16'),
id: '2', plugin: 'bibles', selected: false, title: 'John 3:16'),
ServiceItem(
id: '3',
plugin: 'presentations',
@ -28,6 +28,7 @@ class _ServiceListViewState extends State<ServiceListView> {
ServiceItem(
id: '6', plugin: 'custom', selected: false, title: 'Custom alert'),
];
// serviceItems = [];
super.initState();
}

View File

@ -0,0 +1,133 @@
import 'package:flutter/material.dart';
import '../models/slide_item.dart';
class SlideListView extends StatefulWidget {
@override
_SlideListViewState createState() => _SlideListViewState();
}
class _SlideListViewState extends State<SlideListView> {
List<SlideItem> slidesItems;
@override
void initState() {
slidesItems = [
SlideItem(
tag: '1',
html: '',
selected: false,
text: 'You call me out upon the waters\n' +
'The great unknown where feet may fail\n' +
'And there I find You in the mystery\n' +
'In oceans deep, my faith will stand',
),
SlideItem(
tag: '2',
html: '',
selected: true,
text: 'And I will call upon Your name\n' +
'And keep my eyes above the waves\n' +
'When oceans rise, my soul will rest in Your embrace\n' +
'I am Yours and You are mine',
),
SlideItem(
tag: '3',
html: '',
selected: false,
text: 'Your grace abounds in deepest waters\n' +
'Your sovereign hand\n' +
'Will be my guide\n' +
'Where feet may fail and fear surrounds me\n' +
'You\'ve never failed and You won\'t start now',
),
SlideItem(
tag: '4',
html: '',
selected: false,
text: 'So I will call upon Your name\n' +
'And keep my eyes above the waves\n' +
'When oceans rise, my soul will rest in Your embrace\n' +
'For I am Yours and You are mine, oh\n' +
'And You are mine, oh',
),
SlideItem(
tag: '5',
html: '',
selected: false,
text: 'Spirit lead me where my trust is without borders\n' +
'Let me walk upon the waters\n' +
'Wherever You would call me\n' +
'Take me deeper than my feet could ever wander\n' +
'And my faith will be made stronger\n' +
'In the presence of my Savior',
),
SlideItem(
tag: '6',
html: '',
selected: false,
text: 'Spirit lead me where my trust is without borders\n' +
'Let me walk upon the waters\n' +
'Wherever You would call me\n' +
'Take me deeper than my feet could ever wander\n' +
'And my faith will be made stronger\n' +
'In the presence of my Savior',
),
SlideItem(
tag: '7',
html: '',
selected: false,
text: 'Spirit lead me where my trust is without borders\n' +
'Let me walk upon the waters\n' +
'Wherever You would call me\n' +
'Take me deeper than my feet could ever wander\n' +
'And my faith will be made stronger\n' +
'In the presence of my Savior, oh',
),
SlideItem(
tag: '8',
html: '',
selected: false,
text: 'I will call upon Your name\n' +
'Keep my eyes above the waves\n' +
'My soul will rest in Your embrace\n' +
'I am Yours and You are mine',
),
];
// slidesItems = [];
super.initState();
}
@override
Widget build(BuildContext context) {
if (slidesItems.isEmpty) {
return Center(
child: Container(
constraints: BoxConstraints(
maxHeight: 100,
maxWidth: 250,
),
child: Text(
'Any service item selected.\n' +
'Please, select a service item in "SERVICE" tab.',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black38),
),
),
);
}
return ListView.builder(
padding: EdgeInsets.only(bottom: 35),
itemCount: slidesItems.length,
itemBuilder: (context, i) {
SlideItem item = slidesItems[i];
return ListTile(
contentPadding: EdgeInsets.all(10),
selected: item.selected,
title: Text(item.text),
onTap: () {},
);
},
);
}
}