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
4f6c6ab4
Unverified
Commit
4f6c6ab4
authored
Sep 22, 2022
by
RustDesk
Committed by
GitHub
Sep 22, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1600 from Heap-Hop/master
Update flutter
parents
78efa663
51b02353
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
198 additions
and
179 deletions
+198
-179
common.dart
flutter/lib/common.dart
+32
-6
address_book.dart
flutter/lib/common/widgets/address_book.dart
+13
-7
peer_card.dart
flutter/lib/common/widgets/peer_card.dart
+21
-30
peer_tab_page.dart
flutter/lib/common/widgets/peer_tab_page.dart
+3
-3
peers_view.dart
flutter/lib/common/widgets/peers_view.dart
+28
-28
connection_page.dart
flutter/lib/desktop/pages/connection_page.dart
+4
-4
desktop_home_page.dart
flutter/lib/desktop/pages/desktop_home_page.dart
+4
-3
desktop_setting_page.dart
flutter/lib/desktop/pages/desktop_setting_page.dart
+16
-14
connection_page.dart
flutter/lib/mobile/pages/connection_page.dart
+5
-38
settings_page.dart
flutter/lib/mobile/pages/settings_page.dart
+40
-18
dialog.dart
flutter/lib/mobile/widgets/dialog.dart
+11
-7
cn.rs
src/lang/cn.rs
+1
-1
cs.rs
src/lang/cs.rs
+1
-1
da.rs
src/lang/da.rs
+1
-1
de.rs
src/lang/de.rs
+1
-1
eo.rs
src/lang/eo.rs
+1
-1
es.rs
src/lang/es.rs
+1
-1
fr.rs
src/lang/fr.rs
+1
-1
hu.rs
src/lang/hu.rs
+1
-1
id.rs
src/lang/id.rs
+1
-1
it.rs
src/lang/it.rs
+1
-1
ja.rs
src/lang/ja.rs
+1
-1
ko.rs
src/lang/ko.rs
+1
-1
pl.rs
src/lang/pl.rs
+1
-1
pt_PT.rs
src/lang/pt_PT.rs
+1
-1
ptbr.rs
src/lang/ptbr.rs
+1
-1
ru.rs
src/lang/ru.rs
+1
-1
sk.rs
src/lang/sk.rs
+1
-1
template.rs
src/lang/template.rs
+1
-1
tr.rs
src/lang/tr.rs
+1
-1
tw.rs
src/lang/tw.rs
+1
-1
vn.rs
src/lang/vn.rs
+1
-1
No files found.
flutter/lib/common.dart
View file @
4f6c6ab4
...
...
@@ -17,6 +17,8 @@ import 'package:shared_preferences/shared_preferences.dart';
import
'package:window_manager/window_manager.dart'
;
import
'common/widgets/overlay.dart'
;
import
'mobile/pages/file_manager_page.dart'
;
import
'mobile/pages/remote_page.dart'
;
import
'models/model.dart'
;
import
'models/platform_model.dart'
;
...
...
@@ -1071,14 +1073,38 @@ void connect(BuildContext context, String id,
assert
(!(
isFileTransfer
&&
isTcpTunneling
&&
isRDP
),
"more than one connect type"
);
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(
isFileTransfer
)
{
await
rustDeskWinManager
.
newFileTransfer
(
id
);
}
else
if
(
isTcpTunneling
||
isRDP
)
{
await
rustDeskWinManager
.
newPortForward
(
id
,
isRDP
);
if
(
isDesktop
)
{
if
(
isFileTransfer
)
{
await
rustDeskWinManager
.
newFileTransfer
(
id
);
}
else
if
(
isTcpTunneling
||
isRDP
)
{
await
rustDeskWinManager
.
newPortForward
(
id
,
isRDP
);
}
else
{
await
rustDeskWinManager
.
newRemoteDesktop
(
id
);
}
}
else
{
await
rustDeskWinManager
.
newRemoteDesktop
(
id
);
if
(
isFileTransfer
)
{
if
(!
await
PermissionManager
.
check
(
"file"
))
{
if
(!
await
PermissionManager
.
request
(
"file"
))
{
return
;
}
}
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
FileManagerPage
(
id:
id
),
),
);
}
else
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
RemotePage
(
id:
id
),
),
);
}
}
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
...
...
flutter/lib/common/widgets/address_book.dart
View file @
4f6c6ab4
import
'package:contextmenu/contextmenu.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_hbb/common/widgets/peer
_widget
.dart'
;
import
'package:flutter_hbb/common/widgets/peer
s_view
.dart'
;
import
'package:flutter_hbb/models/ab_model.dart'
;
import
'package:get/get.dart'
;
import
'package:provider/provider.dart'
;
import
'../../common.dart'
;
import
'../../desktop/pages/desktop_home_page.dart'
;
import
'../../mobile/pages/settings_page.dart'
;
import
'../../models/platform_model.dart'
;
class
AddressBook
extends
StatefulWidget
{
...
...
@@ -37,11 +38,16 @@ class _AddressBookState extends State<AddressBook> {
});
handleLogin
()
{
loginDialog
().
then
((
success
)
{
if
(
success
)
{
setState
(()
{});
}
});
// TODO refactor login dialog for desktop and mobile
if
(
isDesktop
)
{
loginDialog
().
then
((
success
)
{
if
(
success
)
{
setState
(()
{});
}
});
}
else
{
showLogin
(
gFFI
.
dialogManager
);
}
}
Future
<
Widget
>
buildAddressBook
(
BuildContext
context
)
async
{
...
...
@@ -174,7 +180,7 @@ class _AddressBookState extends State<AddressBook> {
Expanded
(
child:
Align
(
alignment:
Alignment
.
topLeft
,
child:
AddressBookPeer
Widget
()),
child:
AddressBookPeer
sView
()),
)
],
));
...
...
flutter/lib/common/widgets/peer
card_widget
.dart
→
flutter/lib/common/widgets/peer
_card
.dart
View file @
4f6c6ab4
...
...
@@ -77,8 +77,11 @@ class _PeerCardState extends State<_PeerCard>
subtitle:
Text
(
'
${peer.username}
@
${peer.hostname}
'
),
title:
Text
(
peer
.
alias
.
isEmpty
?
formatID
(
peer
.
id
)
:
peer
.
alias
),
leading:
Container
(
decoration:
BoxDecoration
(
color:
str2color
(
'
${peer.id}${peer.platform}
'
,
0x7f
),
borderRadius:
BorderRadius
.
circular
(
4
),
),
padding:
const
EdgeInsets
.
all
(
6
),
color:
str2color
(
'
${peer.id}${peer.platform}
'
,
0x7f
),
child:
getPlatformImage
(
peer
.
platform
)),
trailing:
InkWell
(
child:
const
Padding
(
...
...
@@ -458,7 +461,7 @@ abstract class BasePeerCard extends StatelessWidget {
}
await
bind
.
mainSetPeerOption
(
id:
id
,
key:
option
,
value:
value
);
},
dismissOnClicked:
tru
e
,
dismissOnClicked:
fals
e
,
);
}
...
...
@@ -489,7 +492,6 @@ abstract class BasePeerCard extends StatelessWidget {
await
bind
.
mainRemovePeer
(
id:
id
);
removePreference
(
id
);
await
reloadFunc
();
// Get.forceAppUpdate(); // TODO use inner model / state
}();
},
dismissOnClicked:
true
,
...
...
@@ -544,7 +546,6 @@ abstract class BasePeerCard extends StatelessWidget {
if
(
favs
.
remove
(
id
))
{
await
bind
.
mainStoreFav
(
favs:
favs
);
await
reloadFunc
();
// Get.forceAppUpdate(); // TODO use inner model / state
}
}();
},
...
...
@@ -589,8 +590,6 @@ abstract class BasePeerCard extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
,
vertical:
8.0
),
child:
Form
(
child:
TextFormField
(
controller:
controller
,
...
...
@@ -625,15 +624,13 @@ class RecentPeerCard extends BasePeerCard {
final
List
<
MenuEntryBase
<
String
>>
menuItems
=
[
_connectAction
(
context
,
peer
),
_transferFileAction
(
context
,
peer
.
id
),
_tcpTunnelingAction
(
context
,
peer
.
id
),
];
MenuEntryBase
<
String
>?
rdpAction
;
if
(
peer
.
platform
==
'Windows'
)
{
rdpAction
=
_rdpAction
(
context
,
peer
.
id
);
if
(
isDesktop
)
{
menuItems
.
add
(
_tcpTunnelingAction
(
context
,
peer
.
id
));
}
menuItems
.
add
(
await
_forceAlwaysRelayAction
(
peer
.
id
));
if
(
rdpAction
!=
null
)
{
menuItems
.
add
(
rdpAction
);
if
(
peer
.
platform
==
'Windows'
)
{
menuItems
.
add
(
_rdpAction
(
context
,
peer
.
id
)
);
}
menuItems
.
add
(
_wolAction
(
peer
.
id
));
menuItems
.
add
(
MenuEntryDivider
());
...
...
@@ -657,15 +654,13 @@ class FavoritePeerCard extends BasePeerCard {
final
List
<
MenuEntryBase
<
String
>>
menuItems
=
[
_connectAction
(
context
,
peer
),
_transferFileAction
(
context
,
peer
.
id
),
_tcpTunnelingAction
(
context
,
peer
.
id
),
];
MenuEntryBase
<
String
>?
rdpAction
;
if
(
peer
.
platform
==
'Windows'
)
{
rdpAction
=
_rdpAction
(
context
,
peer
.
id
);
if
(
isDesktop
)
{
menuItems
.
add
(
_tcpTunnelingAction
(
context
,
peer
.
id
));
}
menuItems
.
add
(
await
_forceAlwaysRelayAction
(
peer
.
id
));
if
(
rdpAction
!=
null
)
{
menuItems
.
add
(
rdpAction
);
if
(
peer
.
platform
==
'Windows'
)
{
menuItems
.
add
(
_rdpAction
(
context
,
peer
.
id
)
);
}
menuItems
.
add
(
_wolAction
(
peer
.
id
));
menuItems
.
add
(
MenuEntryDivider
());
...
...
@@ -691,15 +686,13 @@ class DiscoveredPeerCard extends BasePeerCard {
final
List
<
MenuEntryBase
<
String
>>
menuItems
=
[
_connectAction
(
context
,
peer
),
_transferFileAction
(
context
,
peer
.
id
),
_tcpTunnelingAction
(
context
,
peer
.
id
),
];
MenuEntryBase
<
String
>?
rdpAction
;
if
(
peer
.
platform
==
'Windows'
)
{
rdpAction
=
_rdpAction
(
context
,
peer
.
id
);
if
(
isDesktop
)
{
menuItems
.
add
(
_tcpTunnelingAction
(
context
,
peer
.
id
));
}
menuItems
.
add
(
await
_forceAlwaysRelayAction
(
peer
.
id
));
if
(
rdpAction
!=
null
)
{
menuItems
.
add
(
rdpAction
);
if
(
peer
.
platform
==
'Windows'
)
{
menuItems
.
add
(
_rdpAction
(
context
,
peer
.
id
)
);
}
menuItems
.
add
(
_wolAction
(
peer
.
id
));
menuItems
.
add
(
MenuEntryDivider
());
...
...
@@ -722,15 +715,13 @@ class AddressBookPeerCard extends BasePeerCard {
final
List
<
MenuEntryBase
<
String
>>
menuItems
=
[
_connectAction
(
context
,
peer
),
_transferFileAction
(
context
,
peer
.
id
),
_tcpTunnelingAction
(
context
,
peer
.
id
),
];
MenuEntryBase
<
String
>?
rdpAction
;
if
(
peer
.
platform
==
'Windows'
)
{
rdpAction
=
_rdpAction
(
context
,
peer
.
id
);
if
(
isDesktop
)
{
menuItems
.
add
(
_tcpTunnelingAction
(
context
,
peer
.
id
));
}
menuItems
.
add
(
await
_forceAlwaysRelayAction
(
peer
.
id
));
if
(
rdpAction
!=
null
)
{
menuItems
.
add
(
rdpAction
);
if
(
peer
.
platform
==
'Windows'
)
{
menuItems
.
add
(
_rdpAction
(
context
,
peer
.
id
)
);
}
menuItems
.
add
(
_wolAction
(
peer
.
id
));
menuItems
.
add
(
MenuEntryDivider
());
...
...
flutter/lib/common/widgets/peer_tab_page.dart
View file @
4f6c6ab4
import
'package:flutter/material.dart'
;
import
'package:flutter_hbb/common/widgets/peer
_widget
.dart'
;
import
'package:flutter_hbb/common/widgets/peer
card_widget
.dart'
;
import
'package:flutter_hbb/common/widgets/peer
s_view
.dart'
;
import
'package:flutter_hbb/common/widgets/peer
_card
.dart'
;
import
'package:flutter_hbb/consts.dart'
;
import
'package:get/get.dart'
;
...
...
@@ -113,7 +113,7 @@ class _PeerTabPageState extends State<PeerTabPage>
color:
_tabIndex
.
value
==
t
.
key
?
MyTheme
.
color
(
context
).
bg
:
null
,
borderRadius:
BorderRadius
.
circular
(
2
),
borderRadius:
BorderRadius
.
circular
(
isDesktop
?
2
:
6
),
),
child:
Align
(
alignment:
Alignment
.
center
,
...
...
flutter/lib/common/widgets/peer
_widget
.dart
→
flutter/lib/common/widgets/peer
s_view
.dart
View file @
4f6c6ab4
...
...
@@ -11,34 +11,34 @@ import 'package:window_manager/window_manager.dart';
import
'../../common.dart'
;
import
'../../models/peer_model.dart'
;
import
'../../models/platform_model.dart'
;
import
'peer
card_widget
.dart'
;
import
'peer
_card
.dart'
;
typedef
OffstageFunc
=
bool
Function
(
Peer
peer
);
typedef
PeerCard
WidgetFunc
=
Widget
Function
(
Peer
peer
);
typedef
PeerCard
Builder
=
BasePeerCard
Function
(
Peer
peer
);
/// for peer search text, global obs value
final
peerSearchText
=
""
.
obs
;
final
peerSearchTextController
=
TextEditingController
(
text:
peerSearchText
.
value
);
class
_Peer
Widget
extends
StatefulWidget
{
class
_Peer
sView
extends
StatefulWidget
{
final
Peers
peers
;
final
OffstageFunc
offstageFunc
;
final
PeerCard
WidgetFunc
peerCardWidgetFunc
;
final
PeerCard
Builder
peerCardBuilder
;
const
_Peer
Widget
(
const
_Peer
sView
(
{
required
this
.
peers
,
required
this
.
offstageFunc
,
required
this
.
peerCard
WidgetFunc
,
required
this
.
peerCard
Builder
,
Key
?
key
})
:
super
(
key:
key
);
@override
_Peer
WidgetState
createState
()
=>
_PeerWidget
State
();
_Peer
sViewState
createState
()
=>
_PeersView
State
();
}
/// State for the peer widget.
class
_Peer
WidgetState
extends
State
<
_PeerWidget
>
with
WindowListener
{
class
_Peer
sViewState
extends
State
<
_PeersView
>
with
WindowListener
{
static
const
int
_maxQueryCount
=
3
;
final
space
=
isDesktop
?
12.0
:
8.0
;
final
_curPeers
=
<
String
>{};
...
...
@@ -60,7 +60,7 @@ class _PeerWidgetState extends State<_PeerWidget> with WindowListener {
return
width
;
}();
_Peer
Widget
State
()
{
_Peer
sView
State
()
{
_startCheckOnlines
();
}
...
...
@@ -119,7 +119,7 @@ class _PeerWidgetState extends State<_PeerWidget> with WindowListener {
}
_lastChangeTime
=
DateTime
.
now
();
},
child:
widget
.
peerCard
WidgetFunc
(
peer
),
child:
widget
.
peerCard
Builder
(
peer
),
);
cards
.
add
(
Offstage
(
key:
ValueKey
(
"off
${peer.id}
"
),
...
...
@@ -198,39 +198,39 @@ class _PeerWidgetState extends State<_PeerWidget> with WindowListener {
}
}
abstract
class
BasePeer
Widget
extends
StatelessWidget
{
abstract
class
BasePeer
sView
extends
StatelessWidget
{
final
String
name
;
final
String
loadEvent
;
final
OffstageFunc
offstageFunc
;
final
PeerCard
WidgetFunc
peerCardWidgetFunc
;
final
PeerCard
Builder
peerCardBuilder
;
final
List
<
Peer
>
initPeers
;
const
BasePeer
Widget
({
const
BasePeer
sView
({
Key
?
key
,
required
this
.
name
,
required
this
.
loadEvent
,
required
this
.
offstageFunc
,
required
this
.
peerCard
WidgetFunc
,
required
this
.
peerCard
Builder
,
required
this
.
initPeers
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
_Peer
Widget
(
return
_Peer
sView
(
peers:
Peers
(
name:
name
,
loadEvent:
loadEvent
,
peers:
initPeers
),
offstageFunc:
offstageFunc
,
peerCard
WidgetFunc:
peerCardWidgetFunc
);
peerCard
Builder:
peerCardBuilder
);
}
}
class
RecentPeer
Widget
extends
BasePeerWidget
{
RecentPeer
Widget
({
Key
?
key
})
class
RecentPeer
sView
extends
BasePeersView
{
RecentPeer
sView
({
Key
?
key
})
:
super
(
key:
key
,
name:
'recent peer'
,
loadEvent:
'load_recent_peers'
,
offstageFunc:
(
Peer
peer
)
=>
false
,
peerCard
WidgetFunc
:
(
Peer
peer
)
=>
RecentPeerCard
(
peerCard
Builder
:
(
Peer
peer
)
=>
RecentPeerCard
(
peer:
peer
,
),
initPeers:
[],
...
...
@@ -244,14 +244,14 @@ class RecentPeerWidget extends BasePeerWidget {
}
}
class
FavoritePeer
Widget
extends
BasePeerWidget
{
FavoritePeer
Widget
({
Key
?
key
})
class
FavoritePeer
sView
extends
BasePeersView
{
FavoritePeer
sView
({
Key
?
key
})
:
super
(
key:
key
,
name:
'favorite peer'
,
loadEvent:
'load_fav_peers'
,
offstageFunc:
(
Peer
peer
)
=>
false
,
peerCard
WidgetFunc
:
(
Peer
peer
)
=>
FavoritePeerCard
(
peerCard
Builder
:
(
Peer
peer
)
=>
FavoritePeerCard
(
peer:
peer
,
),
initPeers:
[],
...
...
@@ -265,14 +265,14 @@ class FavoritePeerWidget extends BasePeerWidget {
}
}
class
DiscoveredPeer
Widget
extends
BasePeerWidget
{
DiscoveredPeer
Widget
({
Key
?
key
})
class
DiscoveredPeer
sView
extends
BasePeersView
{
DiscoveredPeer
sView
({
Key
?
key
})
:
super
(
key:
key
,
name:
'discovered peer'
,
loadEvent:
'load_lan_peers'
,
offstageFunc:
(
Peer
peer
)
=>
false
,
peerCard
WidgetFunc
:
(
Peer
peer
)
=>
DiscoveredPeerCard
(
peerCard
Builder
:
(
Peer
peer
)
=>
DiscoveredPeerCard
(
peer:
peer
,
),
initPeers:
[],
...
...
@@ -286,15 +286,15 @@ class DiscoveredPeerWidget extends BasePeerWidget {
}
}
class
AddressBookPeer
Widget
extends
BasePeerWidget
{
AddressBookPeer
Widget
({
Key
?
key
})
class
AddressBookPeer
sView
extends
BasePeersView
{
AddressBookPeer
sView
({
Key
?
key
})
:
super
(
key:
key
,
name:
'address book peer'
,
loadEvent:
'load_address_book_peers'
,
offstageFunc:
(
Peer
peer
)
=>
!
_hitTag
(
gFFI
.
abModel
.
selectedTags
,
peer
.
tags
),
peerCard
WidgetFunc
:
(
Peer
peer
)
=>
AddressBookPeerCard
(
peerCard
Builder
:
(
Peer
peer
)
=>
AddressBookPeerCard
(
peer:
peer
,
),
initPeers:
_loadPeers
(),
...
...
flutter/lib/desktop/pages/connection_page.dart
View file @
4f6c6ab4
...
...
@@ -11,7 +11,7 @@ import 'package:url_launcher/url_launcher_string.dart';
import
'../../common.dart'
;
import
'../../common/formatter/id_formatter.dart'
;
import
'../../common/widgets/peer_tab_page.dart'
;
import
'../../common/widgets/peer
_widget
.dart'
;
import
'../../common/widgets/peer
s_view
.dart'
;
import
'../../models/platform_model.dart'
;
/// Connection page for connecting to a remote peer.
...
...
@@ -74,9 +74,9 @@ class _ConnectionPageState extends State<ConnectionPage> {
translate
(
'Address Book'
)
],
children:
[
RecentPeer
Widget
(),
FavoritePeer
Widget
(),
DiscoveredPeer
Widget
(),
RecentPeer
sView
(),
FavoritePeer
sView
(),
DiscoveredPeer
sView
(),
const
AddressBook
(),
],
)),
...
...
flutter/lib/desktop/pages/desktop_home_page.dart
View file @
4f6c6ab4
...
...
@@ -331,7 +331,7 @@ Future<bool> loginDialog() async {
var
userNameMsg
=
""
;
String
pass
=
""
;
var
passMsg
=
""
;
var
userCont
ont
roller
=
TextEditingController
(
text:
userName
);
var
userController
=
TextEditingController
(
text:
userName
);
var
pwdController
=
TextEditingController
(
text:
pass
);
var
isInProgress
=
false
;
...
...
@@ -349,7 +349,7 @@ Future<bool> loginDialog() async {
});
}
userName
=
userCont
ont
roller
.
text
;
userName
=
userController
.
text
;
pass
=
pwdController
.
text
;
if
(
userName
.
isEmpty
)
{
userNameMsg
=
translate
(
"Username missed"
);
...
...
@@ -385,6 +385,7 @@ Future<bool> loginDialog() async {
close
();
}
// 登录dialog
return
CustomAlertDialog
(
title:
Text
(
translate
(
"Login"
)),
content:
ConstrainedBox
(
...
...
@@ -411,7 +412,7 @@ Future<bool> loginDialog() async {
decoration:
InputDecoration
(
border:
const
OutlineInputBorder
(),
errorText:
userNameMsg
.
isNotEmpty
?
userNameMsg
:
null
),
controller:
userCont
ont
roller
,
controller:
userController
,
focusNode:
FocusNode
()..
requestFocus
(),
),
),
...
...
flutter/lib/desktop/pages/desktop_setting_page.dart
View file @
4f6c6ab4
...
...
@@ -48,7 +48,7 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
_TabInfo
(
'Security'
,
Icons
.
enhanced_encryption_outlined
,
Icons
.
enhanced_encryption
),
_TabInfo
(
'Network'
,
Icons
.
link_outlined
,
Icons
.
link
),
_TabInfo
(
'Acount'
,
Icons
.
person_outline
,
Icons
.
person
),
_TabInfo
(
'Ac
c
ount'
,
Icons
.
person_outline
,
Icons
.
person
),
_TabInfo
(
'About'
,
Icons
.
info_outline
,
Icons
.
info
)
];
...
...
@@ -92,7 +92,7 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
_General
(),
_Safety
(),
_Network
(),
_Acount
(),
_Ac
c
ount
(),
_About
(),
],
)),
...
...
@@ -641,14 +641,14 @@ class _NetworkState extends State<_Network> with AutomaticKeepAliveClientMixin {
}
}
class
_Acount
extends
StatefulWidget
{
const
_Acount
({
Key
?
key
})
:
super
(
key:
key
);
class
_Ac
c
ount
extends
StatefulWidget
{
const
_Ac
c
ount
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
_Ac
ount
>
createState
()
=>
_A
countState
();
State
<
_Ac
count
>
createState
()
=>
_Ac
countState
();
}
class
_Ac
ountState
extends
State
<
_A
count
>
{
class
_Ac
countState
extends
State
<
_Ac
count
>
{
@override
Widget
build
(
BuildContext
context
)
{
final
scrollController
=
ScrollController
();
...
...
@@ -658,12 +658,12 @@ class _AcountState extends State<_Acount> {
physics:
NeverScrollableScrollPhysics
(),
controller:
scrollController
,
children:
[
_Card
(
title:
'Ac
ount'
,
children:
[
logi
n
()]),
_Card
(
title:
'Ac
count'
,
children:
[
accountActio
n
()]),
],
).
marginOnly
(
bottom:
_kListViewBottomMargin
));
}
Widget
logi
n
()
{
Widget
accountActio
n
()
{
return
_futureBuilder
(
future:
()
async
{
return
await
gFFI
.
userModel
.
getUserName
();
}(),
hasData:
(
data
)
{
...
...
@@ -671,12 +671,14 @@ class _AcountState extends State<_Acount> {
return
_Button
(
username
.
isEmpty
?
'Login'
:
'Logout'
,
()
=>
{
loginDialog
().
then
((
success
)
{
if
(
success
)
{
// refresh frame
setState
(()
{});
}
})
username
.
isEmpty
?
loginDialog
().
then
((
success
)
{
if
(
success
)
{
// refresh frame
setState
(()
{});
}
})
:
gFFI
.
userModel
.
logOut
()
});
});
}
...
...
flutter/lib/mobile/pages/connection_page.dart
View file @
4f6c6ab4
...
...
@@ -2,7 +2,6 @@ import 'dart:async';
import
'package:flutter/material.dart'
;
import
'package:flutter_hbb/common/formatter/id_formatter.dart'
;
import
'package:flutter_hbb/mobile/pages/file_manager_page.dart'
;
import
'package:get/get.dart'
;
import
'package:provider/provider.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
...
...
@@ -10,12 +9,11 @@ import 'package:url_launcher/url_launcher.dart';
import
'../../common.dart'
;
import
'../../common/widgets/address_book.dart'
;
import
'../../common/widgets/peer_tab_page.dart'
;
import
'../../common/widgets/peer
_widget
.dart'
;
import
'../../common/widgets/peer
s_view
.dart'
;
import
'../../consts.dart'
;
import
'../../models/model.dart'
;
import
'../../models/platform_model.dart'
;
import
'home_page.dart'
;
import
'remote_page.dart'
;
import
'scan_page.dart'
;
import
'settings_page.dart'
;
...
...
@@ -84,9 +82,9 @@ class _ConnectionPageState extends State<ConnectionPage> {
translate
(
'Address Book'
)
],
children:
[
RecentPeer
Widget
(),
FavoritePeer
Widget
(),
DiscoveredPeer
Widget
(),
RecentPeer
sView
(),
FavoritePeer
sView
(),
DiscoveredPeer
sView
(),
const
AddressBook
(),
],
)),
...
...
@@ -97,38 +95,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
/// Connects to the selected peer.
void
onConnect
()
{
var
id
=
_idController
.
id
;
connect
(
id
);
}
/// Connect to a peer with [id].
/// If [isFileTransfer], starts a session only for file transfer.
void
connect
(
String
id
,
{
bool
isFileTransfer
=
false
})
async
{
if
(
id
==
''
)
return
;
id
=
id
.
replaceAll
(
' '
,
''
);
if
(
isFileTransfer
)
{
if
(!
await
PermissionManager
.
check
(
"file"
))
{
if
(!
await
PermissionManager
.
request
(
"file"
))
{
return
;
}
}
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
FileManagerPage
(
id:
id
),
),
);
}
else
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
RemotePage
(
id:
id
),
),
);
}
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
connect
(
context
,
id
);
}
/// UI for software update.
...
...
flutter/lib/mobile/pages/settings_page.dart
View file @
4f6c6ab4
...
...
@@ -25,14 +25,13 @@ class SettingsPage extends StatefulWidget implements PageShape {
final
appBarActions
=
[
ScanButton
()];
@override
_SettingsState
createState
()
=>
_SettingsState
();
State
<
SettingsPage
>
createState
()
=>
_SettingsState
();
}
const
url
=
'https://rustdesk.com/'
;
final
_hasIgnoreBattery
=
androidVersion
>=
26
;
var
_ignoreBatteryOpt
=
false
;
var
_enableAbr
=
false
;
var
_isDarkMode
=
false
;
class
_SettingsState
extends
State
<
SettingsPage
>
with
WidgetsBindingObserver
{
String
?
username
;
...
...
@@ -60,8 +59,6 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
_enableAbr
=
enableAbrRes
;
}
// _isDarkMode = MyTheme.currentDarkMode(); // TODO
if
(
update
)
{
setState
(()
{});
}
...
...
@@ -100,7 +97,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
Provider
.
of
<
FfiModel
>(
context
);
final
enhancementsTiles
=
[
SettingsTile
.
switchTile
(
title:
Text
(
translate
(
'Adaptive Bitrate'
)
+
'
(beta)'
),
title:
Text
(
'
${translate('Adaptive Bitrate')}
(beta)'
),
initialValue:
_enableAbr
,
onToggle:
(
v
)
{
bind
.
mainSetOption
(
key:
"enable-abr"
,
value:
v
?
""
:
"N"
);
...
...
@@ -152,7 +149,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
SettingsTile
.
navigation
(
title:
Text
(
username
==
null
?
translate
(
"Login"
)
:
translate
(
"Logout"
)
+
'
(
$username
)'
),
:
'
${translate("Logout")}
(
$username
)'
),
leading:
Icon
(
Icons
.
person
),
onPressed:
(
context
)
{
if
(
username
==
null
)
{
...
...
@@ -177,15 +174,11 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
onPressed:
(
context
)
{
showLanguageSettings
(
gFFI
.
dialogManager
);
}),
SettingsTile
.
switchTile
(
SettingsTile
.
navigation
(
title:
Text
(
translate
(
'Dark Theme'
)),
leading:
Icon
(
Icons
.
dark_mode
),
initialValue:
_isDarkMode
,
onToggle:
(
v
)
{
setState
(()
{
_isDarkMode
=
!
_isDarkMode
;
// MyTheme.changeDarkMode(_isDarkMode); // TODO
});
onPressed:
(
context
)
{
showThemeSettings
(
gFFI
.
dialogManager
);
},
)
]),
...
...
@@ -232,7 +225,7 @@ void showLanguageSettings(OverlayDialogManager dialogManager) async {
final
langs
=
json
.
decode
(
await
bind
.
mainGetLangs
())
as
List
<
dynamic
>;
var
lang
=
await
bind
.
mainGetLocalOption
(
key:
"lang"
);
dialogManager
.
show
((
setState
,
close
)
{
final
setLang
=
(
v
)
{
setLang
(
v
)
{
if
(
lang
!=
v
)
{
setState
(()
{
lang
=
v
;
...
...
@@ -241,7 +234,8 @@ void showLanguageSettings(OverlayDialogManager dialogManager) async {
HomePage
.
homeKey
.
currentState
?.
refreshPages
();
Future
.
delayed
(
Duration
(
milliseconds:
200
),
close
);
}
};
}
return
CustomAlertDialog
(
title:
SizedBox
.
shrink
(),
content:
Column
(
...
...
@@ -257,13 +251,41 @@ void showLanguageSettings(OverlayDialogManager dialogManager) async {
),
actions:
[]);
},
backDismiss:
true
,
clickMaskDismiss:
true
);
}
catch
(
_e
)
{}
}
catch
(
e
)
{
//
}
}
void
showThemeSettings
(
OverlayDialogManager
dialogManager
)
async
{
var
themeMode
=
MyTheme
.
getThemeModePreference
();
dialogManager
.
show
((
setState
,
close
)
{
setTheme
(
v
)
{
if
(
themeMode
!=
v
)
{
setState
(()
{
themeMode
=
v
;
});
MyTheme
.
changeDarkMode
(
themeMode
);
Future
.
delayed
(
Duration
(
milliseconds:
200
),
close
);
}
}
return
CustomAlertDialog
(
title:
SizedBox
.
shrink
(),
contentPadding:
10
,
content:
Column
(
children:
[
getRadio
(
'Light'
,
ThemeMode
.
light
,
themeMode
,
setTheme
),
getRadio
(
'Dark'
,
ThemeMode
.
dark
,
themeMode
,
setTheme
),
getRadio
(
'Follow System'
,
ThemeMode
.
system
,
themeMode
,
setTheme
)
]),
actions:
[]);
},
backDismiss:
true
,
clickMaskDismiss:
true
);
}
void
showAbout
(
OverlayDialogManager
dialogManager
)
{
dialogManager
.
show
((
setState
,
close
)
{
return
CustomAlertDialog
(
title:
Text
(
translate
(
'About'
)
+
'
RustDesk'
),
title:
Text
(
'
${translate('About')}
RustDesk'
),
content:
Wrap
(
direction:
Axis
.
vertical
,
spacing:
12
,
children:
[
Text
(
'Version:
$version
'
),
InkWell
(
...
...
@@ -429,7 +451,7 @@ void showLogin(OverlayDialogManager dialogManager) {
),
controller:
nameController
,
),
PasswordWidget
(
controller:
passwordController
),
PasswordWidget
(
controller:
passwordController
,
autoFocus:
false
),
]),
actions:
(
loading
?
<
Widget
>[
CircularProgressIndicator
()]
...
...
flutter/lib/mobile/widgets/dialog.dart
View file @
4f6c6ab4
...
...
@@ -6,8 +6,7 @@ import '../../models/model.dart';
import
'../../models/platform_model.dart'
;
void
clientClose
(
OverlayDialogManager
dialogManager
)
{
msgBox
(
''
,
'Close'
,
'Are you sure to close the connection?'
,
dialogManager
);
msgBox
(
''
,
'Close'
,
'Are you sure to close the connection?'
,
dialogManager
);
}
void
showSuccess
(
)
{
...
...
@@ -131,7 +130,7 @@ void setTemporaryPasswordLengthDialog(
if
(
index
<
0
)
index
=
0
;
length
=
lengths
[
index
];
dialogManager
.
show
((
setState
,
close
)
{
final
setLength
=
(
newValue
)
{
setLength
(
newValue
)
{
final
oldValue
=
length
;
if
(
oldValue
==
newValue
)
return
;
setState
(()
{
...
...
@@ -143,7 +142,8 @@ void setTemporaryPasswordLengthDialog(
close
();
showSuccess
();
});
};
}
return
CustomAlertDialog
(
title:
Text
(
translate
(
"Set temporary password length"
)),
content:
Column
(
...
...
@@ -230,12 +230,14 @@ void wrongPasswordDialog(String id, OverlayDialogManager dialogManager) {
}
class
PasswordWidget
extends
StatefulWidget
{
PasswordWidget
({
Key
?
key
,
required
this
.
controller
})
:
super
(
key:
key
);
PasswordWidget
({
Key
?
key
,
required
this
.
controller
,
this
.
autoFocus
=
true
})
:
super
(
key:
key
);
final
TextEditingController
controller
;
final
bool
autoFocus
;
@override
_PasswordWidgetState
createState
()
=>
_PasswordWidgetState
();
State
<
PasswordWidget
>
createState
()
=>
_PasswordWidgetState
();
}
class
_PasswordWidgetState
extends
State
<
PasswordWidget
>
{
...
...
@@ -245,7 +247,9 @@ class _PasswordWidgetState extends State<PasswordWidget> {
@override
void
initState
()
{
super
.
initState
();
Timer
(
Duration
(
milliseconds:
50
),
()
=>
_focusNode
.
requestFocus
());
if
(
widget
.
autoFocus
)
{
Timer
(
Duration
(
milliseconds:
50
),
()
=>
_focusNode
.
requestFocus
());
}
}
@override
...
...
src/lang/cn.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"适应窗口"
),
(
"General"
,
"常规"
),
(
"Security"
,
"安全"
),
(
"Acount"
,
"账户"
),
(
"Ac
c
ount"
,
"账户"
),
(
"Theme"
,
"主题"
),
(
"Dark Theme"
,
"暗黑主题"
),
(
"Enable hardware codec"
,
"使用硬件编解码"
),
...
...
src/lang/cs.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Měřítko adaptivní"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/da.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Skala adaptiv"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/de.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Adaptiv skalieren"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/eo.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Skalo adapta"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/es.rs
View file @
4f6c6ab4
...
...
@@ -337,7 +337,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Adaptable a escala"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/fr.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Échelle adaptative"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/hu.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Skála adaptív"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/id.rs
View file @
4f6c6ab4
...
...
@@ -337,7 +337,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Skala adaptif"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/it.rs
View file @
4f6c6ab4
...
...
@@ -323,7 +323,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Translate mode"
,
""
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/ja.rs
View file @
4f6c6ab4
...
...
@@ -321,7 +321,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"フィットウィンドウ"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/ko.rs
View file @
4f6c6ab4
...
...
@@ -318,7 +318,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"맞는 창"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/pl.rs
View file @
4f6c6ab4
...
...
@@ -322,7 +322,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Skala adaptacyjna"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/pt_PT.rs
View file @
4f6c6ab4
...
...
@@ -318,7 +318,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Escala adaptável"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/ptbr.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
""
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/ru.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Масштаб адаптивный"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/sk.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Prispôsobivá mierka"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/template.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
""
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/tr.rs
View file @
4f6c6ab4
...
...
@@ -337,7 +337,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Ölçek uyarlanabilir"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
src/lang/tw.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"適應窗口"
),
(
"General"
,
"常規"
),
(
"Security"
,
"安全"
),
(
"Acount"
,
"賬戶"
),
(
"Ac
c
ount"
,
"賬戶"
),
(
"Theme"
,
"主題"
),
(
"Dark Theme"
,
"暗黑主題"
),
(
"Enable hardware codec"
,
"使用硬件編解碼"
),
...
...
src/lang/vn.rs
View file @
4f6c6ab4
...
...
@@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
(
"Scale adaptive"
,
"Quy mô thích ứng"
),
(
"General"
,
""
),
(
"Security"
,
""
),
(
"Acount"
,
""
),
(
"Ac
c
ount"
,
""
),
(
"Theme"
,
""
),
(
"Dark Theme"
,
""
),
(
"Enable hardware codec"
,
""
),
...
...
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