12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /*
- * @Author : WuWei
- * @LastEditors : WuWei
- * @Date : 2022-11-02 10:26:39
- * @LastEditTime : 2023-10-26 19:14:34
- * @Description : Do not edit
- */
- import 'package:flutter/material.dart';
- import 'package:wisdom_cli/wisdom_cli.dart';
- final _shape = RoundedRectangleBorder(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(20.pt),
- topRight: Radius.circular(20.pt),
- ),
- );
- class WBottomModalUtil {
- WBottomModalUtil._();
- ///弹层
- static Future<T?> show<T>(
- BuildContext context, {
- bool? disabledConfirm,
- ///是否只显示关闭按钮
- bool? plain = true,
- BoxConstraints bodyConstraints = const BoxConstraints(
- maxHeight: 500,
- minHeight: 400,
- ),
- Widget? title,
- String? confirmText = '确定',
- String? cancelText = '取消',
- void Function(BuildContext)? onConfirm,
- void Function(BuildContext)? onCancel,
- Widget? body,
- }) {
- return showModalBottomSheet<T>(
- isScrollControlled: true,
- context: context,
- builder: (_) => AnimatedPadding(
- padding: EdgeInsets.only(
- bottom: MediaQuery.of(context).viewInsets.bottom, //软键盘高度
- ),
- duration: Duration(milliseconds: 100),
- child: WBottomModal(
- plain: plain!,
- bodyConstraints: bodyConstraints,
- title: title,
- onConfirm: onConfirm,
- onCancel: onCancel,
- confirmText: confirmText,
- cancelText: cancelText,
- body: body,
- ),
- ),
- );
- }
- }
|