68 lines
1.9 KiB
Dart
68 lines
1.9 KiB
Dart
|
|
// lib/widgets/landscape_shell.dart
|
||
|
|
//
|
||
|
|
// Reusable two-panel landscape scaffold for all desktop/wide screens.
|
||
|
|
// Left panel uses the brand dark-blue gradient; right panel is the content area.
|
||
|
|
//
|
||
|
|
// Usage:
|
||
|
|
// LandscapeShell(
|
||
|
|
// leftPanel: MyLeftContent(),
|
||
|
|
// rightPanel: MyRightContent(),
|
||
|
|
// )
|
||
|
|
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import '../core/app_decoration.dart';
|
||
|
|
|
||
|
|
class LandscapeShell extends StatelessWidget {
|
||
|
|
final Widget leftPanel;
|
||
|
|
final Widget rightPanel;
|
||
|
|
|
||
|
|
/// Flex weight for left panel (default 2 → ~40% of width)
|
||
|
|
final int leftFlex;
|
||
|
|
|
||
|
|
/// Flex weight for right panel (default 3 → ~60% of width)
|
||
|
|
final int rightFlex;
|
||
|
|
|
||
|
|
/// Optional background color for right panel (defaults to scaffold background)
|
||
|
|
final Color? rightBackground;
|
||
|
|
|
||
|
|
const LandscapeShell({
|
||
|
|
Key? key,
|
||
|
|
required this.leftPanel,
|
||
|
|
required this.rightPanel,
|
||
|
|
this.leftFlex = 2,
|
||
|
|
this.rightFlex = 3,
|
||
|
|
this.rightBackground,
|
||
|
|
}) : super(key: key);
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final bg = rightBackground ?? Theme.of(context).scaffoldBackgroundColor;
|
||
|
|
return Row(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||
|
|
children: [
|
||
|
|
// ── Left panel — dark blue gradient ──────────────────────────────
|
||
|
|
Flexible(
|
||
|
|
flex: leftFlex,
|
||
|
|
child: RepaintBoundary(
|
||
|
|
child: Container(
|
||
|
|
decoration: AppDecoration.blueGradient,
|
||
|
|
child: leftPanel,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
|
||
|
|
// ── Right panel — content area ────────────────────────────────────
|
||
|
|
Flexible(
|
||
|
|
flex: rightFlex,
|
||
|
|
child: RepaintBoundary(
|
||
|
|
child: ColoredBox(
|
||
|
|
color: bg,
|
||
|
|
child: rightPanel,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|