Upload class
General Upload Widget
This widget is displaying an child widget and is used to upload an image, video, or file.
You can change the following photoCamera,photoGallery,videoCamera,videoGallery,fromGallery,fromFile
upload source property
with bool value true/false if you want to limit the upload source.
Or Simply use the following named constructor to:
Upload specific types of files you can use the name constructor: Upload.image, Upload.video, Upload.file.
The onUpload function is called when the upload is complete.
onBeginUpload is called before the upload starts. If it's null, then it will continue uploading; If it's not null and If it returns false, the upload will not start.
If photoGallery is set to true, it will get only photos from gallery.
If videoGallery is set to true, it will get only videos from gallery.
If photoCamera is set to true, it will get only photos from camera.
If videoCamera is set to true, it will get only videos from camera.
If fromGallery is set to true, it will get whatever from Gallery. It can be any file like image, pdf, zip, video, audio, etc.
If fromFile is set to true, it will get whatever from file storage(Not from gallery). It can be any file like image, pdf, zip, video, audio, etc.
- Inheritance
Constructors
- Upload.new({Key? key, required void onUpload(String url), void onUploadSourceSelected(SourceType?)?, bool photoCamera = true, bool photoGallery = true, bool videoCamera = true, bool videoGallery = true, bool fromGallery = true, bool fromFile = true, dynamic progress(double)?, dynamic complete()?, Future onBeginUpload()?, Widget child = const Icon(Icons.add), VisualDensity? visualDensity, EdgeInsetsGeometry? iconPadding, EdgeInsetsGeometry? uploadBottomSheetPadding, double? uploadBottomSheetSpacing})
-
const
- Upload.file({required void onUpload(String url), Key? key, void onUploadSourceSelected(SourceType?)?, bool fromGallery = true, bool fromFile = true, dynamic progress(double)?, dynamic complete()?, Future onBeginUpload()?, Widget child = const Icon(Icons.attach_file), VisualDensity? visualDensity, EdgeInsetsGeometry? iconPadding, EdgeInsetsGeometry? uploadBottomSheetPadding, double? uploadBottomSheetSpacing})
-
Upload Icon Button for files from Gallery and file storage
const
- Upload.image({required void onUpload(String url), Key? key, void onUploadSourceSelected(SourceType?)?, bool photoCamera = true, bool photoGallery = true, dynamic progress(double)?, dynamic complete()?, Future onBeginUpload()?, Widget child = const Icon(Icons.camera_alt), VisualDensity? visualDensity, EdgeInsetsGeometry? iconPadding, EdgeInsetsGeometry? uploadBottomSheetPadding, double? uploadBottomSheetSpacing})
-
Upload Icon Button for Image from Galery and Camera
const
- Upload.video({required void onUpload(String url), Key? key, void onUploadSourceSelected(SourceType?)?, bool videoCamera = true, bool videoGallery = true, dynamic progress(double)?, dynamic complete()?, Future onBeginUpload()?, Widget child = const Icon(Icons.videocam), VisualDensity? visualDensity, EdgeInsetsGeometry? iconPadding, EdgeInsetsGeometry? uploadBottomSheetPadding, double? uploadBottomSheetSpacing})
-
Upload Icon Button for Video from Galery and Camera
const
Properties
- child → Widget
-
final
- complete → dynamic Function()?
-
final
- fromFile → bool
-
final
- fromGallery → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iconPadding → EdgeInsetsGeometry?
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onBeginUpload → Future Function()?
-
final
- onUpload → void Function(String url)
-
final
- onUploadSourceSelected → void Function(SourceType?)?
-
final
- photoCamera → bool
-
final
- photoGallery → bool
-
final
- progress → dynamic Function(double)?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uploadBottomSheetPadding → EdgeInsetsGeometry?
-
final
- uploadBottomSheetSpacing → double?
-
final
- videoCamera → bool
-
final
- videoGallery → bool
-
final
- visualDensity → VisualDensity?
-
final
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