BackdropScaffold 的 backLayerContent 和 content 可以通过修改 Container 的 transform 属性来控制缩放,并使用 FittedBox 来自动适应父容器的大小。
示例:
BackdropScaffold(
...
backLayerContent: Container(
transform: Matrix4.diagonal3Values(2.0, 2.0, 2.0), // 缩放背景图
child: Image.asset(
'assets/background.jpg',
fit: BoxFit.cover, // 保持图片比例并铺满
),
),
frontLayerContent: Container(
transform: Matrix4.diagonal3Values(0.5, 0.5, 0.5), // 缩小内容区域
child: FittedBox(
fit: BoxFit.contain, // 自适应父容器大小
child: Text('Hello World'),
),
),
);