111
This commit is contained in:
@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import '../../core/theme/app_spacing.dart';
|
||||
|
||||
/// 现代底部抽屉模板 - 基于 modernization-v2.md 规范
|
||||
/// 現代底部抽屜模板 - 基於 modernization-v2.md 規範
|
||||
///
|
||||
/// 使用方法:
|
||||
/// ```dart
|
||||
/// ModernBottomSheet.show(
|
||||
/// context: context,
|
||||
/// title: '选择币种',
|
||||
/// title: '選擇幣種',
|
||||
/// child: YourContentWidget(),
|
||||
/// );
|
||||
/// ```
|
||||
@@ -32,7 +32,7 @@ class ModernBottomSheet extends StatelessWidget {
|
||||
this.onClose,
|
||||
});
|
||||
|
||||
/// 显示底部抽屉
|
||||
/// 顯示底部抽屜
|
||||
static Future<T?> show<T>({
|
||||
required BuildContext context,
|
||||
String? title,
|
||||
@@ -62,7 +62,7 @@ class ModernBottomSheet extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示操作列表
|
||||
/// 顯示操作列表
|
||||
static Future<T?> showActions<T>({
|
||||
required BuildContext context,
|
||||
String? title,
|
||||
@@ -75,12 +75,12 @@ class ModernBottomSheet extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示确认操作
|
||||
/// 顯示確認操作
|
||||
static Future<bool> confirmAction({
|
||||
required BuildContext context,
|
||||
required String title,
|
||||
String? description,
|
||||
String confirmText = '确认',
|
||||
String confirmText = '確認',
|
||||
String cancelText = '取消',
|
||||
bool isDestructive = false,
|
||||
}) async {
|
||||
@@ -150,12 +150,12 @@ class ModernBottomSheet extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 拖动指示器
|
||||
// 拖動指示器
|
||||
if (showDragHandle) _buildDragHandle(theme),
|
||||
// 标题行
|
||||
// 標題行
|
||||
if (title != null || titleWidget != null || showCloseButton)
|
||||
_buildHeader(context, theme),
|
||||
// 内容
|
||||
// 內容
|
||||
child,
|
||||
],
|
||||
),
|
||||
@@ -183,7 +183,7 @@ class ModernBottomSheet extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(bottom: AppSpacing.md),
|
||||
child: Row(
|
||||
children: [
|
||||
// 标题
|
||||
// 標題
|
||||
Expanded(
|
||||
child: titleWidget ?? Text(
|
||||
title!,
|
||||
@@ -192,7 +192,7 @@ class ModernBottomSheet extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
// 关闭按钮
|
||||
// 關閉按鈕
|
||||
if (showCloseButton)
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
@@ -238,7 +238,7 @@ class _ActionList extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// 操作项
|
||||
/// 操作項
|
||||
class _ActionTile extends StatelessWidget {
|
||||
final ModernSheetAction action;
|
||||
|
||||
@@ -289,7 +289,7 @@ class _ActionTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// 底部抽屉操作配置
|
||||
/// 底部抽屜操作配置
|
||||
class ModernSheetAction {
|
||||
final String label;
|
||||
final IconData? icon;
|
||||
|
||||
Reference in New Issue
Block a user