SDGAFileInput<T> class
A widget for selecting and managing files.
This widget allows the user to browse and select one or multiple files, depending on the type specified.
The selected files can be accessed through the file or files property, and events for removing a file or browsing for new files can be handled through the onRemoveFile and onBrowseFile callbacks, respectively.
There are two types of SDGAFileInput:
- SDGAFileInput.single: Allows the user to select a single file.
- SDGAFileInput.multiple: Allows the user to select multiple files.
{@tool sample}
SDGAFileInput.single(
label: Text('Select a file'),
helperText: Text('Allowed formats: .pdf, .doc, .docx'),
onBrowseFile: () {
// Open file picker
},
onRemoveFile: (file) {
// Remove the selected file
},
)
{@end-tool}
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- SDGAFileInput
Constructors
-
SDGAFileInput.multiple({Key? key, required Widget label, Widget? icon, Widget? helperText, String browseText = "Browse Files", required List<
SDGAFile< ? files, void onFilePressed(SDGAFile<T> >T> file)?, void onRemoveFile(SDGAFile<T> file)?, void onReuploadFile(SDGAFile<T> file)?, void onBrowseFile()?, Widget fileWrapperBuilder(BuildContext context, SDGAFile<T> file, WidgetBuilder builder)?}) -
The SDGAFileInput widget itself does not manage the state or perform
the file picking operation. It relies on the parent widget or the containing
application logic to handle the state management and file selection process.
When the
onBrowseFilecallback is triggered, the parent widget should initiate the file picking process and update thefilesproperty accordingly.const -
SDGAFileInput.single({Key? key, required Widget label, Widget? helperText, String browseText = "Browse Files", SDGAFile<
T> ? file, void onFilePressed(SDGAFile<T> file)?, void onRemoveFile(SDGAFile<T> file)?, void onReuploadFile(SDGAFile<T> file)?, void onBrowseFile()?, Widget fileWrapperBuilder(BuildContext context, SDGAFile<T> file, WidgetBuilder builder)?}) -
Creates a single file input.
const
Properties
- browseText → String
-
The text for the browse button
final
-
file
→ SDGAFile<
T> ? -
The selected file.
final
-
files
→ List<
SDGAFile< ?T> > -
The list of selected files.
final
-
fileWrapperBuilder
→ Widget Function(BuildContext context, SDGAFile<
T> file, WidgetBuilder builder)? -
A function that wraps each file widget to provide additional functionality.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperText → Widget?
-
Additional information or context about the input.
final
- icon → Widget?
-
The icon to be displayed above the label.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → Widget
-
The label of this input.
final
- onBrowseFile → void Function()?
-
Callback function called when the browse button is pressed.
final
-
onFilePressed
→ void Function(SDGAFile<
T> file)? -
Callback function called when a file is pressed.
final
-
onRemoveFile
→ void Function(SDGAFile<
T> file)? -
Callback function called when a file needs to be removed.
final
-
onReuploadFile
→ void Function(SDGAFile<
T> file)? -
Callback function called when a file needs to be reuploaded.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited