lite_forms library

Classes

AlwaysComplainingTestValidator
This validator can be used if you want to test errors in your form I will always return an error
BitcoinWalletDetails
CardSystem
CardSystemData
ClipSmoothRect
CountryData
CountryDropdown
CountryPreprocessor
CreditCardCvcInputFormatter
CreditCardExpirationDateFormatter
CreditCardNumberInputFormatter
CurrencyInputFormatter
CurrencySymbols
DateOfBirthValidator
DecimalPosSeparator
DropSelectorSettings
DropSelectorView
EmailValidator
FilePicker
The interface that implementations of file_picker must implement.
FilePickerResult
FileSize
FileSizeValidator
FormattedValue
ImagePicker
Provides an easy way to pick an image/video from the image library, or to take a picture/video with the camera.
Jiffy
LiteCountrySelector
LiteDatePicker
LiteDropSelector
LiteDropSelectorItem<T>
LiteDropSelectorRoute
LiteDropSelectorRouteArgs
LiteFile
LiteFilePicker
LiteForm
LitePasswordField
LitePhoneInputField
LiteRepo
LiteSearchField
LiteSearchFieldSettings
LiteSerializers
LiteSerializers is a set of built-in serializers that can be used to simplify a work with some types of values
LiteState<T extends LiteStateController>
LiteStateController<T>
LiteSwitch
LiteTextFormField
LiteValidator
LostData
The response object of ImagePicker.retrieveLostData.
LostDataResponse
The response object of ImagePicker.getLostData.
LSJsonEncodable
MaskedInputFormatter
MoneyInputFormatter
MoneySymbols
NameValidator
NonValidatingValidator
PasswordChecker
PasswordRequirements
PasswordSettings
PhoneCodes
PhoneCountryData
PhoneData
PhoneInputFormatter
PhonePreprocessor
PhoneValidator
PickedFile
A PickedFile is a cross-platform, simplified File abstraction.
PinyinFormatter
PlatformFile
PosInputFormatter
PositiveNumberValidator
RequiredFieldValidator
SmoothBorderRadius
SmoothIconBase
https://www.johndcook.com/blog/2018/02/13/squircle-curvature/
SmoothIconDataIcon
SmoothImageIcon
SmoothRadius
SmoothRectangleBorder
TextEntryModalRouteSettings
ThousandsPosSeparator
Unfocuser
XFile
A CrossFile is a cross-platform, simplified File abstraction.
YoutubeUrlValidator

Enums

BitcoinAddressNetwork
BitcoinAddressType
BitcoinWalletType
BorderAlign
CameraDevice
Which camera to use when picking images/videos while source is ImageSource.camera.
DateInputType
DropSelectorActionType
DropSelectorType
FilePickerStatus
FileSource
FileType
ImageSource
Specifies the source where the picked image should come from.
InvalidPhoneAction
this is used in a formatAsPhoneNumber() function and this is what the returned result depends on
LiteDatePickerType
LitePhoneInputType
LiteSearchFieldIconPosition
LiteSwitchPosition
LiteSwitchReactionArea
MultiSelectorStyle
PasswordFieldCheckType
RetrieveType
The type of the retrieved data in a LostDataResponse.
SearchFieldVisibility
SearchTriggerType
ShorteningPolicy
SwitchStyle
TextEntryType
ThousandSeparator
Comma means this format 1,000,000.00 Period means thousands and mantissa will look like this 1.000.000,00 None no separator will be applied at all SpaceAndPeriodMantissa 1 000 000.00 SpaceAndCommaMantissa 1 000 000,00
Units

Mixins

LiteSearchMixin<T extends StatefulWidget>

Extensions

DateTimeExtension on DateTime
DoubleExtensions on double
ImageExtension on Image
IntExtension on int
ListExtension on List
NumericInputFormatting on num
WARNING! This stuff requires Dart SDK version 2.6+ so if your code is supposed to be running on older versions do not use these methods! or change the sdk restrictions in your pubspec.yaml like this: environment: sdk: ">=2.6.0 <3.0.0"
StringExtension on String
StringExtensions on String
StringInputFormatting on String
TextEditingControllerExtension on TextEditingController

Constants

defaultDialogTitle → const String
kTypeImage → const String
Denotes that an image is being picked.
kTypeVideo → const String
Denotes that a video is being picked.

Properties

allCountries List<CountryData>
final

Functions

