ios_edge_swipe_detector.dart 569 Bytes
import 'package:flutter/services.dart';

class IosEdgeSwipeDetector {
  static const MethodChannel _channel = MethodChannel('ios_edge_swipe');

  /// 初始化监听器(调用 iOS 注册边缘滑动监听)
  static Future<void> init() async {
    try {
      await _channel.invokeMethod('initSwipeListener');
    } catch (_) {}
  }

  /// 注册 Flutter 层监听器
  static void onEdgeSwipe(VoidCallback onSwipeDetected) {
    _channel.setMethodCallHandler((call) async {
      if (call.method == 'onEdgeSwipe') {
        onSwipeDetected();
      }
    });
  }
}