You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.3 KiB
Dart
87 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
|
|
void showMyBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc}) {
|
|
showModalBottomSheet<String>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
builder: (BuildContext context) {
|
|
return Container(
|
|
decoration: const BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topRight: Radius.circular(25),
|
|
topLeft: Radius.circular(25),
|
|
),
|
|
),
|
|
clipBehavior: Clip.antiAlias,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
13.height,
|
|
Container(
|
|
height: 6,
|
|
width: 60,
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xff9A9A9A),
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(20),
|
|
),
|
|
),
|
|
),
|
|
8.height,
|
|
child,
|
|
],
|
|
),
|
|
);
|
|
},
|
|
).then((value) {
|
|
// print("BACK FROM DELEGATE!!!!");
|
|
// print("value: $value");
|
|
if (value == "delegate_reload") {
|
|
callBackFunc();
|
|
}
|
|
});
|
|
}
|
|
|
|
class BottomSheetItem extends StatelessWidget {
|
|
final Function onTap;
|
|
final IconData icon;
|
|
final String title;
|
|
final Color color;
|
|
|
|
const BottomSheetItem({Key? key, required this.onTap, required this.title, required this.icon, this.color = Colors.black}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: () {
|
|
if (onTap != null) {
|
|
Navigator.pop(context);
|
|
onTap();
|
|
}
|
|
},
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0),
|
|
child: Row(
|
|
children: <Widget>[
|
|
if (icon != null)
|
|
Icon(
|
|
icon,
|
|
color: color,
|
|
size: 18.0,
|
|
),
|
|
if (icon != null) SizedBox(width: 24.0),
|
|
Text(
|
|
title ?? "",
|
|
style: TextStyle(color: color),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|