Skip to content

Commit

Permalink
Add hard edge clip behavior to Material link bottom sheet modal (#337)
Browse files Browse the repository at this point in the history
* Add hard edge clip behavior to Material link bottom sheet modal

* Use SafeArea
  • Loading branch information
amantoux authored May 3, 2024
1 parent 4f97476 commit cc3921c
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions packages/fleather/lib/src/widgets/link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class _CupertinoAction extends StatelessWidget {
final String title;
final IconData icon;
final VoidCallback onPressed;

const _CupertinoAction({
required this.title,
required this.icon,
Expand Down Expand Up @@ -109,27 +110,30 @@ class _CupertinoAction extends StatelessWidget {
Future<LinkMenuAction> _showMaterialMenu(
BuildContext context, String link) async {
final result = await showModalBottomSheet<LinkMenuAction>(
clipBehavior: Clip.hardEdge,
context: context,
builder: (ctx) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
_MaterialAction(
title: 'Open',
icon: Icons.language_sharp,
onPressed: () => Navigator.of(context).pop(LinkMenuAction.launch),
),
_MaterialAction(
title: 'Copy',
icon: Icons.copy_sharp,
onPressed: () => Navigator.of(context).pop(LinkMenuAction.copy),
),
_MaterialAction(
title: 'Remove',
icon: Icons.link_off_sharp,
onPressed: () => Navigator.of(context).pop(LinkMenuAction.remove),
),
],
return SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_MaterialAction(
title: 'Open',
icon: Icons.language_sharp,
onPressed: () => Navigator.of(context).pop(LinkMenuAction.launch),
),
_MaterialAction(
title: 'Copy',
icon: Icons.copy_sharp,
onPressed: () => Navigator.of(context).pop(LinkMenuAction.copy),
),
_MaterialAction(
title: 'Remove',
icon: Icons.link_off_sharp,
onPressed: () => Navigator.of(context).pop(LinkMenuAction.remove),
),
],
),
);
},
);
Expand Down

0 comments on commit cc3921c

Please sign in to comment.