form library

Form controls: form layout and validation, input, select, date picker (with a phone date wheel), checkbox, radio, switch, rate, counter and captcha.

Classes

CounterInput
A numeric field flanked by a decrement and an increment button.
CounterInputController
Holds the numeric value of a CounterInput and keeps the text shown in its field in sync with that value.
DecimalTextInputFormatter
Restricts input to a decimal number, optionally signed.
SlidingCaptcha
滑动拼图验证码。
WeCaptcha
A slide-to-fit puzzle captcha, the kind used to gate risky actions.
WeCaptchaController
Drives a WeCaptcha from the outside.
WeCascader<T>
A dropdown that picks one path from a tree, after el-cascader.
WeCascaderOption<T>
A node of a WeCascader tree.
WeCheckbox
A tick box with a label, after el-checkbox.
WeCheckboxGroup<T>
Several WeCheckboxes bound to one set of values, after el-checkbox-group.
WeDateLocale
The words and conventions a calendar speaks.
WeDatePanel
A compact calendar for picking a day or a range of days, after the panel of el-date-picker.
WeDatePicker
A date field with a drop-down calendar, after el-date-picker.
WeDateSheet
Picks a day, or a range of days, from a sheet that slides up from the bottom, with a WeDateWheel inside.
WeDateShortcut<T>
A one-click preset beside a WeDatePicker's panel, such as "Today" or "Last 7 days". value runs when the preset is clicked, so relative presets stay correct however long the page has been open.
WeDateWheel
Spinning columns for year, month and day, the way phones pick a date.
WeFieldBox
The outlined box behind dropdown fields such as WeSelect, WeCascader and WeTreeSelect: border, hover, focus glow, a clear button that replaces the arrow on hover, and the error state and size of a surrounding WeFormItem.
WeForm
A form layout with validation, after el-form.
WeFormController
Drives a WeForm from outside: validate, reset, scroll to a field.
WeFormItem
One labelled, validated field of a WeForm, after el-form-item.
WeFormItemState
The state of a WeFormItem; fields reach it through WeFormItem.maybeOf.
WeFormScope
Layout settings a WeForm hands down to its items.
WeInput
A single-line text field styled like el-input, with prefix / suffix icons, a clear button and three sizes.
WeRadioGroup<T>
A single-select group, after el-radio-group.
WeRadioOption<T>
One choice of a WeRadioGroup.
WeRate
A row of stars for scoring, after el-rate.
WeRule
One validation rule of a WeFormItem, after async-validator rules used by el-form.
WeSelect<T>
A picker with a drop-down list, after el-select.
WeSelectGroup<T>
A titled group of options, after el-option-group.
WeSelectOption<T>
One choice of a WeSelect.
WeSlider
A themed slider after el-slider.
WeSliderMark
A labelled stop on a WeSlider track.
WeSwitch
An on/off toggle, after el-switch.
WeTreeSelect<T>
A dropdown that picks from a WeTree, after el-tree-select.
WeUpload
A file uploader after el-upload, with no native dependency: the app supplies picker (e.g. through file_picker) and uploader (e.g. through dio), and the widget handles checks, the list, progress, retries and removal.
WeUploadController
Holds the files of a WeUpload and drives it from outside.
WeUploadFile
A file in a WeUpload list.

Enums

WeCalendarView
Which grid a calendar is showing: days of a month, months of a year, or years of a decade.
WeCaptchaStatus
What the captcha is currently doing.
WeCascaderTrigger
What opens the next column of a WeCascader.
WeDatePickerTouchMode
What a WeDatePicker opens on touch.
WeDateWheelType
Which columns a WeDateWheel shows.
WeLabelPosition
Where a WeFormItem puts its label, after label-position.
WeRadioStyle
How a WeRadioGroup draws its options.
WeRuleTrigger
When a WeRule runs on its own. Every rule also runs on WeFormController.validate.
WeUploadListType
How WeUpload lists its files.
WeUploadReject
Why WeUpload refused a picked file.
WeUploadStatus
Where a WeUploadFile is in its upload.

Functions

weFormatBytes(int bytes) → String
1536 → 1.5 KB.
weFormatDate(DateTime d, [String pattern = 'yyyy-MM-dd']) → String
Formats d with a small pattern language: yyyy, MM / M, dd / d; anything else is copied as is, so yyyy年M月d日 works too.
weParseDate(String text, [String pattern = 'yyyy-MM-dd']) → DateTime?
Reads what a user typed back into a date, or null if it is not one.

Typedefs

CounterInputChanged = void Function(double oldValue, double newValue)
Signature for the value callbacks of a CounterInput.
WeCascaderFilter<T> = bool Function(String query, List<WeCascaderOption<T>> path)
Decides whether a whole path matches the search text.
WeSelectFilter<T> = bool Function(String query, WeSelectOption<T> option)
Decides whether option matches what the user typed.
WeSelectRemote<T> = Future<List<WeSelectOption<T>>> Function(String query)
Loads the options for query from somewhere else, e.g. a search API.
WeUploader = Future<Object?> Function(WeUploadFile file, ValueChanged<double> onProgress)
Uploads file, reporting 0–1 through onProgress. The returned value becomes WeUploadFile.response; throwing marks the file failed.
WeUploadPicker = Future<List<WeUploadFile>> Function(bool multiple)
Opens a file chooser and returns what the user picked.
WeValidator = FutureOr<String?> Function(Object? value)
A custom check: return an error message, or null when the value is fine. May be async, e.g. to ask a server whether a name is taken.