feat: add elastic glass dock motion and Android tablet layouts
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// Fits the current window, retaining child state during split-screen resizing.
|
||||
class AdaptivePage extends StatelessWidget {
|
||||
const AdaptivePage({super.key, required this.child, this.maxWidth = 840});
|
||||
final Widget child;
|
||||
final double maxWidth;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = constraints.maxWidth;
|
||||
final contentWidth = width >= 600
|
||||
? math.min(maxWidth, width - 32)
|
||||
: width;
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SizedBox(
|
||||
width: contentWidth,
|
||||
height: constraints.maxHeight,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user