opt hide top/bottom bar

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-02-18 14:48:42 +08:00
parent a5efca4e1f
commit dfa258b9e6
13 changed files with 157 additions and 224 deletions

View File

@@ -0,0 +1,71 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show RenderProxyBox;
class CustomHeightWidget extends SingleChildRenderObjectWidget {
const CustomHeightWidget({
super.key,
required this.height,
this.offset = .zero,
required super.child,
});
final double height;
final Offset offset;
@override
RenderObject createRenderObject(BuildContext context) {
return RenderCustomHeightWidget(
height: height,
offset: offset,
);
}
@override
void updateRenderObject(
BuildContext context,
RenderCustomHeightWidget renderObject,
) {
renderObject
..height = height
..offset = offset;
}
}
class RenderCustomHeightWidget extends RenderProxyBox {
RenderCustomHeightWidget({
required double height,
required Offset offset,
}) : _height = height,
_offset = offset;
double _height;
double get height => _height;
set height(double value) {
if (_height == value) return;
_height = value;
markNeedsLayout();
}
Offset _offset;
Offset get offset => _offset;
set offset(Offset value) {
if (_offset == value) return;
_offset = value;
markNeedsPaint();
}
@override
void performLayout() {
child!.layout(constraints, parentUsesSize: true);
size = constraints.constrainDimensions(constraints.maxWidth, height);
}
@override
void paint(PaintingContext context, Offset offset) {
context.paintChild(child!, offset + _offset);
}
@override
bool get isRepaintBoundary => true;
}