BaseButton class
BaseButton
Modern cross-platform button with iOS 26 Liquid Glass Dynamic Material design. Implements true Liquid Glass principles with dynamic adaptability, real-time interactivity, and sophisticated optical properties including transparency, reflections, and refractions.
iOS 26 Liquid Glass Dynamic Material Features:
- Transparency & Refractions: Multi-layer optical effects with realistic light behavior
- Dynamic Adaptability: Content and context-aware visual transformations
- Real-time Interactivity: Enhanced haptic feedback and visual responses
- Unified Design Language: Consistent experience across Apple platforms
- Content Hierarchy: Clear separation between button content and background
- Fluid Responsiveness: Adaptive appearance based on user interactions
Material 3 Integration:
- Full Material 3 button variants (Filled, Tonal, Outlined, Text)
- Semantic ColorScheme usage with state layers and enhanced accessibility
- Modern elevation and shadow systems with cross-platform harmony
use CupertinoButton or CupertinoButton.filled by cupertino *** use cupertino = { forceUseMaterial: true } force use Material buttons (FilledButton, TextButton, OutlinedButton, ElevatedButton) on cupertino. use FilledButton, TextButton, OutlinedButton, ElevatedButton (Material 3) by material *** use material = { forceUseCupertino: true } force use CupertinoButton or CupertinoButton.filled on material.
CupertinoButton: Updated for iOS 26 Liquid Glass Dynamic Material design patterns Material Buttons: Updated for Material 3 (Material You) Updated: 2025.08.11 for iOS 26 Liquid Glass Dynamic Material and Material 3
- Inheritance
Constructors
-
BaseButton({Key? key, Color? color, VoidCallback? onPressed, Color? disabledColor, EdgeInsetsGeometry? padding, Widget? child, double? minSize = 44.0, double? pressedOpacity = 0.4, BorderRadius? borderRadius = const BorderRadius.all(Radius.circular(8.0)), AlignmentGeometry alignment = Alignment.center, bool filledButton = false, VoidCallback? onLongPress, ButtonStyle? style, ValueChanged<
bool> ? onHighlightChanged, ButtonTextTheme? textTheme, Color? textColor, Color? disabledTextColor, Color? focusColor, Color? hoverColor, Color? highlightColor, Color? splashColor, Brightness? colorBrightness, double? elevation, double? focusElevation, double? highlightElevation, double? disabledElevation, VisualDensity? visualDensity, ShapeBorder? shape, Clip clipBehavior = Clip.none, FocusNode? focusNode, bool autofocus = false, MaterialTapTargetSize? materialTapTargetSize, Duration? animationDuration, double? minWidth, MouseCursor? mouseCursor, double? hoverElevation, bool enableFeedback = true, double? height = 48.0, bool textButton = false, bool outlinedButton = false, bool elevatedButton = false, bool filledTonalButton = false, bool adaptiveHaptics = true, bool useCNButton = false, CNButtonStyle? cnButtonStyle, bool shrinkWrap = false, BaseParam? baseParam}) -
const
- BaseButton.icon({Key? key, VoidCallback? onPressed, VoidCallback? onLongPress, ButtonStyle? style, FocusNode? focusNode, bool autofocus, Clip clipBehavior, EdgeInsetsGeometry? padding, Color? color, Color? disabledColor, double minSize, double? pressedOpacity, BorderRadius? borderRadius, AlignmentGeometry alignment, Widget icon, Widget label, bool filledButton, bool filledTonalButton, bool textButton, bool outlinedButton, bool elevatedButton, bool adaptiveHaptics, bool useCNButton, CNButtonStyle? cnButtonStyle, bool shrinkWrap, BaseParam? baseParam})
-
CupertinoButton, child is Row(children:
icon, label) or MaterialButton, child is Row(children:icon, label) or TextButton.icon oroutlinedButtonButton.iconor ElevatedButton.iconconstfactory
Properties
- adaptiveHaptics → bool
-
Enhanced haptic feedback for iOS interactions
Provides adaptive haptic responses based on button type
Note: CNButton components automatically include liquid glass effects
final
- alignment → AlignmentGeometry
-
CupertinoButton.alignment
final
- animationDuration → Duration?
-
MaterialButton.animationDuration
final
- autofocus → bool
-
MaterialButton.autofocus
final
- baseParam → BaseParam?
-
Personalization parameters, gets platform parameters first, then mode parameters
finalinherited
- borderRadius → BorderRadius?
-
CupertinoButton.borderRadius
final
- child → Widget?
-
CupertinoButton.child
or
MaterialButton.child
final
- clipBehavior → Clip
-
MaterialButton.clipBehavior
final
- cnButtonStyle → CNButtonStyle?
-
CNButton style (plain, gray, filled, tinted, bordered, prominentGlass)
Only used when useCNButton is true
final
- color → Color?
-
*** general properties start ***
CupertinoButton.color
or
MaterialButton.color
final
- colorBrightness → Brightness?
-
MaterialButton.colorBrightness
final
- disabledColor → Color?
-
CupertinoButton.disabledColor
or
MaterialButton.disabledColor
final
- disabledElevation → double?
-
MaterialButton.disabledElevation
final
- disabledTextColor → Color?
-
MaterialButton.disabledTextColor
final
- elevatedButton → bool
-
ElevatedButton
use ElevatedButton
final
- elevation → double?
-
MaterialButton.elevation
final
- enableFeedback → bool
-
MaterialButton.enableFeedback
final
- filledButton → bool
-
CupertinoButton.filled
use CupertinoButton.filled, will ignore the color, use primary color.
final
- filledTonalButton → bool
-
Material 3 FilledButton.tonal variant
use FilledButton.tonal for Material 3 design
final
- focusColor → Color?
-
MaterialButton.focusColor
final
- focusElevation → double?
-
MaterialButton.focusElevation
final
- focusNode → FocusNode?
-
MaterialButton.focusNode
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
MaterialButton.height
final
- highlightColor → Color?
-
MaterialButton.highlightColor
final
- highlightElevation → double?
-
MaterialButton.highlightElevation
final
- hoverColor → Color?
-
MaterialButton.hoverColor
final
- hoverElevation → double?
-
MaterialButton.hoverElevation
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- materialTapTargetSize → MaterialTapTargetSize?
-
MaterialButton.materialTapTargetSize
final
- minSize → double?
-
*** general properties end ***
*** cupertino properties start ***
CupertinoButton.minSize
final
- minWidth → double?
-
MaterialButton.minWidth
final
- mouseCursor → MouseCursor?
-
MaterialButton.mouseCursor
final
-
onHighlightChanged
→ ValueChanged<
bool> ? -
MaterialButton.onHighlightChanged
final
- onLongPress → VoidCallback?
-
*** cupertino properties ened ***
*** material properties start ***
MaterialButton.onLongPress
final
- onPressed → VoidCallback?
-
CupertinoButton.onPressed
or
MaterialButton.onPressed
final
- outlinedButton → bool
-
OutlinedButton
use OutlinedButton
final
- padding → EdgeInsetsGeometry?
-
CupertinoButton.padding
or
MaterialButton.padding
final
- pressedOpacity → double?
-
CupertinoButton.pressedOpacity
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shape → ShapeBorder?
-
MaterialButton.shape
final
- shrinkWrap → bool
-
Shrink wrap button to fit content (CNButton only)
Only used when useCNButton is true
final
- splashColor → Color?
-
MaterialButton.splashColor
final
- style → ButtonStyle?
-
ButtonStyleButton.style
final
- textButton → bool
-
TextButton
use TextButton
final
- textColor → Color?
-
MaterialButton.textColor
final
- textTheme → ButtonTextTheme?
-
MaterialButton.textTheme
final
- useCNButton → bool
-
*** CNButton (cupertino_native) properties start ***
Use CNButton from cupertino_native package (native iOS button with built-in liquid glass effects)
When true, uses CNButton instead of CupertinoButton on iOS
final
- visualDensity → VisualDensity?
-
MaterialButton.visualDensity
final
Methods
-
beforeBuild(
BuildContext context) → void -
Called before build
inherited
-
beforeBuildByCupertino(
BuildContext context) → void -
Called before buildByCupertino
inherited
-
beforeBuildByCupertinoNative(
BuildContext context) → void -
Called before buildByCupertinoNative (native iOS implementation)
inherited
-
beforeBuildByMaterial(
BuildContext context) → void -
Called before buildByMaterial
inherited
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
buildByCupertino(
BuildContext context) → Widget - *** CNButton properties end *** *** material properties end ***
-
buildByCupertinoNative(
BuildContext context) → dynamic -
build on cupertino mode with native iOS components (cupertino_native package)
This is called when baseParam.nativeIOS = true
Default implementation falls back to buildByCupertino()
inherited
-
buildByCupertinoWithChild(
Widget child) → Widget - Final build method, for compatibility with BaseButton.icon
-
buildByMaterial(
BuildContext context) → Widget - build on material mode
-
buildByMaterialWithChild(
Widget child, [BuildContext? context]) → Widget - Final build method, for compatibility with BaseButton.icon
-
commonBuild(
BuildContext context, BaseParam? baseParam) → dynamic -
inherited
-
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
-
getBuildMode(
BaseParam? baseParam) → WidgetBuildMode -
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
-
valueOf(
String key, dynamic value) → dynamic -
inherited
-
valueOfBaseParam(
BaseParam? baseParam, String key, dynamic value) → dynamic -
No reflection available in Dart
First get value from platform, then from mode, finally from value itself
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited