remove superseded desktop/mobile gesture detector widget
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:thermion_flutter/thermion/widgets/camera/gestures/thermion_gesture_handler.dart';
|
||||
|
||||
class ThermionGestureDetectorDesktop extends StatelessWidget {
|
||||
|
||||
final ThermionGestureHandler gestureHandler;
|
||||
|
||||
const ThermionGestureDetectorDesktop({
|
||||
Key? key,
|
||||
required this.gestureHandler,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Listener(
|
||||
onPointerHover: (event) =>
|
||||
gestureHandler.onPointerHover(event.localPosition),
|
||||
onPointerSignal: (PointerSignalEvent pointerSignal) {
|
||||
if (pointerSignal is PointerScrollEvent) {
|
||||
gestureHandler.onPointerScroll(
|
||||
pointerSignal.localPosition, pointerSignal.scrollDelta.dy);
|
||||
}
|
||||
},
|
||||
onPointerPanZoomStart: (pzs) {
|
||||
throw Exception("TODO - is this a pinch zoom on laptop trackpad?");
|
||||
},
|
||||
onPointerDown: (d) {
|
||||
gestureHandler.onPointerDown(d.localPosition, d.buttons);
|
||||
},
|
||||
onPointerMove: (d) =>
|
||||
gestureHandler.onPointerMove(d.localPosition, d.delta, d.buttons),
|
||||
onPointerUp: (d) => gestureHandler.onPointerUp(d.buttons),
|
||||
child: Container(color: Colors.transparent,),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:thermion_flutter/thermion/widgets/camera/gestures/thermion_gesture_handler.dart';
|
||||
|
||||
class ThermionGestureDetectorMobile extends StatefulWidget {
|
||||
final Widget? child;
|
||||
final ThermionGestureHandler gestureHandler;
|
||||
|
||||
const ThermionGestureDetectorMobile(
|
||||
{Key? key, required this.gestureHandler, this.child})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ThermionGestureDetectorMobileState();
|
||||
}
|
||||
|
||||
class _ThermionGestureDetectorMobileState
|
||||
extends State<ThermionGestureDetectorMobile> {
|
||||
GestureAction current = GestureAction.PAN_CAMERA;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTapDown: (details) =>
|
||||
widget.gestureHandler.onPointerDown(details.localPosition, 0),
|
||||
onDoubleTap: () {
|
||||
if (current == GestureAction.PAN_CAMERA) {
|
||||
widget.gestureHandler.setActionForType(
|
||||
GestureType.SCALE1, GestureAction.ROTATE_CAMERA);
|
||||
current = GestureAction.ROTATE_CAMERA;
|
||||
} else {
|
||||
widget.gestureHandler.setActionForType(
|
||||
GestureType.SCALE1, GestureAction.PAN_CAMERA);
|
||||
current = GestureAction.PAN_CAMERA;
|
||||
}
|
||||
},
|
||||
onScaleStart: (details) async {
|
||||
await widget.gestureHandler.onScaleStart();
|
||||
},
|
||||
onScaleUpdate: (details) async {
|
||||
await widget.gestureHandler.onScaleUpdate();
|
||||
},
|
||||
onScaleEnd: (details) async {
|
||||
await widget.gestureHandler.onScaleUpdate();
|
||||
},
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user