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
f1a3a8ca
Commit
f1a3a8ca
authored
Sep 19, 2022
by
Kingtous
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt: add support locales
parent
6d20a3b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
5 deletions
+63
-5
common.dart
flutter/lib/common.dart
+25
-0
main.dart
flutter/lib/main.dart
+36
-5
pubspec.yaml
flutter/pubspec.yaml
+2
-0
No files found.
flutter/lib/common.dart
View file @
f1a3a8ca
...
@@ -244,6 +244,31 @@ final ButtonStyle flatButtonStyle = TextButton.styleFrom(
...
@@ -244,6 +244,31 @@ final ButtonStyle flatButtonStyle = TextButton.styleFrom(
),
),
);
);
List
<
Locale
>
supportedLocales
=
const
[
// specify CN/TW to fix CJK issue in flutter
Locale
(
'zh'
,
'CN'
),
Locale
(
'zh'
,
'TW'
),
Locale
(
'fr'
),
Locale
(
'de'
),
Locale
(
'it'
),
Locale
(
'ja'
),
Locale
(
'cs'
),
Locale
(
'pl'
),
Locale
(
'ko'
),
Locale
(
'hu'
),
Locale
(
'pt'
),
Locale
(
'ru'
),
Locale
(
'sk'
),
Locale
(
'id'
),
Locale
(
'da'
),
Locale
(
'eo'
),
Locale
(
'tr'
),
Locale
(
'vi'
),
Locale
(
'pl'
),
Locale
(
'kz'
),
Locale
(
'en'
,
'US'
),
];
String
formatDurationToTime
(
Duration
duration
)
{
String
formatDurationToTime
(
Duration
duration
)
{
var
totalTime
=
duration
.
inSeconds
;
var
totalTime
=
duration
.
inSeconds
;
final
secs
=
totalTime
%
60
;
final
secs
=
totalTime
%
60
;
...
...
flutter/lib/main.dart
View file @
f1a3a8ca
...
@@ -8,6 +8,7 @@ import 'package:flutter_hbb/desktop/screen/desktop_file_transfer_screen.dart';
...
@@ -8,6 +8,7 @@ import 'package:flutter_hbb/desktop/screen/desktop_file_transfer_screen.dart';
import
'package:flutter_hbb/desktop/screen/desktop_port_forward_screen.dart'
;
import
'package:flutter_hbb/desktop/screen/desktop_port_forward_screen.dart'
;
import
'package:flutter_hbb/desktop/screen/desktop_remote_screen.dart'
;
import
'package:flutter_hbb/desktop/screen/desktop_remote_screen.dart'
;
import
'package:flutter_hbb/utils/multi_window_manager.dart'
;
import
'package:flutter_hbb/utils/multi_window_manager.dart'
;
import
'package:flutter_localizations/flutter_localizations.dart'
;
import
'package:get/get.dart'
;
import
'package:get/get.dart'
;
import
'package:provider/provider.dart'
;
import
'package:provider/provider.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
...
@@ -123,6 +124,12 @@ void runRemoteScreen(Map<String, dynamic> argument) async {
...
@@ -123,6 +124,12 @@ void runRemoteScreen(Map<String, dynamic> argument) async {
home:
DesktopRemoteScreen
(
home:
DesktopRemoteScreen
(
params:
argument
,
params:
argument
,
),
),
localizationsDelegates:
const
[
GlobalMaterialLocalizations
.
delegate
,
GlobalWidgetsLocalizations
.
delegate
,
GlobalCupertinoLocalizations
.
delegate
,
],
supportedLocales:
supportedLocales
,
navigatorObservers:
const
[
navigatorObservers:
const
[
// FirebaseAnalyticsObserver(analytics: analytics),
// FirebaseAnalyticsObserver(analytics: analytics),
],
],
...
@@ -141,6 +148,12 @@ void runFileTransferScreen(Map<String, dynamic> argument) async {
...
@@ -141,6 +148,12 @@ void runFileTransferScreen(Map<String, dynamic> argument) async {
darkTheme:
MyTheme
.
darkTheme
,
darkTheme:
MyTheme
.
darkTheme
,
themeMode:
MyTheme
.
initialThemeMode
(),
themeMode:
MyTheme
.
initialThemeMode
(),
home:
DesktopFileTransferScreen
(
params:
argument
),
home:
DesktopFileTransferScreen
(
params:
argument
),
localizationsDelegates:
const
[
GlobalMaterialLocalizations
.
delegate
,
GlobalWidgetsLocalizations
.
delegate
,
GlobalCupertinoLocalizations
.
delegate
,
],
supportedLocales:
supportedLocales
,
navigatorObservers:
const
[
navigatorObservers:
const
[
// FirebaseAnalyticsObserver(analytics: analytics),
// FirebaseAnalyticsObserver(analytics: analytics),
],
],
...
@@ -160,6 +173,12 @@ void runPortForwardScreen(Map<String, dynamic> argument) async {
...
@@ -160,6 +173,12 @@ void runPortForwardScreen(Map<String, dynamic> argument) async {
darkTheme:
MyTheme
.
darkTheme
,
darkTheme:
MyTheme
.
darkTheme
,
themeMode:
MyTheme
.
initialThemeMode
(),
themeMode:
MyTheme
.
initialThemeMode
(),
home:
DesktopPortForwardScreen
(
params:
argument
),
home:
DesktopPortForwardScreen
(
params:
argument
),
localizationsDelegates:
const
[
GlobalMaterialLocalizations
.
delegate
,
GlobalWidgetsLocalizations
.
delegate
,
GlobalCupertinoLocalizations
.
delegate
,
],
supportedLocales:
supportedLocales
,
navigatorObservers:
const
[
navigatorObservers:
const
[
// FirebaseAnalyticsObserver(analytics: analytics),
// FirebaseAnalyticsObserver(analytics: analytics),
],
],
...
@@ -178,14 +197,20 @@ void runConnectionManagerScreen() async {
...
@@ -178,14 +197,20 @@ void runConnectionManagerScreen() async {
theme:
MyTheme
.
lightTheme
,
theme:
MyTheme
.
lightTheme
,
darkTheme:
MyTheme
.
darkTheme
,
darkTheme:
MyTheme
.
darkTheme
,
themeMode:
MyTheme
.
initialThemeMode
(),
themeMode:
MyTheme
.
initialThemeMode
(),
localizationsDelegates:
const
[
GlobalMaterialLocalizations
.
delegate
,
GlobalWidgetsLocalizations
.
delegate
,
GlobalCupertinoLocalizations
.
delegate
,
],
supportedLocales:
supportedLocales
,
home:
const
DesktopServerPage
(),
home:
const
DesktopServerPage
(),
builder:
_keepScaleBuilder
()));
builder:
_keepScaleBuilder
()));
windowManager
.
waitUntilReadyToShow
(
windowOptions
,
()
async
{
windowManager
.
waitUntilReadyToShow
(
windowOptions
,
()
async
{
await
windowManager
.
setAlignment
(
Alignment
.
topRight
);
await
windowManager
.
setAlignment
(
Alignment
.
topRight
);
await
windowManager
.
show
();
await
windowManager
.
show
();
await
windowManager
.
focus
();
await
windowManager
.
focus
();
await
windowManager
.
setAlignment
(
Alignment
.
topRight
);
// ensure
await
windowManager
.
setAlignment
(
Alignment
.
topRight
);
// ensure
});
});
}
}
WindowOptions
getHiddenTitleBarWindowOptions
(
{
Size
?
size
})
{
WindowOptions
getHiddenTitleBarWindowOptions
(
{
Size
?
size
})
{
...
@@ -247,6 +272,12 @@ class _AppState extends State<App> {
...
@@ -247,6 +272,12 @@ class _AppState extends State<App> {
navigatorObservers:
const
[
navigatorObservers:
const
[
// FirebaseAnalyticsObserver(analytics: analytics),
// FirebaseAnalyticsObserver(analytics: analytics),
],
],
localizationsDelegates:
const
[
GlobalMaterialLocalizations
.
delegate
,
GlobalWidgetsLocalizations
.
delegate
,
GlobalCupertinoLocalizations
.
delegate
,
],
supportedLocales:
supportedLocales
,
builder:
isAndroid
builder:
isAndroid
?
(
context
,
child
)
=>
AccessibilityListener
(
?
(
context
,
child
)
=>
AccessibilityListener
(
child:
MediaQuery
(
child:
MediaQuery
(
...
...
flutter/pubspec.yaml
View file @
f1a3a8ca
...
@@ -24,6 +24,8 @@ environment:
...
@@ -24,6 +24,8 @@ environment:
dependencies
:
dependencies
:
flutter
:
flutter
:
sdk
:
flutter
sdk
:
flutter
flutter_localizations
:
sdk
:
flutter
# The following adds the Cupertino Icons font to your application.
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
# Use with the CupertinoIcons class for iOS style icons.
...
...
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