自习室优化ok
This commit is contained in:
65
lib/widgets/base/actionSheet/action_sheet_ui.dart
Normal file
65
lib/widgets/base/actionSheet/action_sheet_ui.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'type.dart';
|
||||
|
||||
class ActionSheetUi extends StatelessWidget {
|
||||
final List<ActionSheetItem> actions;
|
||||
final bool showCancel;
|
||||
final double actionHeight = 50;
|
||||
final Function(ActionSheetItem) onConfirm;
|
||||
|
||||
const ActionSheetUi({
|
||||
super.key,
|
||||
required this.actions,
|
||||
this.showCancel = false,
|
||||
required this.onConfirm,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
...actions.map((item) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
onConfirm(item);
|
||||
context.pop();
|
||||
},
|
||||
child: Container(
|
||||
height: actionHeight,
|
||||
alignment: Alignment.center,
|
||||
child: Text(item.title),
|
||||
),
|
||||
);
|
||||
}),
|
||||
Visibility(
|
||||
visible: showCancel,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 8,
|
||||
color: const Color.fromRGBO(238, 239, 243, 1.0),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Container(
|
||||
height: actionHeight,
|
||||
alignment: Alignment.center,
|
||||
child: const Text("取消"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user