feat:更新闪灵弹窗模块
This commit is contained in:
@@ -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)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user