search page layout

This commit is contained in:
Daniel Borges 2019-08-06 17:05:59 -03:00
parent 714ff20f0b
commit 8eeb37c28c
3 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import 'package:flutter/material.dart';
class OpenLPIcons {
final IconData songs = Icons.audiotrack;
final IconData biblies = Icons.book;
final IconData presentations = Icons.present_to_all;
final IconData media = Icons.ondemand_video;
final IconData custom = Icons.video_label;
}

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'service_item_search.dart';
class _ServiceItem { class _ServiceItem {
IconData icon; IconData icon;
String title; String title;
@ -23,6 +25,7 @@ class ServiceItemBottomSheet extends StatelessWidget {
title: Text(item.title), title: Text(item.title),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
showSearch(context: context, delegate: ServiceItemSearch());
}, },
); );
}).toList(), }).toList(),

View File

@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
class ServiceItemSearch extends SearchDelegate {
@override
List<Widget> buildActions(BuildContext context) {
return null;
}
@override
Widget buildLeading(BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
close(context, null);
},
);
}
void _showOptions(BuildContext context) {
showModalBottomSheet(
context: context,
builder: (context) => Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.all(15),
child: Text(
query,
style: Theme.of(context).textTheme.title,
textAlign: TextAlign.center,
),
),
ListTile(
title: Text('Go live'),
onTap: () {
Navigator.of(context).pop();
close(context, null);
},
),
ListTile(
title: Text('Add to service'),
onTap: () {
Navigator.of(context).pop();
},
),
ListTile(
title: Text('Add & Go to service'),
onTap: () {
Navigator.of(context).pop();
close(context, null);
},
),
],
),
);
}
Widget _resultList(BuildContext context) {
if (query.isEmpty) {
return Container();
}
return ListView.builder(
itemCount: 5,
itemBuilder: (context, i) {
return ListTile(
title: Text(query),
onTap: () {
_showOptions(context);
},
);
},
);
}
@override
Widget buildResults(BuildContext context) {
print('buildResults - query: $query');
return _resultList(context);
}
@override
Widget buildSuggestions(BuildContext context) {
print('buildSuggestions - query: $query');
return _resultList(context);
}
}