feat:增加common框架
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_common/widget/dialog_widget.dart';
|
||||
import 'package:toggle_switch/toggle_switch.dart';
|
||||
|
||||
OutlineInputBorder buildFormBoard() {
|
||||
@@ -22,28 +23,6 @@ OutlineInputBorder buildFormFocusedBoard(ColorScheme colors) {
|
||||
);
|
||||
}
|
||||
|
||||
// 卡片
|
||||
class BuildCard extends StatelessWidget {
|
||||
final Widget? child;
|
||||
|
||||
const BuildCard({super.key, this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// border: Border.all(color: colors.outline.withAlpha(50), width: 1),
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 底部弹出
|
||||
void buildModalBottom({
|
||||
required BuildContext context,
|
||||
@@ -152,35 +131,6 @@ Widget buildDismissible({
|
||||
);
|
||||
}
|
||||
|
||||
// 确认对话框
|
||||
Future<bool?> showConfirmDialog(BuildContext context, String text) async {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('确认'),
|
||||
backgroundColor: colors.surfaceContainer,
|
||||
content: Text(text),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: colors.secondary.withAlpha(150)),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: Text('确认', style: TextStyle(color: colors.primary)),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDismissBackground() {
|
||||
return Container(
|
||||
color: Colors.red,
|
||||
|
||||
Reference in New Issue
Block a user