Skip to content

Odd scroll behavior and occasional asserts with trackpad #149999

@tgucio

Description

@tgucio

Steps to reproduce

  1. Run flutter create and replace main.dart with the provided code sample.
  2. Run on macOS
  3. Do a scroll gesture over the ListView using the trackpad

Expected results

Smooth scroll with bouncing overscroll effect
Can reverse scroll direction without releasing double tap

Actual results

Scroll appears to jump erratically, no overscroll effect
When at viewport top, after trying to scroll up further cannot reverse scroll down by reversing the swipe direction

Current master:
master

After reverting to 529a4d2:
revert

Occasionally the following asserts are seen:

Logs
════════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 898 pos 12: 'elapsedInSeconds >= 0.0': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.yml

When the exception was thrown, this was the stack:
#2      AnimationController._tick (package:flutter/src/animation/animation_controller.dart:898:12)
#3      Ticker._tick (package:flutter/src/scheduler/ticker.dart:258:12)
#4      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1392:15)
#5      SchedulerBinding.handleBeginFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1235:11)
#6      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#7      SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:1233:17)
#8      SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:1150:5)
#9      _invoke1 (dart:ui/hooks.dart:328:13)
#10     PlatformDispatcher._beginFrame (dart:ui/platform_dispatcher.dart:397:5)
#11     _beginFrame (dart:ui/hooks.dart:272:31)
(elided 2 frames from class _AssertionError)

This exception was thrown in the context of a scheduler callback. When the scheduler callback was _registered_ (as opposed to when the exception was thrown), this was the stack:
#2      SchedulerBinding.scheduleFrameCallback (package:flutter/src/scheduler/binding.dart:606:49)
#3      Ticker.scheduleTick (package:flutter/src/scheduler/ticker.dart:274:46)
#4      Ticker.start (package:flutter/src/scheduler/ticker.dart:180:7)
#5      AnimationController._startSimulation (package:flutter/src/animation/animation_controller.dart:818:42)
#6      AnimationController._animateToInternal (package:flutter/src/animation/animation_controller.dart:689:12)
#7      AnimationController.forward (package:flutter/src/animation/animation_controller.dart:498:12)
#8      new InkHighlight (package:flutter/src/material/ink_highlight.dart:60:9)
#9      _InkResponseState.updateHighlight (package:flutter/src/material/ink_well.dart:992:29)
#10     _InkResponseState.handleHoverChange (package:flutter/src/material/ink_well.dart:1269:5)
#11     _InkResponseState.handleMouseEnter (package:flutter/src/material/ink_well.dart:1257:7)
#12     MouseTracker._handleDeviceUpdateMouseEvents (package:flutter/src/rendering/mouse_tracker.dart:423:29)
#13     MouseTracker._handleDeviceUpdate (package:flutter/src/rendering/mouse_tracker.dart:277:5)
#14     MouseTracker.updateAllDevices.<anonymous closure> (package:flutter/src/rendering/mouse_tracker.dart:373:9)
#15     MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:205:9)
#16     MouseTracker.updateAllDevices (package:flutter/src/rendering/mouse_tracker.dart:367:5)
#17     RendererBinding._scheduleMouseTrackerUpdate.<anonymous closure> (package:flutter/src/rendering/binding.dart:485:22)
#18     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1392:15)
#19     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1326:11)
#20     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1171:5)
#21     _invoke (dart:ui/hooks.dart:312:13)
#22     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:419:5)
#23     _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _FrameCallbackEntry)
════════════════════════════════════════════════════════════════════════════════

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final ScrollController _scrollController = ScrollController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('Scroll me'),
            Expanded(
              child: Scrollbar(
                controller: _scrollController,
                child: ScrollConfiguration(
                  behavior: ScrollConfiguration.of(context).copyWith(
                    scrollbars: false,
                    physics: const BouncingScrollPhysics(),
                  ),
                  child: ListView(
                    controller: _scrollController,
                    children: List<ListTile>.generate(50, (index) => ListTile(title: Text('Tile $index'), onTap: () => print('tap! $index'))),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopa: error messageError messages from the Flutter frameworkc: regressionIt was better in the past than it is nowf: scrollingViewports, list views, slivers, etc.found in release: 3.23Found to occur in 3.23frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions