From 06aed2a586c6a4a8916183d4a03f525d4344cb90 Mon Sep 17 00:00:00 2001 From: vjrj Date: Wed, 8 Jul 2026 14:18:10 +0200 Subject: [PATCH] fix(ui): enable mouse/trackpad drag scrolling on desktop Flutter disables pointer-drag on scrollables/PageViews on desktop by default, so the small photo carousel (and lists) couldn't be swiped with a mouse. Add an app-wide ScrollBehavior that includes mouse/trackpad/stylus drag devices. 54 tests green; Linux runs. --- apps/app_seeds/lib/app.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps/app_seeds/lib/app.dart b/apps/app_seeds/lib/app.dart index c392f83..57bae14 100644 --- a/apps/app_seeds/lib/app.dart +++ b/apps/app_seeds/lib/app.dart @@ -1,3 +1,4 @@ +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -62,6 +63,10 @@ class TaneApp extends StatelessWidget { onGenerateTitle: (context) => context.t.app.title, debugShowCheckedModeBanner: false, theme: buildTaneTheme(), + // Let scrollables & PageViews be dragged with a mouse/trackpad on + // desktop (Flutter disables that by default), so the photo carousel and + // lists swipe there too. + scrollBehavior: const _DragScrollBehavior(), locale: TranslationProvider.of(context).flutterLocale, supportedLocales: AppLocaleUtils.supportedLocales, localizationsDelegates: const [ @@ -74,3 +79,17 @@ class TaneApp extends StatelessWidget { ); } } + +/// Enables mouse/trackpad drag scrolling (off by default on desktop) so the +/// photo carousel and lists can be swiped with a pointer. +class _DragScrollBehavior extends MaterialScrollBehavior { + const _DragScrollBehavior(); + + @override + Set get dragDevices => { + PointerDeviceKind.touch, + PointerDeviceKind.mouse, + PointerDeviceKind.trackpad, + PointerDeviceKind.stylus, + }; +}