forgot to stage all the changes...
This commit is contained in:
parent
cb75f1ff87
commit
3060a6d1f9
6 changed files with 65 additions and 53 deletions
|
@ -7,6 +7,27 @@ import 'package:local_spend/common/functions/save_current_login.dart';
|
|||
import 'package:local_spend/common/functions/show_dialog_single_button.dart';
|
||||
import 'package:local_spend/model/json/login_model.dart';
|
||||
|
||||
Future<void> _incorrectDialog(BuildContext context) async {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text("Unable to Login"),
|
||||
content: Text("Incorrect login details. Please try again."),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text('OK'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<LoginModel> requestLoginAPI(
|
||||
BuildContext context, String email, String password) async {
|
||||
//var apiUrl = ConfigWrapper.of(context).apiKey;
|
||||
|
@ -41,11 +62,7 @@ Future<LoginModel> requestLoginAPI(
|
|||
|
||||
saveCurrentLogin(responseJson, body["email"]);
|
||||
|
||||
showDialogSingleButton(
|
||||
context,
|
||||
"Unable to Login",
|
||||
"You may have supplied an invalid 'Email' / 'Password' combination. Please try again or email an administrator.",
|
||||
"OK");
|
||||
_incorrectDialog(context);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -71,9 +71,9 @@ class FindOrganisations {
|
|||
} else {
|
||||
_searchEnabled = false;
|
||||
}
|
||||
setState(() => {});
|
||||
setState(() => {_searchEnabled});
|
||||
},
|
||||
onSubmitted: (value) {
|
||||
onSubmitted: (_) {
|
||||
if (_searchEnabled) {
|
||||
var result = _submitSearch(searchBarText.text);
|
||||
result.then((_) {
|
||||
|
@ -87,23 +87,20 @@ class FindOrganisations {
|
|||
Container(
|
||||
width: 80,
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 0, 0),
|
||||
child: IgnorePointer(
|
||||
ignoring: _searchEnabled,
|
||||
child: RaisedButton(
|
||||
onPressed: () {
|
||||
if (_searchEnabled) {
|
||||
var result = _submitSearch(
|
||||
searchBarText.text);
|
||||
result.then((_) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
child: Icon(Icons.search, color: Colors.white),
|
||||
color: _searchEnabled ? Colors.blue : Colors.blue[200],
|
||||
// make inactive when search in progress as activity indicator
|
||||
),
|
||||
child: RaisedButton(
|
||||
onPressed: (() {
|
||||
if (_searchEnabled) {
|
||||
var result = _submitSearch(searchBarText.text);
|
||||
result.then((_) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
child: Icon(Icons.search, color: Colors.white),
|
||||
color: _searchEnabled ? Colors.blue : Colors.blue[200],
|
||||
// make inactive when search in progress as activity indicator
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
Reference in a new issue