dilemmaChoiceChips<T> static method

Future<T?> dilemmaChoiceChips<T>(
  1. BuildContext context, {
  2. required List<Widget> children,
  3. Widget? title,
  4. Color titleBackgroundColor = Colors.lightBlueAccent,
  5. Color? barrierColor,
  6. Color? dialogBackgroundColor,
  7. bool barrierDismissible = true,
})

选择弹出框

Implementation

static Future<T?> dilemmaChoiceChips<T>(
  BuildContext context, {
  required List<Widget> children,
  Widget? title, // 标题Title
  Color titleBackgroundColor = Colors.lightBlueAccent, // Title 背景色
  Color? barrierColor, // 背景蒙版色
  Color? dialogBackgroundColor,
  bool barrierDismissible = true, // 点击空白区域用作取消
}) {
  return showDialog(
    context: context,
    barrierColor: barrierColor,
    barrierDismissible: barrierDismissible,
    builder: (context) {
      return SimpleDialog(
        backgroundColor: dialogBackgroundColor,
        shape: const RoundedRectangleBorder(
          borderRadius: _borderRadius,
        ),
        title: Container(
          padding: EdgeInsets.all(18.0),
          child: title,
          decoration: BoxDecoration(
            borderRadius: const BorderRadius.only(
              topLeft: const Radius.circular(_radiusValue),
              topRight: const Radius.circular(_radiusValue),
            ),
            color: titleBackgroundColor,
            boxShadow: kElevationToShadow[4],
          ),
        ),
        titlePadding: EdgeInsets.zero,
        children: children
            .map(
              (e) => Padding(
                padding: EdgeInsets.only(
                  left: 18.0,
                  right: 18.0,
                  top: 12.0,
                  bottom: 12.0,
                ),
                child: e,
              ),
            )
            .toList(),
      );
    },
  );
}