checkMask(String mask) → void
defaultTranslationBuilder(String? value) String?
disposeControllerByType(Type controllerType) → void
enumFromString<T>(List<T> enumValues, String? value) → T?
enumToString(dynamic enumValue) String?
fc<T extends LiteStateController>() → T
fc - short for Find Controller
findController<T extends LiteStateController>() → T
findCountryById(String countryId) CountryData?
formatAsCardNumber(String cardNumber) String
formatAsPhoneNumber(String phone, {InvalidPhoneAction invalidPhoneAction = InvalidPhoneAction.ShowUnformatted, bool allowEndlessPhone = false, String? defaultMask, String? defaultCountryCode}) String?
allowEndlessPhone if this is true, the
getBitcoinWalletDetails(String? value) BitcoinWalletDetails
Detailed wallet check. The returned object contains all the necessary info like address type, network, wallet type and address. Before using the returned object, use isValid getter to check if the result is valid
getBitcoinWalletType(String? value) BitcoinWalletType
A simplified wallet type check which only returns a wallet type like SegWit, Regular, or None if a wallet address is invalid
getCardSystemData(String cardNumber) CardSystemData?
getCountryDatasByPhone(String phone) List<PhoneCountryData>
returns a list of country datas with a country code of the supplied phone number. The return type is List because many countries and territories may share the same phone code the list will contain one PhoneCountryData at max returns A list of PhoneCountryData datas or an empty list
initControllers(Map<Type, ControllerInitializer> controllerInitializers) → void
initControllersLazy(Map<Type, ControllerInitializer> controllerInitializers) → void
initForms({LiteFormsConfiguration? config}) → void
Just a shorthand for initializeLiteForms
initializeLiteForms({LiteFormsConfiguration? config}) → void
Call it somewhere in the beginning of your app code config allows you to configure the look and feel for all of your form fields by default. Doing this you won't have to set decorations, paddings and other common stuff for your forms everywhere
initJsonDecoders(Map<Type, ModelDecoderFunction> value) → void
Initializes JSON decoders for custom types (if you ever need to store anything custom in shared preferences), so they can be easily restored from SharedPreferences. Call this method someplace at the beginning of your app, just before you initialize LiteState controllers so that controllers can have access to this data before they are initialized themselves. Decoder MUST be a STATIC function that creates instances of custom classes from a map e.g. static AuthData decode(Map map) { return AuthData( type: map'type', token: map'token', userName: map'userName', ); } this function converts a Map, stored in SharedPreferences into a user defined object. In this case a custom class called AuthData
isBitcoinWalletValid(String? value) bool
isCardNumberValid({required String cardNumber, bool checkLength = false, bool useLuhnAlgo = true}) bool
useLuhnAlgo validates the number using the Luhn algorithm
isCardValidNumber(String cardNumber, {bool checkLength = false}) bool
checks not only for a length and characters but also for card system code. If it's not found the succession of numbers will not be marked as a valid card number
isCryptoCurrency(String currencyId) bool
Basically it doesn't really check if the currencyId is a crypto currency. It just checks if it's not fiat. I decided not to collect all possible crypto currecies as there's an endless amount of them
isDigit(String? character, {bool positiveOnly = false}) bool
character a character to check if it's a digit against positiveOnly if true it will not allow a minus (dash) character to be accepted as a part of a digit
isEmailValid(String value) bool
isFiatCurrency(String currencyId) bool
Checks if currency is fiat
isPhoneValid(String phone, {bool allowEndlessPhone = false, String? defaultCountryCode}) bool
isUnmaskableSymbol(String? symbol) bool
nonConvertingValueConvertor(Object? value) Object?
The default for all fields. This means that the values is supposed to be accepted as is. If you need to convert the value somehow, write your custom serializer for a particular field
numericStringStartsWithOrphanPeriod(String string) bool
onPostframe(VoidCallback callback) → void
resetAllControllers({bool dispose = false}) → void
just calls a reset() method on all initialized controllers what this method should / should not do is up to you. Just write your own implementation if you need it
showDropSelector({required List<LiteDropSelectorItem> buttonDatas, required Offset tapPosition, required BuildContext context, required InputDecoration? decoration, required Size buttonSize, required DropSelectorSettings settings, required TextStyle? style, required LiteForm group, MenuItemBuilder? menuItemBuilder}) Future
simpleSquareToggleBuilder(BuildContext context, bool isSelected) Widget
toCurrencyString(String value, {int mantissaLength = 2, ThousandSeparator thousandSeparator = ThousandSeparator.Comma, ShorteningPolicy shorteningPolicy = ShorteningPolicy.NoShortening, String leadingSymbol = '', String trailingSymbol = '', bool useSymbolPadding = false, bool isRawValue = false}) String
isRawValue pass true if you
toNumericString(String? inputString, {bool allowPeriod = false, bool allowHyphen = true, String mantissaSeparator = '.', String? errorText, bool allowAllZeroes = false, int? mantissaLength}) String
errorText if you don't want this method to throw any errors, pass null here allowAllZeroes might be useful e.g. for phone masks
toNumericStringByRegex(String? inputString, {bool allowPeriod = false, bool allowHyphen = true}) String
tryFindCountries(String value) List<CountryData?>
Tries to search a country by a name, iso code or a three letter code

Typedefs

ControllerInitializer = LiteStateController Function()
CountryItemBuilder = Widget Function(PhoneCountryData)
CustomLiteToggleBuilder = Widget Function(BuildContext context, bool isSelected)
DropSelectorItemBuilder = Widget Function(LiteDropSelectorItem item)
DropSelectorItemIconBuilder = Widget Function(BuildContext context, LiteDropSelectorItem item, bool isSelected)
LiteDropSelectorViewBuilder = Widget Function(BuildContext context, List<LiteDropSelectorItem> selectedItems, String? error)
selectedItems a list of items that are currently selected error a text of an error from validator or null
LiteFormBuilder = Widget Function(BuildContext context, ScrollController scrollController)
LiteFormValueDeserializer = Object? Function(dynamic value)
LiteFormValueSerializer = FutureOr<Object?> Function(dynamic value)
used to write custom value serializers / deserializers
LiteStateBuilder<T extends LiteStateController> = Widget Function(BuildContext context, T controller)
ModelDecoderFunction = LSJsonEncodable Function(Map<String, dynamic> json)
MultiselectChipBuilder = Widget Function(LiteDropSelectorItem item, ValueChanged<LiteDropSelectorItem> removeItem)
PasswordCheckBuilder = Widget Function(bool? digitsOk, bool? upperCaseOk, bool? lowerCaseOk, bool? specialCharsOk, bool? lengthOk, bool? passwordsMatch)
ShowPasswordIconBuilder = Widget Function(bool isVisible)
TranslationBuilder = String? Function(String? value)
all of the forms' errors, hints and labels call this function before displaying. The value passed as a parameter. If you need to translate the value of even change it completely return your value.
ViewBuilder = Widget Function(BuildContext context, List<LiteFile> files)