in current_results_ui/lib/filter.dart [40:110]
Widget build(BuildContext context) {
return Consumer<QueryResults>(
builder: (context, results, child) {
final filter = results.filter;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ConstrainedBox(
constraints: BoxConstraints(maxHeight: 100.0),
child: Scrollbar(
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0),
alignment: Alignment.topLeft,
child: Wrap(
spacing: 8.0,
runSpacing: 8.0,
alignment: WrapAlignment.start,
children: [
for (final term in filter.terms)
InputChip(
label: Text(term),
onDeleted: () {
pushRoute(context,
terms:
filter.terms.where((t) => t != term));
},
onPressed: () {
controller.text = term;
}),
],
),
),
),
),
),
Divider(
color: Colors.grey[300],
height: 2,
thickness: 2,
),
Padding(
padding: EdgeInsets.only(left: 12.0),
child: SizedBox(
width: 300.0,
height: 36.0,
child: TextField(
controller: controller,
decoration: InputDecoration(
hintText: 'Test, configuration or experiment prefix'),
onSubmitted: (value) {
if (value.trim().isEmpty) return;
final newTerms = value.split(',').map((s) => s.trim());
bool isNotReplacedByNewTerm(String term) =>
!newTerms.any((newTerm) =>
term.startsWith(newTerm) ||
newTerm.startsWith(term));
controller.text = '';
pushRoute(context,
terms: filter.terms
.where(isNotReplacedByNewTerm)
.followedBy(newTerms));
},
),
),
),
],
);
},
);
}