web support for FilamentGestureDetector
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'filament_controller.dart';
|
import 'filament_controller.dart';
|
||||||
import 'filament_widget.dart';
|
|
||||||
|
|
||||||
enum GestureType { RotateCamera, PanCamera, PanBackground }
|
enum GestureType { RotateCamera, PanCamera, PanBackground }
|
||||||
|
|
||||||
@@ -199,15 +199,22 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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: [
|
return Stack(children: [
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
// pinch zoom on mobile
|
// pinch zoom on mobile
|
||||||
// couldn't find any equivalent for pointerCount in Listener so we use two widgets:
|
// couldn't find any equivalent for pointerCount in Listener so we use two widgets:
|
||||||
// - outer is a GestureDetector only for pinch zoom
|
// - outer is a GestureDetector only for pinch zoom
|
||||||
// - inner is a Listener for all other gestures (including scroll zoom on desktop)
|
// - inner is a Listener for all other gestures (including scroll zoom on desktop)
|
||||||
child: Platform.isLinux || Platform.isWindows || Platform.isMacOS
|
child: controls),
|
||||||
? _desktop()
|
|
||||||
: _mobile()),
|
|
||||||
widget.showControlOverlay
|
widget.showControlOverlay
|
||||||
? Align(
|
? Align(
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
|
|||||||
Reference in New Issue
Block a user