mre_fields 0.2.0
mre_fields: ^0.2.0 copied to clipboard
Flutter form fields that follow the language typed (auto RTL/LTR text and alignment), phone numbers validated for every country with a picker, and image paste.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased] #
0.2.0 - 2026-10-01 #
Added #
- Phone number field.
MREPhoneFieldchecks the number for every country (245 countries and regions) and says what is wrong: too short, too long, not valid for the country, unknown dial code, country not accepted.- Paste
+20 (10) 1234-5678or0020 101 234 5678and the country switches to Egypt and the digits fill in. A number that shares a dial code finds the right country:+1 204…is Canada,+1 212…is the United States. - Arabic, Persian and full-width digits are converted to ASCII digits as the user types.
- Choose the countries: accept only some (
include), drop some (exclude), pin favorites to the top of the picker, set the starting country. One selection controls the picker, the paste detection and the validation. - A searchable country picker with flags, names, ISO codes and dial codes. It opens as a draggable sheet on narrow windows and as a dialog with a maximum width on wide ones.
- Everything can be translated: country names with
countryNameBuilder, the picker texts and the seven error messages throughMREFieldsStrings.
- Paste
- Phone numbers without a widget.
MREPhoneNumber.parseandMREPhoneNumber.nationalgive the country, the digits,e164, the national and international formats, and the reason a number is invalid.MREPhoneValidators.validvalidates anyTextFormField.MRECountrieslooks countries up by ISO code or dial code. MREPhoneControllerto read or set the number from code,MRECountryPickerBodyandshowMRECountryPickerto use the picker alone.
Changed #
- Works on Flutter 3.38.1 and newer (Dart 3.10). The SDK constraint was
^3.12.0, which needed Flutter 3.44. The test suite passes on 3.38.1, on the latest stable and on beta. metais loosened to^1.15.0so it resolves with the version each Flutter pins.
0.1.1 - 2026-10-01 #
Changed #
- README rewritten: why to use the package, install, quick start, what to use for each need, platform support and questions.
- The pub.dev Example tab shows a full walkthrough (
example/example.md) instead of three lines ofmain.dart. - The API reference landing page lists the guides, and README and example code is copied from tested snippets.
0.1.0 - 2026-10-01 #
Added #
- Text that follows its language.
MRETextFieldandMREAutoTextread the first word that has a letter and switch between right to left and left to right as the user types. Digits and symbols before it are skipped, so123 مرحباis right to left. Every right-to-left script works: Arabic, Hebrew, Persian, Urdu and more. - Direction and alignment for the widgets you already have.
Text.autoDirection(),Text.autoAlign()andWidget.withTextDirection(). - Paste images into a field.
MREImageAttachmentPastekeeps pasted images under the field with open, remove and replace;MREImageCallbackPastehands each image to your code. Size, type and count limits, and a reason for every rejected image. Images arrive through the paste shortcut, the browser paste event, the selection menu and the Android keyboard. - One theme for every field. Register
MREFieldsThemeonce for radius, padding and breakpoints, andMREFieldsStringsfor every text. A widget parameter beats the theme for one field. - A text field with suggestions and select on focus, with the parameters of
TextFormField, usable in aForm. - The rules without a widget.
detectTextDirection,safeDisplayText(removes characters that make Flutter throw),mreFilterSuggestions,mreSniffImageMimeType,MREAttachmentsController, andMREImagePasteScopeto give anyTextFieldimage paste. - An example app for every platform and
@MREPreview()to preview any widget in light, dark, right to left, large text, narrow and wide layouts.