WidgetExtensions extension
A collection of helpful extensions on Widget to reduce boilerplate.
- on
Methods
-
animateFade(
{bool isVisible = true, Duration duration = const Duration(milliseconds: 300)}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a simple implicit animated opacity. Example:Text('Hello').animateFade(isVisible: true) -
blur(
{double sigmaX = 5.0, double sigmaY = 5.0}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Applies a blur effect over the widget. Example:Image.network(...).blur() -
card(
{double elevation = 1.0, ShapeBorder? shape, EdgeInsetsGeometry? margin}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a Card. Example:Text('Hello').card() -
center(
) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a Center. Example:Text('Hello').center() -
clipRadius(
double radius) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Clips the widget with rounded corners. Example:Image.network(...).clipRadius(10) -
expand(
[int flex = 1]) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in an Expanded. Example:Container().expand() -
gesture(
{VoidCallback? onTap, VoidCallback? onDoubleTap, VoidCallback? onLongPress}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a generic GestureDetector. Example:Text('Hold Me').gesture(onLongPress: () => print('Held!')) -
gradient(
Gradient gradient) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Applies a shader mask gradient over the widget. Example:Text('Hello').gradient(LinearGradient(...)) -
hero(
Object tag) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a Hero. Example:Image.network(...).hero('image_tag') -
loading(
bool isLoading, {Widget? loader}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Shows a loader instead of the widget ifisLoadingis true. Example:ListView(...).loading(true) -
onTap(
VoidCallback? onTap) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a GestureDetector with a simple onTap. Example:Text('Click Me').onTap(() => print('Clicked!')) -
opacity(
double opacity) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Adjusts the opacity of the widget. Example:Text('Hello').opacity(0.5) -
paddingAll(
double value) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a Padding with uniform padding. Example:Text('Hello').paddingAll(16) -
rotate(
{int quarterTurns = 1}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Rotates the widget byquarterTurns. Example:Icon(Icons.arrow_upward).rotate(quarterTurns: 1) -
safeArea(
{bool top = true, bool bottom = true, bool left = true, bool right = true}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a SafeArea. Example:Container().safeArea() -
scale(
double scale) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Scales the widget. Example:Text('Hello').scale(1.5) -
shadow(
{Color color = const Color(0x33000000), double blurRadius = 10.0, Offset offset = Offset.zero, double spreadRadius = 0.0, BorderRadiusGeometry? borderRadius}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Adds a shadow to the widget using a Container and BoxShadow. Example:Container().shadow() -
tooltip(
String message) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Wraps the widget in a Tooltip. Example:Icon(Icons.info).tooltip('Information') -
visible(
bool isVisible, {Widget replacement = const SizedBox.shrink()}) → Widget -
Available on Widget, provided by the WidgetExtensions extension
Controls the visibility of the widget. Example:Text('Hello').visible(true)