feat:更新闪灵弹窗模块

This commit is contained in:
2025-11-10 10:58:08 +08:00
parent 98248bf1ad
commit e84be63d9f
11 changed files with 383 additions and 537 deletions

View File

@@ -24,3 +24,78 @@ Container buildCard({Widget? child}) {
child: child,
);
}
void buildModalBottom({
required BuildContext context,
required String title,
required Widget body,
}) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
color: Color.fromRGBO(0, 0, 0, 0.001),
child: GestureDetector(
onTap: () {},
child: DraggableScrollableSheet(
initialChildSize: 0.6,
minChildSize: 0.4,
maxChildSize: 0.9,
builder: (_, controller) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
),
child: buildModalBottomBody(context, title, body),
);
},
),
),
),
);
},
);
}
Widget buildModalBottomBody(BuildContext context, String title, Widget body) {
return Column(
children: [
// 拖拽指示条
Container(
margin: EdgeInsets.only(top: 12, bottom: 4),
width: 48,
height: 4,
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadius.circular(2),
),
),
// 标题栏
Padding(
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
title,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
),
],
),
),
Divider(height: 1, thickness: 1),
Expanded(child: Padding(padding: EdgeInsets.all(12), child: body)),
],
);
}