GlassContainer class

A customizable frosted glass UI container for Flutter apps.

The GlassContainer widget provides a modern glassmorphism effect using blur, opacity, border, and optional gradients.

Example usage:

GlassContainer(
  blur: 20,
  opacity: 0.3,
  height: 200,
  width: 300,
  borderRadius: BorderRadius.circular(20),
  child: Text("Glassmorphic UI"),
)
Inheritance

Constructors

GlassContainer({Key? key, double blur = 15.0, double opacity = 0.5, BorderRadius borderRadius = const BorderRadius.all(Radius.circular(20)), Widget? child, Color color = Colors.white, List<BoxShadow>? shadow, double? height, double? width, Color? borderColor, double borderWidth = 1.5, bool useGradient = true})
Creates a GlassContainer widget with optional customization.
const

Properties

blur double
The amount of blur applied to the background.
final
borderColor Color?
The color of the border around the glass container.
final
borderRadius BorderRadius
The border radius of the container.
final
borderWidth double
The width of the border.
final
child Widget?
The widget to be displayed inside the glass container.
final
color Color
The solid background color used when useGradient is false.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the container.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
opacity double
The opacity level of the background color.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadow List<BoxShadow>?
A list of shadows to apply around the container.
final
useGradient bool
Whether to use a built-in gradient for background.
final
width double?
The width of the container.
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