Avatar class
A widget that displays an avatar image.
Example:
Avatar(
onTapAvatar: () {},//With this function, you can display page shift or page view in a personalized way.
text: avatar[index],
radius: 35,
randomGradient: true,
randomColor: false,
imageNetwork: "https://images.unsplash.com/photo-1616731948638-b0d0befef759?q=80&w=1974&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
showPageViewOnTap: true, //By activating this option, the user can see the avatar images in the page view.
)
text: The text to display on the avatar.
widthBorder: The border width of the avatar (default: 0.0).
radius: The radius of the avatar size.
image: The imageAssets for the avatar.
imageNetwork: The image URL for the avatar.
backgroundColor: The background color of the avatar (can be null).
gradientBackgroundColor: The gradient background of the avatar (can be null).
gradientWidthBorder: The gradient for the avatar's border (default: linear gradient from blue to deep purple).
- Inheritance
- Available extensions
Constructors
-
Avatar({Key? key, required String? text, void onTapAvatar()?, double? radius = 35, String? image, String? imageNetwork, List<
String> ? listImageNetwork, Color? backgroundColor, Gradient? gradientBackgroundColor, Color? shadowColor = Colors.black, Gradient? gradientWidthBorder = const LinearGradient(colors: [Colors.blue, Colors.deepPurple]), double elevation = 0, double widthBorder = 0.0, bool isBorderAvatar = false, bool useMaterialColorForGradient = true, bool mixColorForGradient = false, bool showStatusSettings = false, StatusIndicatorSettings? statusSettings, Widget? child, TextStyle? style = const TextStyle(fontSize: 25, color: Colors.white, fontWeight: FontWeight.bold), bool randomColor = true, bool randomGradient = false})
Properties
- backgroundColor ↔ Color?
-
backgroundColor: The background color of the profile (can be null).
getter/setter pair
- child → Widget?
-
child: The child widget to display inside the avatar.
final
- elevation → double
-
elevation: create shadow widget (can be null).
final
- gradientBackgroundColor ↔ Gradient?
-
gradientBackgroundColor: The gradient background of the profile (can be null).
getter/setter pair
- gradientWidthBorder → Gradient?
-
gradientWidthBorder: The gradient for the profile's border (default: linear gradient from blue to deep purple).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- image → String?
-
image: The imageAssets for the profile.
final
- imageNetwork → String?
-
imageNetwork: The image URL list for pageView profile.
final
- isBorderAvatar → bool
-
The isBorderAvatar parameter, if true, creates a border for the avatar.
This border contains a circular border with a default width of 5 and a color of LinearGradient.
If this parameter is false, no border will be created for the avatar.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
listImageNetwork
→ List<
String> ? -
listImageNetwork: The images URL for the profile.
final
- mixColorForGradient → bool
-
mixColorForGradient : mix color for gradient. Default = false
final
- onTapAvatar → void Function()?
-
onTapAvatar: A callback function for when the avatar is tapped.
final
- radius → double?
-
radius: The radius of the profile size.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadowColor → Color?
-
shadowColor: elevation color .
final
- showStatusSettings → bool
-
showStatusSettings : show status settings. Default = false
final
- statusSettings → StatusIndicatorSettings?
-
statusSettings: The status indicator settings for the avatar.
final
- style → TextStyle?
-
style: The text style (default: font size 25, white color, and bold).
final
- text → String?
-
text: The text to display on the profile.
final
- useMaterialColorForGradient → bool
-
useMaterialColorForGradient : use material color for gradient. Default = true
final
- widthBorder → double
-
widthBorder: The border width of the profile (default: 0.0).
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Avatar> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
Static Methods
-
defaultItemsBuilder(
int index) → List< DropdownMenuItem< String> > -
profile(
{required String? text, double widthBorder = 0.0, double? radius = 35, String? image, String? imageNetwork, Color? backgroundColor, Gradient? gradientBackgroundColor, Gradient? gradientWidthBorder = const LinearGradient(colors: [Colors.blue, Colors.deepPurple]), TextStyle? style = const TextStyle(fontSize: 25, color: Colors.white, fontWeight: FontWeight.bold), Color backgroundColorCamera = Colors.white, IconData? icon = Icons.camera, Color iconColor = Colors.black, bool randomColor = true, bool randomGradient = false, double elevation = 0, Color shadowColor = Colors.black, OnPickerChange? onPickerChange, bool isBorderAvatar = false, OnPickerChangeWeb? onPickerChangeWeb, BottomSheetStyles? bottomSheetStyles, bool useMaterialColorForGradient = true, bool mixColorForGradient = false, Widget? child, CustomBottomSheetBuilder? customBottomSheetBuilder}) → Widget