fix full screen

This commit is contained in:
csf 2022-08-24 21:20:50 +08:00
parent 4f4ac67228
commit 67b40b2cc7
2 changed files with 32 additions and 22 deletions

View File

@ -94,14 +94,20 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
border: Border.all(color: MyTheme.color(context).border!)), border: Border.all(color: MyTheme.color(context).border!)),
child: Scaffold( child: Scaffold(
backgroundColor: MyTheme.color(context).bg, backgroundColor: MyTheme.color(context).bg,
body: DesktopTab( body: Obx(() => DesktopTab(
controller: tabController, controller: tabController,
theme: theme, theme: theme,
isMainWindow: false, isMainWindow: false,
tail: AddButton( showTabBar: _fullscreenID.value.isEmpty,
theme: theme, tail: AddButton(
).paddingOnly(left: 10), theme: theme,
)), ).paddingOnly(left: 10),
pageViewBuilder: (pageView) {
WindowController.fromWindowId(windowId())
.setFullscreen(_fullscreenID.value.isNotEmpty);
return pageView;
},
))),
), ),
); );
} }

View File

@ -118,6 +118,7 @@ class DesktopTab extends StatelessWidget {
final Function(String)? onTabClose; final Function(String)? onTabClose;
final TarBarTheme theme; final TarBarTheme theme;
final bool isMainWindow; final bool isMainWindow;
final bool showTabBar;
final bool showLogo; final bool showLogo;
final bool showTitle; final bool showTitle;
final bool showMinimize; final bool showMinimize;
@ -134,6 +135,7 @@ class DesktopTab extends StatelessWidget {
required this.isMainWindow, required this.isMainWindow,
this.theme = const TarBarTheme.light(), this.theme = const TarBarTheme.light(),
this.onTabClose, this.onTabClose,
this.showTabBar = true,
this.showLogo = true, this.showLogo = true,
this.showTitle = true, this.showTitle = true,
this.showMinimize = true, this.showMinimize = true,
@ -145,21 +147,23 @@ class DesktopTab extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column(children: [ return Column(children: [
Container( Offstage(
height: _kTabBarHeight, offstage: !showTabBar,
child: Column( child: Container(
children: [ height: _kTabBarHeight,
Container( child: Column(
height: _kTabBarHeight - 1, children: [
child: _buildBar(), Container(
height: _kTabBarHeight - 1,
child: _buildBar(),
),
Divider(
height: 1,
thickness: 1,
),
],
), ),
Divider( )),
height: 1,
thickness: 1,
),
],
),
),
Expanded( Expanded(
child: pageViewBuilder != null child: pageViewBuilder != null
? pageViewBuilder!(_buildPageView()) ? pageViewBuilder!(_buildPageView())