update gesture help widget

This commit is contained in:
csf 2022-02-23 21:32:33 +08:00
parent 1a0162a581
commit 0de614bdb3
2 changed files with 36 additions and 19 deletions

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_hbb/widgets/gesture_help.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart';
import 'dart:ui' as ui;
@ -282,14 +283,6 @@ class _RemotePageState extends State<RemotePage> {
},
)
] +
(isDesktop
? []
: [
IconButton(
color: Colors.white,
icon: Icon(Icons.keyboard),
onPressed: openKeyboard)
]) +
<Widget>[
IconButton(
color: Colors.white,
@ -303,6 +296,10 @@ class _RemotePageState extends State<RemotePage> {
(isDesktop
? []
: [
IconButton(
color: Colors.white,
icon: Icon(Icons.keyboard),
onPressed: openKeyboard),
Container(
color: _mouseTools ? Colors.blue[500] : null,
child: IconButton(
@ -314,7 +311,19 @@ class _RemotePageState extends State<RemotePage> {
resetTool();
});
},
))
)),
IconButton(
color: Colors.white,
icon: Icon(Icons.help),
onPressed: () {
setState(() => _showEdit = false);
showModalBottomSheet(
backgroundColor: MyTheme.grayBg,
context: context,
builder: (context) =>
GestureHelp(initTouchMode: _touchMode));
},
)
]) +
<Widget>[
IconButton(
@ -358,8 +367,8 @@ class _RemotePageState extends State<RemotePage> {
FFI.tap(MouseButtons.left);
}
},
onDoubleTapDown: (d){
if(_touchMode){
onDoubleTapDown: (d) {
if (_touchMode) {
FFI.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
}
},
@ -367,8 +376,8 @@ class _RemotePageState extends State<RemotePage> {
FFI.tap(MouseButtons.left);
FFI.tap(MouseButtons.left);
},
onLongPressDown: (d){
if (_touchMode){
onLongPressDown: (d) {
if (_touchMode) {
FFI.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
}
},

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart';
import 'package:toggle_switch/toggle_switch.dart';
class GestureIcons {
@ -32,15 +33,22 @@ class GestureIcons {
}
class GestureHelp extends StatefulWidget {
GestureHelp({Key? key}) : super(key: key);
GestureHelp({Key? key,this.initTouchMode = false}) : super(key: key);
final initTouchMode;
@override
State<StatefulWidget> createState() => _GestureHelpState();
}
class _GestureHelpState extends State<GestureHelp> {
var _selectedIndex = 0;
var _touchMode = false;
var _selectedIndex;
var _touchMode;
@override
void initState() {
_touchMode = widget.initTouchMode;
_selectedIndex = _touchMode ? 1 : 0;
super.initState();
}
@override
Widget build(BuildContext context) {
@ -118,9 +126,9 @@ class GestureInfo extends StatelessWidget {
final IconData icon;
final textSize = 15.0;
final textColor = Colors.blue;
final textColor = MyTheme.accent80;
final iconSize = 35.0;
final iconColor = Colors.black54;
final iconColor = MyTheme.darkGray;
@override
Widget build(BuildContext context) {