Surface constructor
const
Surface(- {double width,
- double height,
- Color color = _DEFAULT_COLOR,
- bool disableBorder = false,
- bool tappable = true,
- SurfaceCorners corners = SurfaceCorners.ROUND,
- double radius,
- double borderThickness = 3.0,
- Color borderColor = _DEFAULT_COLOR_BORDER,
- AlignmentGeometry borderAlignment,
- double borderRatio = 2.0,
- Gradient gradient,
- Gradient borderGradient,
- Color inkSplashColor,
- Color inkHighlightColor,
- SurfaceFilter filterStyle = SurfaceFilter.NONE,
- Duration duration = _DEFAULT_DURATION,
- Curve curve = Curves.easeIn,
- bool providesFeedback = false,
- EdgeInsets margin = const EdgeInsets.all(0),
- EdgeInsets padding = const EdgeInsets.all(0),
- SurfacePadding paddingStyle = SurfacePadding.PAD_CHILD,
- bool flipBevels = false,
- double filterSurfaceBlur = _DEFAULT_BLUR,
- double filterMaterialBlur = _DEFAULT_BLUR,
- double filterChildBlur = _DEFAULT_BLUR,
- VoidCallback onTap,
- Widget child}
)
Implementation
const Surface({
this.width,
this.height,
this.color = _DEFAULT_COLOR,
this.disableBorder = false,
this.tappable = true,
this.corners = SurfaceCorners.ROUND,
this.radius,
this.borderThickness = 3.0,
this.borderColor = _DEFAULT_COLOR_BORDER,
this.borderAlignment,
this.borderRatio = 2.0,
this.gradient,
this.borderGradient,
this.inkSplashColor,
this.inkHighlightColor,
this.filterStyle = SurfaceFilter.NONE,
this.duration = _DEFAULT_DURATION,
this.curve = Curves.easeIn,
this.providesFeedback = false,
this.margin = const EdgeInsets.all(0),
this.padding = const EdgeInsets.all(0),
this.paddingStyle = SurfacePadding.PAD_CHILD,
this.flipBevels = false,
this.filterSurfaceBlur = _DEFAULT_BLUR,
this.filterMaterialBlur = _DEFAULT_BLUR,
this.filterChildBlur = _DEFAULT_BLUR,
this.onTap,
this.child,
}) : assert((radius ?? 0) >= 0,
'[Surface] > Please provide a non-negative [borderRadius].'),
assert((borderThickness ?? 0) >= 0,
'[Surface] > Please provide a non-negative [borderThickness].'),
/// See ***WARNING*** above about [filterStyle] and [filterBorderBlur] value.
assert(
((filterStyle == SurfaceFilter.TRILAYER)
? (filterSurfaceBlur >= _MINIMUM_BLUR &&
filterMaterialBlur >= _MINIMUM_BLUR)
: true) ||
((filterStyle == SurfaceFilter.INNER_BILAYER)
? (filterMaterialBlur >= _MINIMUM_BLUR)
: true) ||
((filterStyle == SurfaceFilter.SURFACE_AND_CHILD)
? (filterSurfaceBlur >= _MINIMUM_BLUR)
: true) ||
((filterStyle == SurfaceFilter.SURFACE_AND_MATERIAL)
? (filterSurfaceBlur >= _MINIMUM_BLUR)
: true),
'[Surface] > Upper-layered filters will be negated if ancestor filters are enabled that have radius < 0.0003. Increase blur radius of lower layer(s) or pass a different [filterStyle].');