more translate and fix small

This commit is contained in:
csf 2022-03-23 16:28:37 +08:00
parent cc75ffbeeb
commit 98d8689d7b
4 changed files with 87 additions and 62 deletions

View File

@ -320,7 +320,7 @@ showInputWarnAlert() async {
builder: (alertContext) { builder: (alertContext) {
DialogManager.register(alertContext); DialogManager.register(alertContext);
return AlertDialog( return AlertDialog(
title: Text("获取输入权限引导"), title: Text(translate("How to get Android input permission?")),
// content: Text.rich(TextSpan(style: TextStyle(), children: [ // content: Text.rich(TextSpan(style: TextStyle(), children: [
// // [] : [Installed Services] // // [] : [Installed Services]
// // [Installed Services][RustDesk Input] // // [Installed Services][RustDesk Input]

View File

@ -34,7 +34,7 @@ class ChatPage extends StatelessWidget implements PageShape {
chatModel.send(chatMsg); chatModel.send(chatMsg);
}, },
user: chatModel.me, user: chatModel.me,
messages: chatModel.messages[chatModel.currentID], messages: chatModel.messages[chatModel.currentID] ?? [],
); );
})); }));
} }

View File

@ -281,7 +281,7 @@ class PaddingCard extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontFamily: 'WorkSans', fontFamily: 'WorkSans',
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 22, fontSize: 20,
color: MyTheme.accent80, color: MyTheme.accent80,
), ),
) )

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart'; import 'package:flutter_hbb/common.dart';
import 'package:toggle_switch/toggle_switch.dart'; import 'package:toggle_switch/toggle_switch.dart';
import '../models/model.dart';
class GestureIcons { class GestureIcons {
static const String _family = 'gestureicons'; static const String _family = 'gestureicons';
@ -35,9 +37,12 @@ class GestureIcons {
typedef OnTouchModeChange = void Function(bool); typedef OnTouchModeChange = void Function(bool);
class GestureHelp extends StatefulWidget { class GestureHelp extends StatefulWidget {
GestureHelp({Key? key,required this.touchMode,required this.onTouchModeChange}) : super(key: key); GestureHelp(
{Key? key, required this.touchMode, required this.onTouchModeChange})
: super(key: key);
final bool touchMode; final bool touchMode;
final OnTouchModeChange onTouchModeChange; final OnTouchModeChange onTouchModeChange;
@override @override
State<StatefulWidget> createState() => _GestureHelpState(); State<StatefulWidget> createState() => _GestureHelpState();
} }
@ -57,27 +62,24 @@ class _GestureHelpState extends State<GestureHelp> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Center(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10), padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
ToggleSwitch( ToggleSwitch(
initialLabelIndex: _selectedIndex, initialLabelIndex: _selectedIndex,
inactiveBgColor: MyTheme.darkGray, inactiveBgColor: MyTheme.darkGray,
totalSwitches: 2, totalSwitches: 2,
minWidth: 130, minWidth: 150,
fontSize: 15, fontSize: 15,
iconSize: 20, iconSize: 18,
labels: ["触摸板模式", "触屏模式"], labels: [translate("TouchPad mode"), translate("Touch mode")],
icons: [ icons: [Icons.mouse, Icons.touch_app],
Icons.mouse,
Icons.touch_app
],
onToggle: (index) { onToggle: (index) {
debugPrint(index.toString()); debugPrint(index.toString());
setState(() { setState(() {
if (_selectedIndex != index){ if (_selectedIndex != index) {
_selectedIndex = index ?? 0; _selectedIndex = index ?? 0;
_touchMode = index == 0 ? false : true; _touchMode = index == 0 ? false : true;
widget.onTouchModeChange(_touchMode); widget.onTouchModeChange(_touchMode);
@ -86,39 +88,64 @@ class _GestureHelpState extends State<GestureHelp> {
}, },
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Column( Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: _touchMode children: _touchMode
? const [ ? [
GestureInfo( GestureInfo(
GestureIcons.icon_Mobile_Touch, "单指轻触", "点击对应位置"), GestureIcons.icon_Mobile_Touch,
GestureInfo(GestureIcons.icon_gesture_press_hold, translate("One-Finger Tap"),
"单指长按", "鼠标右键"), translate("Left Mouse")),
GestureInfo(GestureIcons.icon_gesture_f_swipe_right,
"单指移动", "鼠标选中拖动"),
GestureInfo(GestureIcons.icon_gesture_f_drag_up_down_,
"双指垂直滑动", "鼠标滚轮"),
GestureInfo( GestureInfo(
GestureIcons.icon_gesture_f_drag, "双指移动", "移动画布"), GestureIcons.icon_gesture_press_hold,
translate("One-Long Tap"),
translate("Right Mouse")),
GestureInfo( GestureInfo(
GestureIcons.icon_gesture_pinch, "双指缩放", "缩放画布"), GestureIcons.icon_gesture_f_swipe_right,
translate("One-Finger Move"),
translate("Mouse Drag")),
GestureInfo(
GestureIcons.icon_gesture_f_drag_up_down_,
translate("Two-Finger vertically"),
translate("Mouse Wheel")),
GestureInfo(
GestureIcons.icon_gesture_f_drag,
translate("Two-Finger Move"),
translate("Canvas Move")),
GestureInfo(
GestureIcons.icon_gesture_pinch,
translate("Pinch to Zoom"),
translate("Canvas Zoom")),
] ]
: const [ : [
GestureInfo( GestureInfo(
GestureIcons.icon_gesture_tap, "单指轻触", "鼠标左键"), GestureIcons.icon_Mobile_Touch,
translate("One-Finger Tap"),
translate("Left Mouse")),
GestureInfo( GestureInfo(
GestureIcons.icon_gesture_f_tap_, "双指轻触", "鼠标右键"), GestureIcons.icon_gesture_f_tap_,
GestureInfo(GestureIcons.icon_gesture_f_swipe_right, translate("Two-Finger Tap"),
"双击并移动", "鼠标选中拖动"), translate("Right Mouse")),
GestureInfo(GestureIcons.icon_gesture_f_drag_up_down_,
"双指垂直滑动", "鼠标滚轮"),
GestureInfo( GestureInfo(
GestureIcons.icon_gesture_f_drag, "双指移动", "移动画布"), GestureIcons.icon_gesture_f_swipe_right,
translate("Double Tap & Move"),
translate("Mouse Drag")),
GestureInfo( GestureInfo(
GestureIcons.icon_gesture_pinch, "双指缩放", "缩放画布"), GestureIcons.icon_gesture_f_drag_up_down_,
translate("Two-Finger vertically"),
translate("Mouse Wheel")),
GestureInfo(
GestureIcons.icon_gesture_f_drag,
translate("Two-Finger Move"),
translate("Canvas Move")),
GestureInfo(
GestureIcons.icon_gesture_pinch,
translate("Pinch to Zoom"),
translate("Canvas Zoom")),
], ],
), )),
], ],
))); )));
} }
@ -132,41 +159,39 @@ class GestureInfo extends StatelessWidget {
final String toText; final String toText;
final IconData icon; final IconData icon;
final textSize = 15.0; final textSize = 14.0;
final textColor = MyTheme.accent80; final textColor = MyTheme.accent80;
final iconSize = 35.0; final iconSize = 35.0;
final iconColor = MyTheme.darkGray; final iconColor = MyTheme.darkGray;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return Padding(
width: 280, padding: const EdgeInsets.symmetric(vertical: 5),
child: Padding( child: Row(
padding: const EdgeInsets.symmetric(vertical: 5), mainAxisAlignment: MainAxisAlignment.start,
child: Row( crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.center, Padding(
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Icon(
icon,
size: iconSize,
color: iconColor,
)),
Row(
children: [ children: [
Text(fromText,
style: TextStyle(fontSize: textSize, color: textColor)),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 15), padding: const EdgeInsets.symmetric(horizontal: 5),
child: Icon( child: Icon(Icons.arrow_forward_rounded,
icon, size: 20, color: iconColor)),
size: iconSize, Text(toText,
color: iconColor, style: TextStyle(fontSize: textSize, color: textColor))
)),
Row(
children: [
Text(fromText,
style: TextStyle(fontSize: textSize, color: textColor)),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: Icon(Icons.arrow_forward_rounded,
size: 20, color: iconColor)),
Text(toText,
style: TextStyle(fontSize: textSize, color: textColor))
],
)
], ],
))); )
],
));
} }
} }