Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rustdesk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李朝发
rustdesk
Commits
b93e59df
Commit
b93e59df
authored
Sep 08, 2022
by
csf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confirm connection tab close
parent
1c170366
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
12 deletions
+38
-12
connection_tab_page.dart
flutter/lib/desktop/pages/connection_tab_page.dart
+13
-1
file_manager_tab_page.dart
flutter/lib/desktop/pages/file_manager_tab_page.dart
+2
-2
port_forward_tab_page.dart
flutter/lib/desktop/pages/port_forward_tab_page.dart
+1
-2
tabbar_widget.dart
flutter/lib/desktop/widgets/tabbar_widget.dart
+22
-7
No files found.
flutter/lib/desktop/pages/connection_tab_page.dart
View file @
b93e59df
...
...
@@ -10,6 +10,8 @@ import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import
'package:flutter_hbb/utils/multi_window_manager.dart'
;
import
'package:get/get.dart'
;
import
'../../mobile/widgets/dialog.dart'
;
class
ConnectionTabPage
extends
StatefulWidget
{
final
Map
<
String
,
dynamic
>
params
;
...
...
@@ -37,6 +39,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
label:
peerId
,
selectedIcon:
selectedIcon
,
unselectedIcon:
unselectedIcon
,
onTabCloseButton:
()
{
debugPrint
(
"onTabCloseButton"
);
tabController
.
jumpBy
(
peerId
);
clientClose
(
ffi
(
peerId
).
dialogManager
);
},
page:
Obx
(()
=>
RemotePage
(
key:
ValueKey
(
peerId
),
id:
peerId
,
...
...
@@ -69,6 +76,11 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
label:
id
,
selectedIcon:
selectedIcon
,
unselectedIcon:
unselectedIcon
,
onTabCloseButton:
()
{
debugPrint
(
"onTabCloseButton"
);
tabController
.
jumpBy
(
id
);
clientClose
(
ffi
(
id
).
dialogManager
);
},
page:
Obx
(()
=>
RemotePage
(
key:
ValueKey
(
id
),
id:
id
,
...
...
@@ -95,7 +107,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
body:
Obx
(()
=>
DesktopTab
(
controller:
tabController
,
showTabBar:
fullscreen
.
isFalse
,
on
Close
:
()
{
on
WindowCloseButton
:
()
{
tabController
.
clear
();
},
tail:
AddButton
().
paddingOnly
(
left:
10
),
...
...
flutter/lib/desktop/pages/file_manager_tab_page.dart
View file @
b93e59df
...
...
@@ -71,10 +71,10 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
backgroundColor:
MyTheme
.
color
(
context
).
bg
,
body:
DesktopTab
(
controller:
tabController
,
on
Close
:
()
{
on
WindowCloseButton
:
()
{
tabController
.
clear
();
},
tail:
AddButton
().
paddingOnly
(
left:
10
),
tail:
const
AddButton
().
paddingOnly
(
left:
10
),
)),
),
);
...
...
flutter/lib/desktop/pages/port_forward_tab_page.dart
View file @
b93e59df
...
...
@@ -78,7 +78,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
backgroundColor:
MyTheme
.
color
(
context
).
bg
,
body:
DesktopTab
(
controller:
tabController
,
on
Close
:
()
{
on
WindowCloseButton
:
()
{
tabController
.
clear
();
},
tail:
AddButton
().
paddingOnly
(
left:
10
),
...
...
@@ -88,7 +88,6 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
}
void
onRemoveId
(
String
id
)
{
ffi
(
"pf_
$id
"
).
close
();
if
(
tabController
.
state
.
value
.
tabs
.
isEmpty
)
{
WindowController
.
fromWindowId
(
windowId
()).
hide
();
}
...
...
flutter/lib/desktop/widgets/tabbar_widget.dart
View file @
b93e59df
...
...
@@ -24,7 +24,8 @@ class TabInfo {
final
String
label
;
final
IconData
?
selectedIcon
;
final
IconData
?
unselectedIcon
;
final
bool
closable
;
final
bool
closable
;
//
final
VoidCallback
?
onTabCloseButton
;
final
Widget
page
;
TabInfo
(
...
...
@@ -33,6 +34,7 @@ class TabInfo {
this
.
selectedIcon
,
this
.
unselectedIcon
,
this
.
closable
=
true
,
this
.
onTabCloseButton
,
required
this
.
page
});
}
...
...
@@ -137,16 +139,23 @@ class DesktopTabController {
}
}
void
jumpBy
(
String
key
)
{
if
(!
isDesktop
)
return
;
final
index
=
state
.
value
.
tabs
.
indexWhere
((
tab
)
=>
tab
.
key
==
key
);
jumpTo
(
index
);
}
void
closeBy
(
String
?
key
)
{
if
(!
isDesktop
)
return
;
debugPrint
(
"closeBy:
$key
"
);
assert
(
onRemove
!=
null
);
if
(
key
==
null
)
{
if
(
state
.
value
.
selected
<
state
.
value
.
tabs
.
length
)
{
remove
(
state
.
value
.
selected
);
}
}
else
{
state
.
value
.
tabs
.
indexWhere
((
tab
)
=>
tab
.
key
==
key
);
remove
(
state
.
value
.
selected
);
final
index
=
state
.
value
.
tabs
.
indexWhere
((
tab
)
=>
tab
.
key
==
key
);
remove
(
index
);
}
}
...
...
@@ -175,7 +184,7 @@ class DesktopTab extends StatelessWidget {
final
bool
showClose
;
final
Widget
Function
(
Widget
pageView
)?
pageViewBuilder
;
final
Widget
?
tail
;
final
VoidCallback
?
on
Close
;
final
VoidCallback
?
on
WindowCloseButton
;
final
TabBuilder
?
tabBuilder
;
final
LabelGetter
?
labelGetter
;
...
...
@@ -196,7 +205,7 @@ class DesktopTab extends StatelessWidget {
this
.
showClose
=
true
,
this
.
pageViewBuilder
,
this
.
tail
,
this
.
on
Close
,
this
.
on
WindowCloseButton
,
this
.
tabBuilder
,
this
.
labelGetter
,
})
:
super
(
key:
key
)
{
...
...
@@ -333,7 +342,7 @@ class DesktopTab extends StatelessWidget {
showMinimize:
showMinimize
,
showMaximize:
showMaximize
,
showClose:
showClose
,
onClose:
on
Close
,
onClose:
on
WindowCloseButton
,
)
],
);
...
...
@@ -511,7 +520,13 @@ class _ListView extends StatelessWidget {
unselectedIcon:
tab
.
unselectedIcon
,
closable:
tab
.
closable
,
selected:
state
.
value
.
selected
,
onClose:
()
=>
controller
.
remove
(
index
),
onClose:
()
{
if
(
tab
.
onTabCloseButton
!=
null
)
{
tab
.
onTabCloseButton
!();
}
else
{
controller
.
remove
(
index
);
}
},
onSelected:
()
=>
controller
.
jumpTo
(
index
),
tabBuilder:
tabBuilder
==
null
?
null
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment