opt: remove drag to resize widget on macOS
This commit is contained in:
parent
429d72c9c3
commit
ef80dab48e
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hbb/common.dart';
|
import 'package:flutter_hbb/common.dart';
|
||||||
import 'package:flutter_hbb/consts.dart';
|
import 'package:flutter_hbb/consts.dart';
|
||||||
@ -35,28 +37,30 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
RxBool fullscreen = false.obs;
|
RxBool fullscreen = false.obs;
|
||||||
Get.put(fullscreen, tag: 'fullscreen');
|
Get.put(fullscreen, tag: 'fullscreen');
|
||||||
return Obx(() => DragToResizeArea(
|
final tabWidget = Container(
|
||||||
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0,
|
decoration: BoxDecoration(
|
||||||
child: Container(
|
border: Border.all(color: MyTheme.color(context).border!)),
|
||||||
decoration: BoxDecoration(
|
child: Overlay(initialEntries: [
|
||||||
border: Border.all(color: MyTheme.color(context).border!)),
|
OverlayEntry(builder: (context) {
|
||||||
child: Overlay(initialEntries: [
|
gFFI.dialogManager.setOverlayState(Overlay.of(context));
|
||||||
OverlayEntry(builder: (context) {
|
return Scaffold(
|
||||||
gFFI.dialogManager.setOverlayState(Overlay.of(context));
|
backgroundColor: MyTheme.color(context).bg,
|
||||||
return Scaffold(
|
body: DesktopTab(
|
||||||
backgroundColor: MyTheme.color(context).bg,
|
controller: tabController,
|
||||||
body: DesktopTab(
|
tail: ActionIcon(
|
||||||
controller: tabController,
|
message: 'Settings',
|
||||||
tail: ActionIcon(
|
icon: IconFont.menu,
|
||||||
message: 'Settings',
|
onTap: onAddSetting,
|
||||||
icon: IconFont.menu,
|
isClose: false,
|
||||||
onTap: onAddSetting,
|
),
|
||||||
isClose: false,
|
));
|
||||||
),
|
})
|
||||||
));
|
]),
|
||||||
})
|
);
|
||||||
]),
|
return Obx(() => Platform.isMacOS
|
||||||
)));
|
? tabWidget
|
||||||
|
: DragToResizeArea(
|
||||||
|
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0, child: tabWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onAddSetting() {
|
void onAddSetting() {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -66,20 +67,23 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SubWindowDragToResizeArea(
|
final tabWidget = Container(
|
||||||
windowId: windowId(),
|
decoration: BoxDecoration(
|
||||||
child: Container(
|
border: Border.all(color: MyTheme.color(context).border!)),
|
||||||
decoration: BoxDecoration(
|
child: Scaffold(
|
||||||
border: Border.all(color: MyTheme.color(context).border!)),
|
backgroundColor: MyTheme.color(context).bg,
|
||||||
child: Scaffold(
|
body: DesktopTab(
|
||||||
backgroundColor: MyTheme.color(context).bg,
|
controller: tabController,
|
||||||
body: DesktopTab(
|
onWindowCloseButton: handleWindowCloseButton,
|
||||||
controller: tabController,
|
tail: const AddButton().paddingOnly(left: 10),
|
||||||
onWindowCloseButton: handleWindowCloseButton,
|
)),
|
||||||
tail: const AddButton().paddingOnly(left: 10),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
return Platform.isMacOS
|
||||||
|
? tabWidget
|
||||||
|
: SubWindowDragToResizeArea(
|
||||||
|
windowId: windowId(),
|
||||||
|
child: tabWidget,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onRemoveId(String id) {
|
void onRemoveId(String id) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -74,23 +75,26 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SubWindowDragToResizeArea(
|
final tabWidget = Container(
|
||||||
windowId: windowId(),
|
decoration: BoxDecoration(
|
||||||
child: Container(
|
border: Border.all(color: MyTheme.color(context).border!)),
|
||||||
decoration: BoxDecoration(
|
child: Scaffold(
|
||||||
border: Border.all(color: MyTheme.color(context).border!)),
|
backgroundColor: MyTheme.color(context).bg,
|
||||||
child: Scaffold(
|
body: DesktopTab(
|
||||||
backgroundColor: MyTheme.color(context).bg,
|
controller: tabController,
|
||||||
body: DesktopTab(
|
onWindowCloseButton: () async {
|
||||||
controller: tabController,
|
tabController.clear();
|
||||||
onWindowCloseButton: () async {
|
return true;
|
||||||
tabController.clear();
|
},
|
||||||
return true;
|
tail: AddButton().paddingOnly(left: 10),
|
||||||
},
|
)),
|
||||||
tail: AddButton().paddingOnly(left: 10),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
return Platform.isMacOS
|
||||||
|
? tabWidget
|
||||||
|
: SubWindowDragToResizeArea(
|
||||||
|
windowId: windowId(),
|
||||||
|
child: tabWidget,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onRemoveId(String id) {
|
void onRemoveId(String id) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -86,63 +87,65 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final RxBool fullscreen = Get.find(tag: 'fullscreen');
|
final RxBool fullscreen = Get.find(tag: 'fullscreen');
|
||||||
return Obx(() => SubWindowDragToResizeArea(
|
final tabWidget = Container(
|
||||||
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0,
|
decoration: BoxDecoration(
|
||||||
windowId: windowId(),
|
border: Border.all(color: MyTheme.color(context).border!)),
|
||||||
child: Container(
|
child: Scaffold(
|
||||||
decoration: BoxDecoration(
|
backgroundColor: MyTheme.color(context).bg,
|
||||||
border: Border.all(color: MyTheme.color(context).border!)),
|
body: DesktopTab(
|
||||||
child: Scaffold(
|
controller: tabController,
|
||||||
backgroundColor: MyTheme.color(context).bg,
|
showTabBar: fullscreen.isFalse,
|
||||||
body: DesktopTab(
|
onWindowCloseButton: handleWindowCloseButton,
|
||||||
controller: tabController,
|
tail: const AddButton().paddingOnly(left: 10),
|
||||||
showTabBar: fullscreen.isFalse,
|
pageViewBuilder: (pageView) {
|
||||||
onWindowCloseButton: handleWindowCloseButton,
|
WindowController.fromWindowId(windowId())
|
||||||
tail: const AddButton().paddingOnly(left: 10),
|
.setFullscreen(fullscreen.isTrue);
|
||||||
pageViewBuilder: (pageView) {
|
return pageView;
|
||||||
WindowController.fromWindowId(windowId())
|
},
|
||||||
.setFullscreen(fullscreen.isTrue);
|
tabBuilder: (key, icon, label, themeConf) => Obx(() {
|
||||||
return pageView;
|
final connectionType = ConnectionTypeState.find(key);
|
||||||
},
|
if (!connectionType.isValid()) {
|
||||||
tabBuilder: (key, icon, label, themeConf) => Obx(() {
|
return Row(
|
||||||
final connectionType = ConnectionTypeState.find(key);
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
if (!connectionType.isValid()) {
|
children: [
|
||||||
return Row(
|
icon,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
label,
|
||||||
children: [
|
],
|
||||||
icon,
|
);
|
||||||
label,
|
} else {
|
||||||
],
|
final msgDirect = translate(
|
||||||
);
|
connectionType.direct.value == ConnectionType.strDirect
|
||||||
} else {
|
? 'Direct Connection'
|
||||||
final msgDirect = translate(connectionType.direct.value ==
|
: 'Relay Connection');
|
||||||
ConnectionType.strDirect
|
final msgSecure = translate(
|
||||||
? 'Direct Connection'
|
connectionType.secure.value == ConnectionType.strSecure
|
||||||
: 'Relay Connection');
|
? 'Secure Connection'
|
||||||
final msgSecure = translate(connectionType.secure.value ==
|
: 'Insecure Connection');
|
||||||
ConnectionType.strSecure
|
return Row(
|
||||||
? 'Secure Connection'
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
: 'Insecure Connection');
|
children: [
|
||||||
return Row(
|
icon,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Tooltip(
|
||||||
children: [
|
message: '$msgDirect\n$msgSecure',
|
||||||
icon,
|
child: Image.asset(
|
||||||
Tooltip(
|
'assets/${connectionType.secure.value}${connectionType.direct.value}.png',
|
||||||
message: '$msgDirect\n$msgSecure',
|
width: themeConf.iconSize,
|
||||||
child: Image.asset(
|
height: themeConf.iconSize,
|
||||||
'assets/${connectionType.secure.value}${connectionType.direct.value}.png',
|
).paddingOnly(right: 5),
|
||||||
width: themeConf.iconSize,
|
),
|
||||||
height: themeConf.iconSize,
|
label,
|
||||||
).paddingOnly(right: 5),
|
],
|
||||||
),
|
);
|
||||||
label,
|
}
|
||||||
],
|
}),
|
||||||
);
|
)),
|
||||||
}
|
);
|
||||||
}),
|
return Obx(() => Platform.isMacOS
|
||||||
)),
|
? tabWidget
|
||||||
),
|
: SubWindowDragToResizeArea(
|
||||||
));
|
resizeEdgeSize: fullscreen.value ? 1.0 : 8.0,
|
||||||
|
windowId: windowId(),
|
||||||
|
child: tabWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onRemoveId(String id) {
|
void onRemoveId(String id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user