mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
opt hide top/bottom bar
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
71
lib/common/widgets/custom_height_widget.dart
Normal file
71
lib/common/widgets/custom_height_widget.dart
Normal 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;
|
||||
}
|
||||
@@ -1653,7 +1653,7 @@ class _VerticalTabBarState extends State<VerticalTabBar> {
|
||||
tabCenter +
|
||||
paddingTop -
|
||||
viewportWidth / 2.0 +
|
||||
(_mainCtr.useBottomNav && (_mainCtr.showBottomBar?.value ?? true)
|
||||
(_mainCtr.useBottomNav && (_mainCtr.barOffset?.value ?? 0) == 0
|
||||
? 80.0
|
||||
: 0.0),
|
||||
minExtent,
|
||||
|
||||
Reference in New Issue
Block a user