Skip to content

flarebyte/text_copperframe

Repository files navigation

text_copperframe

Experimental

The versatile text field for every design

Validate a text field and produce a user-friendly message.

Hero image for text_copperframe

Highlights:

  • Validate a text field based on character size
  • Validate a text field based on word size
  • Validate a URL text field
  • Produce meaningful messages that can be understood by the user
  • Can produce multiple messages for success or failure

A few examples:

Create a message:

final tooSmallMessage = CopperframeMessage(label: 'Too small',level: CopperframeMessageLevel.error, category: 'length');

Create a rule:

final minRule = CopperframeFieldRule(name: 'chars more than',options: {'text#minChars': '1'}, successMessages: [], failureMessages: [tooSmallMessage]);

Create a field event:

final event = CopperframeFieldEvent(name: 'OnCharChange', rules: [minRule]);

Create a text field event builder:

final builder = TextFieldEventBuilder(fieldEvent: event, metricStoreHolder: metricStoreHolder, optionsInventory: optionsInventory, widgetOptions: {'pageRow': 'row123'}, pageOptions: {'page': 'page789'});

Build a text field event using the builder:

final textRule = builder.build();

Validate the text field:

textRule.validate('some text');

Documentation and links

Related

About

The versatile text field for every design

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages