import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; class FloatingMenuButton extends StatelessWidget { const FloatingMenuButton({this.popupMenuButton, super.key}); final PopupMenuButton? popupMenuButton; @override Widget build(BuildContext context) { return PositionedDirectional( start: 16, top: 16, child: SafeArea( child: Container( decoration: BoxDecoration( color: Theme.of(context).colorScheme.background, borderRadius: BorderRadius.circular(999), boxShadow: [ BoxShadow( // check if dark mode color: (Theme.of(context).brightness == Brightness.light) ? Colors.grey.withOpacity(0.5) : Colors.black.withOpacity(0.5), spreadRadius: 1, blurRadius: 7, offset: const Offset(0, 3), ), ], ), padding: const EdgeInsets.all(8), child: Row( children: [ IconButton( onPressed: () => context.pop(), icon: const Icon(Icons.arrow_back), ), if (popupMenuButton != null) Row( children: [ const SizedBox(width: 8), popupMenuButton!, const SizedBox(width: 8), ], ) ], ), ), ), ); } }