FormItemMedia constructor
FormItemMedia({
- Key? key,
- TextEditingController? controller,
- required void onTap(
- void onUpdate(
- dynamic fileOrUrl
- void onUpdate(
- Color? color,
- String hintText = "",
- String errorText = "",
- bool allowEmpty = false,
- bool dense = false,
- double height = 200,
- List<
String> videoExtensionList = const ["mp4", "ogv", "webm", "avi", "mpeg"], - IconData icon = Icons.add_a_photo,
- void onSaved(
- String? value
- String validator(
- String? value
- String? initialURI,
- bool enabled = true,
- FormItemMediaType type = FormItemMediaType.both,
Form widget for uploading media (Image and Video).
FormItemMedia(
constroller: useMemoizedTextEditingController(),
onTap: (onUpdate){
final media = await UIMediaDialog();
onUpdate(media.path);
},
onSaved: (value){
context["url"] = value;
}
)
Implementation
FormItemMedia({
Key? key,
this.controller,
required this.onTap,
this.color,
this.hintText = "",
this.errorText = "",
this.allowEmpty = false,
this.dense = false,
this.height = 200,
this.videoExtensionList = const [
"mp4",
"ogv",
"webm",
"avi",
"mpeg",
],
this.icon = Icons.add_a_photo,
void Function(String? value)? onSaved,
String Function(String? value)? validator,
String? initialURI,
bool enabled = true,
this.type = FormItemMediaType.both,
}) : super(
key: key,
builder: (state) {
return const Empty();
},
onSaved: onSaved,
validator: (value) {
if (!allowEmpty && errorText.isNotEmpty && value.isEmpty) {
return errorText;
}
return validator?.call(value);
},
initialValue: initialURI,
enabled: enabled,
);