Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

singleInputDialog - Value not working when set initially #11

Open
mikthemonster opened this issue Feb 8, 2021 · 1 comment
Open

singleInputDialog - Value not working when set initially #11

mikthemonster opened this issue Feb 8, 2021 · 1 comment

Comments

@mikthemonster
Copy link

Hi,

When I create a singleInputDialog and add a value, the value is not set in the textfield - it actually looks like the value is set in the textfield, bit it is being shown as a label or something "behind" the textfield. When I save the dialog the value is emplty unless I enter at new value in the textfield.

singleInputDialog( context, title: "Input Dialog", label: "Name", value: item.optionName, validator: (value) { print("Validator: $value"); return value.isEmpty ? "Required!" : null; }, positiveAction: (value) async { item.optionName = value; await updateOption(item); setState(() {}); print("Submit: $value"); }, negativeAction: () { print("negative action"); }, neutralAction: () { print("neutral action"); }, negativeText: "d", );

@mikthemonster
Copy link
Author

I found this code in the initState() of the __SingleInputDialogState class (the code setting the initial value is in comment):

@OverRide
void initState() {
super.initState();
// if (widget.value != null && widget.value.trim().isNotEmpty) {
// delay(Duration(milliseconds: 300), () {
// _inputController.text = widget.value.trim();
// });
// }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant