GradientContainer class

Gradient Container is a classic container rounded and filled with a gradient color. Depending on its params, user can change most of its UI. Params are defined as follows:

  • gradient is the main gradient used to fill the container
  • gradientOnBorders is a bool param to move the gradient on borders. If true it override the Container background and fill it with a Colors.transparent color.
  • color could be used to override the default color of the container. If specified it overrides the gradient in case of gradientOnBorders false, otherwise the background color
  • borderColor could be specified to override the borderColor. It overrides the gradient in case of gradientOnBorders true, otherwise it colors the Container borders
  • borderWidth the width of the Container borders
  • borderRadius the Radius of Container Borders
  • constraints helps the user to have a dynamical components that respects defined constraints
  • size helps the user to force the Container Size. If specified it overrides constraints
  • isExpanded will expand the container in horizontal
  • contentAlignment specifies the content Alignment of the container
  • padding defines the padding between the child/label and the container borders
  • label can be used in case you just want to show a string inside the container. If child is not specified and label is null, the label default value is set to Empty String
  • labelMaxLines in line with AutoSizeText library, you can specify how many lines the label can use before starting reducing its fontSize to adapt the label to the constraints or size
  • labelFontSize is the fontSize of label
  • labelColor is the color of label
  • child can be used to override the label text widget
Inheritance

Constructors

GradientContainer.new({Key? key, Gradient gradient = const LinearGradient(begin: Alignment.bottomLeft, end: Alignment.topRight, colors: [Colors.red, Colors.white], stops: [.5, 1]), bool gradientOnBorders = false, Color? color, Color? borderColor, double? borderWidth, BorderRadius? borderRadius, BoxConstraints? constraints, Size? size, bool isExpanded = false, MainAxisAlignment contentAlignment = MainAxisAlignment.center, EdgeInsetsGeometry padding = EdgeInsets.zero, String? label, int labelMaxLines = 1, double labelFontSize = 15, Color labelColor = Colors.black, Widget? child})
const

Properties

borderColor Color?
borderColor could be specified to override the borderColor. It overrides the gradient in case of gradientOnBorders true, otherwise it colors the Container borders
final
borderRadius BorderRadius?
borderRadius the Radius of Container Borders
final
borderWidth double?
borderWidth the width of the Container borders
final
child Widget?
  • child can be used to override the label text widget
  • final
    color Color?
    color could be used to override the default color of the container. If specified it overrides the gradient in case of gradientOnBorders false, otherwise the background color
    final
    constraints BoxConstraints?
    constraints helps the user to have a dynamical components that respects defined constraints
    final
    contentAlignment MainAxisAlignment
    contentAlignment specifies the content Alignment of the container
    final
    gradient Gradient
    gradient is the main gradient used to fill the container
    final
    gradientOnBorders bool
    gradientOnBorders is a bool param to move the gradient on borders. If true it override the Container background and fill it with a Colors.transparent color.
    final
    hashCode int
    The hash code for this object.
    no setterinherited
    isExpanded bool
    isExpanded will expand the container in horizontal
    final
    key Key?
    Controls how one widget replaces another widget in the tree.
    finalinherited
    label String?
    label can be used in case you just want to show a string inside the container. If child is not specified and label is null, the label default value is set to Empty String
    final
    labelColor Color
  • labelColor is the color of label
  • final
    labelFontSize double
    labelFontSize is the fontSize of label
    final
    labelMaxLines int
    labelMaxLines in line with AutoSizeText library, you can specify how many lines the label can use before starting reducing its fontSize to adapt the label to the constraints or size
    final
    padding EdgeInsetsGeometry
    padding defines the padding between the child/label and the container borders
    final
    runtimeType Type
    A representation of the runtime type of the object.
    no setterinherited
    size Size?
    size helps the user to force the Container Size. If specified it overrides constraints
    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