new guestion tip

This commit is contained in:
rustdesk 2022-04-05 02:02:49 +08:00
parent 35e16e2299
commit 86c6f9446d
2 changed files with 46 additions and 36 deletions

View File

@ -32,7 +32,6 @@ class _SettingsState extends State<SettingsPage> {
Provider.of<FfiModel>(context); Provider.of<FfiModel>(context);
final username = getUsername(); final username = getUsername();
return SettingsList( return SettingsList(
contentPadding: EdgeInsets.symmetric(horizontal: 12),
sections: [ sections: [
SettingsSection( SettingsSection(
title: Text(translate("Account")), title: Text(translate("Account")),

View File

@ -60,12 +60,20 @@ class _GestureHelpState extends State<GestureHelp> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
final space = 12.0;
var width = size.width - 2 * space;
final minWidth = 90;
if (size.width > minWidth + 2 * space) {
final n = (size.width / (minWidth + 2 * space)).floor();
width = size.width / n - 2 * space;
}
return Center( return Center(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
ToggleSwitch( ToggleSwitch(
initialLabelIndex: _selectedIndex, initialLabelIndex: _selectedIndex,
@ -77,7 +85,6 @@ class _GestureHelpState extends State<GestureHelp> {
labels: [translate("TouchPad mode"), translate("Touch mode")], labels: [translate("TouchPad mode"), translate("Touch mode")],
icons: [Icons.mouse, Icons.touch_app], icons: [Icons.mouse, Icons.touch_app],
onToggle: (index) { onToggle: (index) {
debugPrint(index.toString());
setState(() { setState(() {
if (_selectedIndex != index) { if (_selectedIndex != index) {
_selectedIndex = index ?? 0; _selectedIndex = index ?? 0;
@ -87,60 +94,72 @@ class _GestureHelpState extends State<GestureHelp> {
}); });
}, },
), ),
const SizedBox(height: 15), const SizedBox(height: 30),
Container( Container(
child: Column( child: Wrap(
mainAxisAlignment: MainAxisAlignment.start, spacing: space,
crossAxisAlignment: CrossAxisAlignment.center, runSpacing: 2 * space,
children: _touchMode children: _touchMode
? [ ? [
GestureInfo( GestureInfo(
width,
GestureIcons.icon_Mobile_Touch, GestureIcons.icon_Mobile_Touch,
translate("One-Finger Tap"), translate("One-Finger Tap"),
translate("Left Mouse")), translate("Left Mouse")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_press_hold, GestureIcons.icon_gesture_press_hold,
translate("One-Long Tap"), translate("One-Long Tap"),
translate("Right Mouse")), translate("Right Mouse")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_f_swipe_right, GestureIcons.icon_gesture_f_swipe_right,
translate("One-Finger Move"), translate("One-Finger Move"),
translate("Mouse Drag")), translate("Mouse Drag")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_f_drag_up_down_, GestureIcons.icon_gesture_f_drag_up_down_,
translate("Two-Finger vertically"), translate("Two-Finger vertically"),
translate("Mouse Wheel")), translate("Mouse Wheel")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_f_drag, GestureIcons.icon_gesture_f_drag,
translate("Two-Finger Move"), translate("Two-Finger Move"),
translate("Canvas Move")), translate("Canvas Move")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_pinch, GestureIcons.icon_gesture_pinch,
translate("Pinch to Zoom"), translate("Pinch to Zoom"),
translate("Canvas Zoom")), translate("Canvas Zoom")),
] ]
: [ : [
GestureInfo( GestureInfo(
width,
GestureIcons.icon_Mobile_Touch, GestureIcons.icon_Mobile_Touch,
translate("One-Finger Tap"), translate("One-Finger Tap"),
translate("Left Mouse")), translate("Left Mouse")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_f_tap_, GestureIcons.icon_gesture_f_tap_,
translate("Two-Finger Tap"), translate("Two-Finger Tap"),
translate("Right Mouse")), translate("Right Mouse")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_f_swipe_right, GestureIcons.icon_gesture_f_swipe_right,
translate("Double Tap & Move"), translate("Double Tap & Move"),
translate("Mouse Drag")), translate("Mouse Drag")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_f_drag_up_down_, GestureIcons.icon_gesture_f_drag_up_down_,
translate("Two-Finger vertically"), translate("Two-Finger vertically"),
translate("Mouse Wheel")), translate("Mouse Wheel")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_f_drag, GestureIcons.icon_gesture_f_drag,
translate("Two-Finger Move"), translate("Two-Finger Move"),
translate("Canvas Move")), translate("Canvas Move")),
GestureInfo( GestureInfo(
width,
GestureIcons.icon_gesture_pinch, GestureIcons.icon_gesture_pinch,
translate("Pinch to Zoom"), translate("Pinch to Zoom"),
translate("Canvas Zoom")), translate("Canvas Zoom")),
@ -152,45 +171,37 @@ class _GestureHelpState extends State<GestureHelp> {
} }
class GestureInfo extends StatelessWidget { class GestureInfo extends StatelessWidget {
const GestureInfo(this.icon, this.fromText, this.toText, {Key? key}) const GestureInfo(this.width, this.icon, this.fromText, this.toText,
{Key? key})
: super(key: key); : super(key: key);
final String fromText; final String fromText;
final String toText; final String toText;
final IconData icon; final IconData icon;
final double width;
final textSize = 14.0;
final textColor = MyTheme.accent80;
final iconSize = 35.0; final iconSize = 35.0;
final iconColor = MyTheme.darkGray; final iconColor = MyTheme.accent;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Container(
padding: const EdgeInsets.symmetric(vertical: 5), width: this.width,
child: Row( child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Padding( Icon(
padding: const EdgeInsets.symmetric(horizontal: 0), icon,
child: Icon( size: iconSize,
icon, color: iconColor,
size: iconSize, ),
color: iconColor, SizedBox(height: 6),
)), Text(fromText,
Row( textAlign: TextAlign.center,
children: [ style: TextStyle(fontSize: 10, color: Colors.grey)),
Text(fromText, SizedBox(height: 3),
style: TextStyle(fontSize: textSize, color: textColor)), Text(toText,
Padding( textAlign: TextAlign.center,
padding: const EdgeInsets.symmetric(horizontal: 5), style: TextStyle(fontSize: 12, color: Colors.black))
child: Icon(Icons.arrow_forward_rounded,
size: 20, color: iconColor)),
Text(toText,
style: TextStyle(fontSize: textSize, color: textColor))
],
)
], ],
)); ));
} }