Restore filtering
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2021-05-25 17:02:34 -07:00
parent 66a865c0c5
commit 68d7020820
3 changed files with 4 additions and 5 deletions

View File

@ -70,7 +70,7 @@ class ContactListState extends ChangeNotifier {
List<ContactInfoState> filteredList() {
if (!isFiltered) return contacts;
return _contacts.where((ContactInfoState c) => c.onion.contains(_filter) || (c.nickname != null && c.nickname.contains(_filter))).toList();
return _contacts.where((ContactInfoState c) => c.onion.contains(_filter) || (c.nickname.contains(_filter))).toList();
}
void addAll(Iterable<ContactInfoState> newContacts) {

View File

@ -84,13 +84,12 @@ class _ContactsViewState extends State<ContactsView> {
onChanged: (newVal) {
Provider.of<ContactListState>(context, listen: false).filter = newVal;
},
validator: (value) {},
);
return Column(children: [Padding(padding: EdgeInsets.all(8), child: txtfield), Expanded(child: _buildContactList())]);
}
Widget _buildContactList() {
final tiles = Provider.of<ContactListState>(context).contacts.map((ContactInfoState contact) {
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.profileOnion + "" + contact.onion), value: contact, builder: (_, __) => RepaintBoundary(child: ContactRow()));
});
final divided = ListTile.divideTiles(

View File

@ -7,10 +7,10 @@ doNothing(String x) {}
// Provides a styled Text Field for use in Form Widgets.
// Callers must provide a text controller, label helper text and a validator.
class CwtchTextField extends StatefulWidget {
CwtchTextField({required this.controller, required this.labelText, required this.validator, this.onChanged = doNothing});
CwtchTextField({required this.controller, required this.labelText, this.validator = null, this.onChanged = doNothing});
final TextEditingController controller;
final String labelText;
final FormFieldValidator validator;
final FormFieldValidator? validator;
final Function(String) onChanged;
@override