From 7c2659c89eff60736cde8625cf7055cda2513b5b Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Fri, 22 Sep 2023 08:23:41 +0800 Subject: [PATCH] web support for FilamentGestureDetector --- lib/filament_gesture_detector.dart | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/filament_gesture_detector.dart b/lib/filament_gesture_detector.dart index 1ec5e42b..6a8e644b 100644 --- a/lib/filament_gesture_detector.dart +++ b/lib/filament_gesture_detector.dart @@ -1,10 +1,10 @@ import 'dart:async'; import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'filament_controller.dart'; -import 'filament_widget.dart'; enum GestureType { RotateCamera, PanCamera, PanBackground } @@ -199,15 +199,22 @@ class _FilamentGestureDetectorState extends State { @override Widget build(BuildContext context) { + late Widget controls; + if (kIsWeb) { + controls = Container(); + } else if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) { + controls = _desktop(); + } else { + controls = _mobile(); + } + return Stack(children: [ Positioned.fill( // pinch zoom on mobile // couldn't find any equivalent for pointerCount in Listener so we use two widgets: // - outer is a GestureDetector only for pinch zoom // - inner is a Listener for all other gestures (including scroll zoom on desktop) - child: Platform.isLinux || Platform.isWindows || Platform.isMacOS - ? _desktop() - : _mobile()), + child: controls), widget.showControlOverlay ? Align( alignment: Alignment.bottomRight,