Skip to content

MohammedElotol/async_textformfield

 
 

Repository files navigation

Async TextFormField

A text form field which lets you validate the entered text from an async service call.

Usage

Future<bool> isValidPasscode(String value) async {
    return await Future.delayed(Duration(seconds: 2),
        () => value.isNotEmpty && value.toLowerCase() == 'batman');
}

@override
Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Padding(
        padding: const EdgeInsets.all(10.0),
        child: Center(
          child: Form(
              child: Center(
            child: AsyncTextFormField(
              controller: controller,
              validationDebounce: Duration(milliseconds: 500),
              validator: isValidPasscode,
              hintText: 'Enter the Passcode',
            ),
          )),
        ),
      ),
    );
  }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

A text form field with an async validator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 70.1%
  • HTML 21.8%
  • Swift 5.7%
  • Kotlin 1.9%
  • Objective-C 0.5%