fix debug mode error and format
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
erinn 2021-05-18 18:23:07 -07:00
parent 5714713dab
commit e0a031c6d3
1 changed files with 15 additions and 11 deletions

View File

@ -54,13 +54,14 @@ class _ContactsViewState extends State<ContactsView> {
onPressed: _debugFakeMessage, onPressed: _debugFakeMessage,
), ),
IconButton( IconButton(
// need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset // need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset
icon: Icon(showSearchBar || Provider.of<ContactListState>(context).isFiltered ? Icons.search_off : Icons.search), icon: Icon(showSearchBar || Provider.of<ContactListState>(context).isFiltered ? Icons.search_off : Icons.search),
onPressed: () { onPressed: () {
Provider.of<ContactListState>(context).filter = ""; Provider.of<ContactListState>(context, listen: false).filter = "";
setState((){showSearchBar = !showSearchBar;}); setState(() {
} showSearchBar = !showSearchBar;
) });
})
], ],
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
@ -74,15 +75,18 @@ class _ContactsViewState extends State<ContactsView> {
Widget _buildFilterable() { Widget _buildFilterable() {
//todo: translate //todo: translate
Widget txtfield = CwtchTextField(controller: ctrlrFilter, labelText: AppLocalizations.of(context).search, onChanged: (newVal){ Widget txtfield = CwtchTextField(
Provider.of<ContactListState>(context, listen: false).filter = newVal; controller: ctrlrFilter,
}); labelText: AppLocalizations.of(context).search,
onChanged: (newVal) {
Provider.of<ContactListState>(context, listen: false).filter = newVal;
});
return Column(children: [Padding(padding: EdgeInsets.all(2), child: txtfield), Expanded(child: _buildContactList())]); return Column(children: [Padding(padding: EdgeInsets.all(2), child: txtfield), Expanded(child: _buildContactList())]);
} }
Widget _buildContactList() { Widget _buildContactList() {
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) { final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.onion), value: contact, builder: (_,__) => ContactRow()); return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.onion), value: contact, builder: (_, __) => ContactRow());
}); });
final divided = ListTile.divideTiles( final divided = ListTile.divideTiles(
context: context, context: context,