material method

  1. @protected
Widget material(
  1. Widget child
)

Wrap if necessary.

  • child : The child widget.

Implementation

@protected
Widget material(Widget child) {
  final mParams = spwmlParams.p.materialParams;
  if (mParams == null) return child;
  // Materialウィジェットを先に定義
  final materialWidget = Material(
    key: spwmlParams.p.materialParams!.key,
    type: spwmlParams.p.materialParams!.type,
    elevation: spwmlParams.p.materialParams!.elevation,
    color: spwmlParams.p.materialParams!.color,
    shadowColor: spwmlParams.p.materialParams!.shadowColor,
    surfaceTintColor: spwmlParams.p.materialParams!.surfaceTintColor,
    textStyle: spwmlParams.p.materialParams!.textStyle,
    borderRadius: spwmlParams.p.materialParams!.borderRadius,
    shape: spwmlParams.p.materialParams!.shape,
    borderOnForeground: spwmlParams.p.materialParams!.borderOnForeground,
    clipBehavior: spwmlParams.p.materialParams!.clipBehavior,
    animationDuration: spwmlParams.p.materialParams!.animationDuration,
    child: child,
  );
  // パディングがある場合のみラップして返す
  if (mParams.materialPadding != null) {
    return Padding(padding: mParams.materialPadding!, child: materialWidget);
  }
  return materialWidget;
}