mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-08-15 15:40:32 +02:00
Tablet thing fixed - tweaking needed
This commit is contained in:
@@ -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,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user