Schedule: mouse drag scrolls the board sideways only; wheel stays vertical

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-09 00:31:58 +03:00
1 parent d29c12e4f0
commit 99cda7ed04
3 files changed
+19 -7

No files matched your search

@@ -1,3 +1,4 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../schedule_model.dart'; import '../schedule_model.dart';
@@ -100,11 +101,17 @@ class DayColumn extends StatelessWidget {
? Center( ? Center(
child: Text('—', style: TextStyle(color: scheme.onSurfaceVariant)), child: Text('—', style: TextStyle(color: scheme.onSurfaceVariant)),
) )
: ListView.separated( // The board's mouse drag is sideways only: a column scrolls by
padding: const EdgeInsets.fromLTRB(8, 0, 8, 10), // wheel (or touch), never by dragging the mouse.
itemCount: cards.length, : ScrollConfiguration(
separatorBuilder: (_, _) => SizedBox(height: compact ? 6 : 10), behavior: ScrollConfiguration.of(context)
itemBuilder: (context, i) => cards[i], .copyWith(dragDevices: {...PointerDeviceKind.values}..remove(PointerDeviceKind.mouse)),
child: ListView.separated(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 10),
itemCount: cards.length,
separatorBuilder: (_, _) => SizedBox(height: compact ? 6 : 10),
itemBuilder: (context, i) => cards[i],
),
), ),
), ),
), ),
@@ -501,6 +501,7 @@ class _SchedulePageState extends State<SchedulePage> {
(byDay[DateTime(l.year, l.month, l.day)] ??= []).add(e); (byDay[DateTime(l.year, l.month, l.day)] ??= []).add(e);
} }
return HScroll( return HScroll(
wheel: false,
controller: _scroll, controller: _scroll,
builder: (c) => ListView.separated( builder: (c) => ListView.separated(
key: const ValueKey('schedule-board'), key: const ValueKey('schedule-board'),
+6 -2
View File
@@ -89,7 +89,11 @@ Future<T?> showPopover<T>(
class HScroll extends StatefulWidget { class HScroll extends StatefulWidget {
final ScrollController? controller; final ScrollController? controller;
final Widget Function(ScrollController controller) builder; final Widget Function(ScrollController controller) builder;
const HScroll({super.key, this.controller, required this.builder}); /// Map the plain (vertical) wheel to sideways scrolling. Off where the
/// children scroll vertically themselves (the schedule's day columns):
/// there only mouse drag and Shift+wheel move sideways.
final bool wheel;
const HScroll({super.key, this.controller, required this.builder, this.wheel = true});
@override @override
State<HScroll> createState() => _HScrollState(); State<HScroll> createState() => _HScrollState();
@@ -121,6 +125,6 @@ class _HScrollState extends State<HScroll> {
Widget build(BuildContext context) => ScrollConfiguration( Widget build(BuildContext context) => ScrollConfiguration(
behavior: ScrollConfiguration.of(context) behavior: ScrollConfiguration.of(context)
.copyWith(dragDevices: PointerDeviceKind.values.toSet()), .copyWith(dragDevices: PointerDeviceKind.values.toSet()),
child: Listener(onPointerSignal: _wheel, child: widget.builder(_c)), child: widget.wheel ? Listener(onPointerSignal: _wheel, child: widget.builder(_c)) : widget.builder(_c),
); );
} }