Tablet thing fixed - tweaking needed

This commit is contained in:
stopflock
2025-10-01 11:52:46 -05:00
parent 7ff9273f47
commit 583499ccd1
3 changed files with 73 additions and 95 deletions
+49
View File
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
/// A wrapper that shifts a map's visual positioning to account for bottom sheets.
///
/// When a sheet is open, moves the map upward by the sheet height while extending
/// the map rendering area to fill the screen. This keeps the bottom edge visible
/// while shifting the visual center up so pins appear above the sheet.
class SheetAwareMap extends StatelessWidget {
const SheetAwareMap({
super.key,
required this.child,
this.sheetHeight = 0.0,
this.animationDuration = const Duration(milliseconds: 300),
});
/// The map widget to position
final Widget child;
/// Current height of the bottom sheet
final double sheetHeight;
/// Duration for smooth transitions when sheet height changes
final Duration animationDuration;
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
return LayoutBuilder(
builder: (context, constraints) {
return Stack(
children: [
AnimatedPositioned(
duration: animationDuration,
curve: Curves.easeOut,
// Move the map up by the sheet height
top: -sheetHeight,
left: 0,
right: 0,
// Extend the height to compensate and fill screen
height: screenHeight + sheetHeight,
child: child,
),
],
);
},
);
}
}