我对SyncFusion 的颤动日历有疑问,此屏幕截图SfCalendar
显示了与其他孩子一起在 a 中的月份Column
(另见最小可重复示例代码的结尾):
问题很简单:当触摸点从其他孩子开始时,垂直滚动工作正常Column
,但是当触摸点开始于 时,SfCalendar
则不Column
滚动。日历似乎完全吸收了所有垂直拖动触摸手势。这非常烦人,因为月份模式下的 SfCalendar 没有使用垂直拖动手势,所以它确实应该允许列滚动。
debugPrintGestureArenaDiagnostics = true
当您尝试在日历上垂直滚动时,设置会显示发生了什么:
I/flutter (15390): Gesture arena 24 ❙ ★ Opening new gesture arena.
I/flutter (15390): Gesture arena 24 ❙ Adding: TapGestureRecognizer#6f41b(debugOwner: GestureDetector, state: ready, button: 1)
I/flutter (15390): Gesture arena 24 ❙ Adding: TapGestureRecognizer#0240c(debugOwner: GestureDetector, state: ready, button: 1)
I/flutter (15390): Gesture arena 24 ❙ Adding: VerticalDragGestureRecognizer#736cf(debugOwner: GestureDetector, start behavior: start)
I/flutter (15390): Gesture arena 24 ❙ Adding: HorizontalDragGestureRecognizer#bde3d(debugOwner: GestureDetector, start behavior: start)
I/flutter (15390): Gesture arena 24 ❙ Adding: VerticalDragGestureRecognizer#5137d(start behavior: start)
I/flutter (15390): Gesture arena 24 ❙ Closing with 5 members.
I/flutter (15390): Gesture arena 24 ❙ Rejecting: TapGestureRecognizer#6f41b(debugOwner: GestureDetector, state: possible, button: 1, sent tap down)
I/flutter (15390): Gesture arena 24 ❙ Rejecting: TapGestureRecognizer#0240c(debugOwner: GestureDetector, state: possible, button: 1, sent tap down)
I/flutter (15390): Gesture arena 24 ❙ Accepting: VerticalDragGestureRecognizer#736cf(debugOwner: GestureDetector, start behavior: start)
I/flutter (15390): Gesture arena 24 ❙ Self-declared winner: VerticalDragGestureRecognizer#736cf(debugOwner: GestureDetector, start behavior: start)
似乎有两个VerticalDragGestureRecognizer
s - 我猜一个是那个SingleChildScrollView
,另一个是SfCalendar
(同样,我不知道为什么日历有一个垂直拖动识别器,因为它没有垂直拖动功能)。看起来日历赢得了垂直拖动的舞台,然后只是吞下事件并且什么都不做。
所以我的问题是:
我如何让我SingleChildScrollView
在竞技场上获胜?或者有没有其他方法可以使这项工作?
最小的可重现示例:
发布规范.yaml
name: syncfusioncalendarscroll
description: A new Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
syncfusion_flutter_calendar: ^18.1.59-beta
flutter:
uses-material-design: true
主要.dart
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
void main() {
debugPrintGestureArenaDiagnostics = true;
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: <Widget>[
SizedBox(
height: 700,
child: Placeholder(color: Colors.amber),
),
SfCalendar(
view: CalendarView.month,
),
SizedBox(
height: 700,
child: Placeholder(color: Colors.blue),
),
],
),
)
);
}
}