|
|
|
|
|
|
TextStyle textStyle = null, |
|
|
|
BorderRadius borderRadius = null, |
|
|
|
ShapeBorder shape = null, |
|
|
|
bool borderOnForeground = true, |
|
|
|
D.assert(elevation >= 0.0f); |
|
|
|
D.assert(!(shape != null && borderRadius != null)); |
|
|
|
D.assert(!(type == MaterialType.circle && (borderRadius != null || shape != null))); |
|
|
|
|
|
|
|
|
|
|
this.textStyle = textStyle; |
|
|
|
this.borderRadius = borderRadius; |
|
|
|
this.shape = shape; |
|
|
|
this.borderOnForeground = borderOnForeground; |
|
|
|
this.clipBehavior = clipBehavior; |
|
|
|
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration; |
|
|
|
this.child = child; |
|
|
|
|
|
|
|
|
|
|
public readonly ShapeBorder shape; |
|
|
|
|
|
|
|
public readonly bool borderOnForeground; |
|
|
|
|
|
|
|
public readonly Clip clipBehavior; |
|
|
|
|
|
|
|
public readonly TimeSpan animationDuration; |
|
|
|
|
|
|
defaultValue: new Color(0xFF000000))); |
|
|
|
this.textStyle?.debugFillProperties(properties); |
|
|
|
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape, defaultValue: null)); |
|
|
|
properties.add(new EnumProperty<BorderRadius>("borderRadius", this.borderRadius, defaultValue: null)); |
|
|
|
properties.add(new DiagnosticsProperty<bool>("borderOnForeground", this.borderOnForeground, |
|
|
|
defaultValue: null)); |
|
|
|
properties.add( |
|
|
|
new DiagnosticsProperty<BorderRadius>("borderRadius", this.borderRadius, defaultValue: null)); |
|
|
|
} |
|
|
|
|
|
|
|
public const float defaultSplashRadius = 35.0f; |
|
|
|
|
|
|
|
|
|
|
if (this.widget.type == MaterialType.transparency) { |
|
|
|
return _transparentInterior( |
|
|
|
context: context, |
|
|
|
shape: shape, |
|
|
|
clipBehavior: this.widget.clipBehavior, |
|
|
|
contents: contents); |
|
|
|
|
|
|
curve: Curves.fastOutSlowIn, |
|
|
|
duration: this.widget.animationDuration, |
|
|
|
shape: shape, |
|
|
|
borderOnForeground: this.widget.borderOnForeground, |
|
|
|
clipBehavior: this.widget.clipBehavior, |
|
|
|
elevation: this.widget.elevation, |
|
|
|
color: backgroundColor, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Widget _transparentInterior( |
|
|
|
BuildContext context = null, |
|
|
|
ShapeBorder shape = null, |
|
|
|
Clip? clipBehavior = null, |
|
|
|
Widget contents = null) { |
|
|
|
|
|
|
Key key = null, |
|
|
|
Widget child = null, |
|
|
|
ShapeBorder shape = null, |
|
|
|
bool borderOnForeground = true, |
|
|
|
Clip clipBehavior = Clip.none, |
|
|
|
float? elevation = null, |
|
|
|
Color color = null, |
|
|
|
|
|
|
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) { |
|
|
|
D.assert(child != null); |
|
|
|
D.assert(shape != null); |
|
|
|
D.assert(elevation != null); |
|
|
|
D.assert(elevation != null && elevation >= 0.0f); |
|
|
|
this.borderOnForeground = borderOnForeground; |
|
|
|
this.clipBehavior = clipBehavior; |
|
|
|
this.elevation = elevation ?? 0.0f; |
|
|
|
this.color = color; |
|
|
|
|
|
|
public readonly Widget child; |
|
|
|
|
|
|
|
public readonly ShapeBorder shape; |
|
|
|
|
|
|
|
public readonly bool borderOnForeground; |
|
|
|
|
|
|
|
public readonly Clip clipBehavior; |
|
|
|
|
|
|
|
|
|
|
return new PhysicalShape( |
|
|
|
child: new _ShapeBorderPaint( |
|
|
|
child: this.widget.child, |
|
|
|
shape: shape), |
|
|
|
shape: shape, |
|
|
|
borderOnForeground: this.widget.borderOnForeground), |
|
|
|
clipper: new ShapeBorderClipper( |
|
|
|
shape: shape), |
|
|
|
clipBehavior: this.widget.clipBehavior, |
|
|
|
|
|
|
class _ShapeBorderPaint : StatelessWidget { |
|
|
|
public _ShapeBorderPaint( |
|
|
|
Widget child = null, |
|
|
|
ShapeBorder shape = null) { |
|
|
|
ShapeBorder shape = null, |
|
|
|
bool borderOnForeground = true) { |
|
|
|
this.borderOnForeground = borderOnForeground; |
|
|
|
|
|
|
|
public readonly bool borderOnForeground; |
|
|
|
foregroundPainter: new _ShapeBorderPainter(this.shape)); |
|
|
|
painter: this.borderOnForeground ? null : new _ShapeBorderPainter(this.shape), |
|
|
|
foregroundPainter: this.borderOnForeground ? new _ShapeBorderPainter(this.shape) : null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|