flutter_flunt 0.1.0+1 flutter_flunt: ^0.1.0+1 copied to clipboard
Library that provides widgets to make it easier to use Flunt-dart in the flutter.
FlutterFlunt #
Library that provides widgets to make it easier to use Flunt-dart in the flutter. See Flunt-dart to use this package.
Usage #
Create a contract #
Create a contract for use in FluntTextFormField.
class NameContract extends Contract<String> {
NameContract(String value, String name) : super(value, name) {
isNotEmpty("not should be empty");
hasMaxLen(40, "should have no more than 40 chars");
hasMinLen(3, "should have at least 3 chars");
}
}
Use with FluntTextFormField #
FluntTextFormField extends TextFormField and provides a simple way to use contracts.
FluntTextFormField(
contract: (value) => StringContract(value, "Name"),
decoration: InputDecoration(
prefixIcon: Icon(Icons.account_circle),
)
)