remove superseded desktop/mobile gesture detector widget

This commit is contained in:
Nick Fisher
2024-09-13 13:47:26 +08:00
parent 6e7741706e
commit 04b9d9e400
2 changed files with 0 additions and 95 deletions

View File

@@ -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,),
);
}
}

View File

@@ -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,
),
),
]);
}
}