CmsSingleMediaEntry class

Single-file variant of CmsMediaEntry.

Stores a single object (typically the URL string returned by valueBuilder) directly in the JsonMap under key, instead of a one-element list. Useful for fields like a cover image where the storage shape is a scalar and callers don't want to wrap / unwrap an iterable.

Internally renders a CmsMediaField capped at one file.

Inheritance

Constructors

CmsSingleMediaEntry({required String key, required CmsMediaDelegate delegate, required List<CmsMediaType> supportedMedia, required CmsMediaType mediaTypeBuilder(dynamic object), String urlBuilder(dynamic object)?, dynamic valueBuilder(CmsMediaUploadRes res, XFile file)?, String? label, CmsEntryModifier modifier = const CmsEntryModifier(expanded: true), int? flex = 2, double? width})

Properties

delegate → CmsMediaDelegate
final
editable → bool
no setterinherited
expanded → bool
no setterinherited
fixedLabel → String
Real display of the field. If null, last segment of key is displayed
no setterinherited
fixedLabelRequired → String
Adds * at the end of the label
no setterinherited
flex → int?
Defines the column's share of the CmsTableItem width in the CmsTable.
final
hashCode → int
The hash code for this object.
no setterinherited
initializable → bool
no setterinherited
key → String
key is a path to the value in JsonMap.
final
label → String?
label displays the name of the entry.
final
mediaTypeBuilder → CmsMediaType Function(dynamic object)
Function that determines CmsMediaType based on object's JsonMap.
final
modifier → CmsEntryModifier
Modifies the behavior of the CmsEntry
final
required → bool
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sortable → bool
no setterinherited
sortInvertNulls → bool
no setterinherited
supportedMedia → List<CmsMediaType>
final
urlBuilder → String Function(dynamic object)?
Getter for url from object's JsonMap.
final
valueBuilder → dynamic Function(CmsMediaUploadRes res, XFile file)?
Optional custom object created from upload response and file.
final
width → double?
Width of a fixed (non-flexing) column, i.e. the width used when flex is null. Ignored while flex is non-null.
final

Methods

buildEditField({required BuildContext context, required dynamic value, required void onChanged(dynamic value)}) → Widget
Builder for edit/create flow.
override
buildPreview(BuildContext context, dynamic value) → Widget
Preview of the value shown in the CmsTable
override
fromJson(Object? json) → dynamic
simple fromJson method, e.g. int.parse(json.toString) for an int value.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onSaved() → Future<void>
inherited
toJson(dynamic value) → Object?
simple toJson method, e.g. 12.toString for an int value.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited