Skip to content
Boring Doc
BreakingHigh impactOfficial migration guidesince 2.5.0landed 2.3.0-12.0.pre

Default drag scrolling devices

Framework · Official source

`ScrollBehavior`s now allow or disallow drag scrolling from specified `PointerDeviceKind`s. `ScrollBehavior.dragDevices`, by default, allows scrolling widgets to be dragged by all `PointerDeviceKind`s except for `PointerDeviceKind.mouse`.

Original behavior

Prior to this change, all `PointerDeviceKind`s could drag a `Scrollable` widget. This did not match developer expectations when interacting with Flutter applications using mouse input devices. This also made it difficult to execute other mouse gestures, like selecting text that was contained in a `Scrollable` widget.

New behavior

This change fixed the unexpected ability to scroll by dragging with a mouse.

Who is affected
Applications and packages relying on the previous behaviour or signature. Code that uses ScrollBehavior, PointerDeviceKind, ScrollBehavior.dragDevices and related APIs.
Practical impact
Behaviour or API differences that can break builds or change runtime behaviour.
What action should I take?
Follow the official migration guide below, update affected call sites, run `dart fix --apply` where a fix is available, then run your tests.

Before and after (from the official guide)

dart+12−0
Before
 
 
 
 
 
 
 
 
 
 
 
1 MaterialApp(
 
2 // ...
3 );
After
1+class MyCustomScrollBehavior extends MaterialScrollBehavior {
2+ // Override behavior methods and getters like dragDevices
3+ @override
4+ Set<PointerDeviceKind> get dragDevices => {
5+ PointerDeviceKind.touch,
6+ PointerDeviceKind.mouse,
7+ // etc.
8+ };
9+}
10+ 
11+// Set ScrollBehavior for an entire application.
12 MaterialApp(
13+ scrollBehavior: MyCustomScrollBehavior(),
14 // ...
15 );
Raw before / after
MaterialApp(
  // ...
);
class MyCustomScrollBehavior extends MaterialScrollBehavior {
  // Override behavior methods and getters like dragDevices
  @override
  Set<PointerDeviceKind> get dragDevices => {
    PointerDeviceKind.touch,
    PointerDeviceKind.mouse,
    // etc.
  };
}

// Set ScrollBehavior for an entire application.
MaterialApp(
  scrollBehavior: MyCustomScrollBehavior(),
  // ...
);
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)

Setting a custom ScrollBehavior for your application

Code before migration:

MaterialApp(
  // ...
);

Code after migration:

class MyCustomScrollBehavior extends MaterialScrollBehavior {
  // Override behavior methods and getters like dragDevices
  @override
  Set&#x3C;PointerDeviceKind> get dragDevices => {
    PointerDeviceKind.touch,
    PointerDeviceKind.mouse,
    // etc.
  };
}

// Set ScrollBehavior for an entire application.
MaterialApp(
  scrollBehavior: MyCustomScrollBehavior(),
  // ...
);

Setting a custom ScrollBehavior for a specific widget

Code before migration:

final ScrollController controller = ScrollController();
ListView.builder(
  controller: controller,
  itemBuilder: (BuildContext context, int index) {
   return Text('Item $index');
 }
);

Code after migration:

class MyCustomScrollBehavior extends MaterialScrollBehavior {
  // Override behavior methods and getters like dragDevices
  @override
  Set&#x3C;PointerDeviceKind> get dragDevices => {
    PointerDeviceKind.touch,
    PointerDeviceKind.mouse,
    // etc.
  };
}

// ScrollBehavior can be set for a specific widget.
final ScrollController controller = ScrollController();
ScrollConfiguration(
  behavior: MyCustomScrollBehavior(),
  child: ListView.builder(
    controller: controller,
    itemBuilder: (BuildContext context, int index) {
     return Text('Item $index');
    }
  ),
);

Copy and modify existing ScrollBehavior

Code before migration:

final ScrollController controller = ScrollController();
ListView.builder(
  controller: controller,
  itemBuilder: (BuildContext context, int index) {
   return Text('Item $index');
 }
);

Code after migration:

// ScrollBehavior can be copied and adjusted.
final ScrollController controller = ScrollController();
ScrollConfiguration(
  behavior: ScrollConfiguration.of(context).copyWith(dragDevices: {
    PointerDeviceKind.touch,
    PointerDeviceKind.mouse,
  }),
  child: ListView.builder(
    controller: controller,
    itemBuilder: (BuildContext context, int index) {
     return Text('Item $index');
    }
  ),
);

Migrate GestureDetectors from kind to supportedDevices

Code before migration:

VerticalDragGestureRecognizer(
  kind: PointerDeviceKind.touch,
);

Code after migration:

VerticalDragGestureRecognizer(
  supportedDevices: &#x3C;PointerDeviceKind>{ PointerDeviceKind.touch },
);
Migration assistantAI-generated · grounded in cited sources
AI explanations are not configured
Set AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.
Official migration guide·Verified classification (95%)

Listed in the official breaking-changes index (docs.flutter.dev/release/breaking-changes).

An official announcement or migration guide documents an intended behaviour or API change. A verified source change (git diff) shows code changed but does not by itself prove a public API is breaking. AI interpretations are labelled and never used to classify a change.

Source commit
b3045439b7c0
Source last updated
Oct 21, 2026
Last synchronized
Oct 21, 2026
Publication status
published
Publication history
  • Oct 21, 2026, 8:31 PM: new → published (ingestion) — Backed by an official breaking-change/migration guide.
AI explanationAI-generated · grounded in cited sources
AI explanations are not configured
Set AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.
Was this useful?