orgs dialog button disables/enables properly

This commit is contained in:
Felix 2019-08-20 16:37:32 +01:00
parent ebf09413fd
commit 68102ea628
3 changed files with 19 additions and 19 deletions

View File

@ -6,13 +6,13 @@ PODS:
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios-profile`) - Flutter (from `.symlinks/flutter/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: ".symlinks/flutter/ios-profile" :path: ".symlinks/flutter/ios"
shared_preferences: shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences/ios"
url_launcher: url_launcher:

View File

@ -281,7 +281,7 @@
); );
inputPaths = ( inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios-profile/Flutter.framework", "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputPaths = ( outputPaths = (

View File

@ -82,6 +82,8 @@ class FindOrganisations {
} }
Future<Organisation> dialog(context) { Future<Organisation> dialog(context) {
var focusNode = new FocusNode();
bool _searchEnabled = false; bool _searchEnabled = false;
bool _orgsFetched = false; bool _orgsFetched = false;
TextEditingController searchBarText = new TextEditingController(); TextEditingController searchBarText = new TextEditingController();
@ -104,6 +106,8 @@ class FindOrganisations {
barrierDismissible: true, barrierDismissible: true,
builder: (BuildContext context) { builder: (BuildContext context) {
FocusScope.of(context).requestFocus(focusNode);
return StatefulBuilder( return StatefulBuilder(
builder: (context, setState) { builder: (context, setState) {
return return
@ -122,6 +126,7 @@ class FindOrganisations {
width: 150, width: 150,
height: 50, height: 50,
child: TextField( child: TextField(
focusNode: focusNode,
controller: searchBarText, controller: searchBarText,
decoration: InputDecoration( decoration: InputDecoration(
hintText: "Payee Name", hintText: "Payee Name",
@ -134,17 +139,15 @@ class FindOrganisations {
} }
setState(() => {_searchEnabled}); setState(() => {_searchEnabled});
}, },
onSubmitted: ((_) { onSubmitted: _searchEnabled ? ((_) {
if (_searchEnabled) { SystemChannels.textInput.invokeMethod('TextInput.hide');
SystemChannels.textInput.invokeMethod('TextInput.hide'); var result = _submitSearch(searchBarText.text);
var result = _submitSearch(searchBarText.text); result.then((_) {
result.then((_) { setState(() {
setState(() { _orgsFetched = true;
_orgsFetched = true;
});
}); });
} });
}), }) : null,
), ),
), ),
@ -153,8 +156,7 @@ class FindOrganisations {
padding: EdgeInsets.fromLTRB(20, 0, 0, 0), padding: EdgeInsets.fromLTRB(20, 0, 0, 0),
child: RaisedButton( child: RaisedButton(
onPressed: (() { onPressed: _searchEnabled ? (() {
if (_searchEnabled) {
SystemChannels.textInput.invokeMethod('TextInput.hide'); SystemChannels.textInput.invokeMethod('TextInput.hide');
var result = _submitSearch(searchBarText.text); var result = _submitSearch(searchBarText.text);
result.then((_) { result.then((_) {
@ -162,12 +164,10 @@ class FindOrganisations {
_orgsFetched = true; _orgsFetched = true;
}); });
}); });
} }) : null,
}),
child: Icon(Icons.search, color: Colors.white), child: Icon(Icons.search, color: Colors.white),
color: _searchEnabled ? Colors.blue : Colors.blue[200], color : Colors.blue,
// make inactive when search in progress as activity indicator
), ),
), ),
], ],