GestureDetector

This commit is contained in:
open-trade 2020-11-21 02:18:04 +08:00
parent adea49ee88
commit 6b774b52cd

View File

@ -23,6 +23,7 @@ class _RemotePageState extends State<RemotePage> {
Timer _interval; Timer _interval;
bool _showBar = true; bool _showBar = true;
double _bottom = 0; double _bottom = 0;
bool _pan = false;
final FocusNode _focusNode = FocusNode(); final FocusNode _focusNode = FocusNode();
@override @override
@ -140,11 +141,15 @@ class _RemotePageState extends State<RemotePage> {
showOptions(context); showOptions(context);
}, },
), ),
IconButton( Container(
color: Colors.white, color: _pan ? Colors.blue[500] : null,
icon: Icon(Icons.settings), child: IconButton(
onPressed: () {}, color: Colors.white,
) icon: Icon(Icons.pan_tool),
onPressed: () {
setState(() => _pan = !_pan);
},
))
]), ]),
IconButton( IconButton(
color: Colors.white, color: Colors.white,
@ -159,16 +164,32 @@ class _RemotePageState extends State<RemotePage> {
body: FlutterEasyLoading( body: FlutterEasyLoading(
child: Container( child: Container(
color: MyTheme.canvasColor, color: MyTheme.canvasColor,
child: InteractiveViewer( child: GestureDetector(
constrained: false, onTap: () {
panEnabled: true, if (_pan) return;
onInteractionUpdate: (details) {
print('$details');
}, },
child: Stack(children: [ onDoubleTap: () {
ImagePaint(), if (_pan) return;
CursorPaint(), },
]), onLongPress: () {
if (_pan) return;
},
child: InteractiveViewer(
constrained: false,
panEnabled: _pan,
onInteractionUpdate: (details) {
// print('$details');
},
onInteractionStart: (s) {
print('$s');
},
onInteractionEnd: (x) {
print('$x');
},
child: Stack(children: [
ImagePaint(),
CursorPaint(),
])),
), ),
))))); )))));
} }
@ -344,7 +365,7 @@ void showOptions(BuildContext context) {
}); });
}, },
), ),
Divider(color: MyTheme.border), Divider(color: Colors.black),
CheckboxListTile( CheckboxListTile(
value: showRemoteCursor, value: showRemoteCursor,
onChanged: (v) { onChanged: (v) {