I have a problem with SyncFusion's flutter calendar which is demonstrated by this screenshot of SfCalendar
showing months which is inside a Column
with other children (also see end for minimal reporoducible example code):
The problem is simple: vertical scrolling works fine when the touch point begins on the other Column
children, but when the touch point begins on the SfCalendar
the Column
does not scroll. The calendar seems to absorb all vertical drag touch gestures completely. This is extremely annoying, because SfCalendar in month mode makes no use of vertical drag gestures, so it really should allow the Column to scroll.
Setting debugPrintGestureArenaDiagnostics = true
reveals what is going on when you try to scroll vertically on the calendar:
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)
There appear to be two VerticalDragGestureRecognizer
s - I'm guessing that one is the SingleChildScrollView
and the other is SfCalendar
(again, I have no idea why the calendar has a vertical drag recogniser, because it has no vertical drag functionality). It looks like the Calendar wins the arena for a vertical drag, then just swallows the event and does nothing.
So my question is:
How do I make my SingleChildScrollView
win the arena? Or is there any other way to make this work?
Minimal reproducible example:
pubspec.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
main.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),
),
],
),
)
);
}
}