Skip to content

[DataTable]: DataTableRow hover flickers when moving the cursor along the row #166135

Closed
flutter/packages
#13523

Description

@KonstantinDubrouski

Steps to reproduce

  1. Run following snippet in DartPad.
  2. Move cursor along table rows.
  3. You should see blinks of hover color.

Expected results

Row must keep hover color during cursor moving

Actual results

Hover color changes to a different one for a millisecond, causing a blink.

Code sample

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

/// Flutter code sample for [DataTable].

void main() => runApp(const DataTableExampleApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('DataTable Sample')),
        body: const DataTableExample(),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Theme(
      data: ThemeData(hoverColor: Colors.red.withOpacity(0.9)),
      child: DataTable(
        columns: const <DataColumn>[
          DataColumn(
            label: Expanded(
              child: Text(
                'Name',
                style: TextStyle(fontStyle: FontStyle.italic),
              ),
            ),
          ),
          DataColumn(
            label: Expanded(
              child: Text('Age', style: TextStyle(fontStyle: FontStyle.italic)),
            ),
          ),
          DataColumn(
            label: Expanded(
              child: Text(
                'Role',
                style: TextStyle(fontStyle: FontStyle.italic),
              ),
            ),
          ),
        ],
        rows: <DataRow>[
          DataRow(
            onSelectChanged: (value) {},
            cells: <DataCell>[
              DataCell(Text('Sarah')),
              DataCell(Text('19')),
              DataCell(Text('Student')),
            ],
          ),
          DataRow(
            onSelectChanged: (value) {},
            cells: <DataCell>[
              DataCell(Text('Janine')),
              DataCell(Text('43')),
              DataCell(Text('Professor')),
            ],
          ),
          DataRow(
            onSelectChanged: (value) {},
            cells: <DataCell>[
              DataCell(Text('William')),
              DataCell(Text('27')),
              DataCell(Text('Associate Professor')),
            ],
          ),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Screen.Recording.2025-03-28.at.15.47.29.mov

Logs

Logs
flutter run

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.2 24D81 darwin-x64, locale en-GB) [1,276ms]
    • Flutter version 3.29.0 on channel stable at /Users/user/development/fluttersdk
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (7 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [4.3s]
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [4.3s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [33ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [32ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)

[✓] VS Code (version 1.98.1) [30ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.106.0

[✓] Connected device (2 available) [7.7s]
    • macOS (desktop) • macos  • darwin-x64     • macOS 15.3.2 24D81 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 134.0.6998.166

[✓] Network resources [844ms]
    • All expected network resources are available.

Activity

  1. added
    in triage
    on Mar 28, 2025
  2. maheshj01 commented on Mar 28, 2025

    @maheshj01
    Member

    Reproducible on latest stable and the master channel.

    Screen.Recording.2025-03-28.at.19.40.40.mov
    flutter doctor -v

    master

    [✓] Flutter (Channel master, 3.31.0-1.0.pre.291, on macOS 15.1.1 24B2091 darwin-arm64, locale en-US) [1,947ms]
        • Flutter version 3.31.0-1.0.pre.291 on channel master at /Users/mahesh/Development/flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 479c4bb224 (39 minutes ago), 2025-03-27 14:44:17 -0400
        • Engine revision 479c4bb224
        • Dart version 3.8.0 (build 3.8.0-231.0.dev)
        • DevTools version 2.45.0-dev.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.1s]
        • Android SDK at /Users/mahesh/Library/Android/sdk
        • Platform android-35, build-tools 35.0.0
        • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.0) [1,500ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16A242d
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [134ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2024.3) [134ms]
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.2.1) [132ms]
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 61.2.4
        • Dart plugin version 212.5080.8
    
    [✓] VS Code (version 1.96.2) [19ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.102.0
    
    [✓] Connected device (3 available) [6.8s]
        • iPad Pro 11-inch (M4) (mobile) • A97192B5-5CFD-4164-BF2A-A6E2972614FF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-0
          (simulator)
        • macOS (desktop)                • macos                                • darwin-arm64   • macOS 15.1.1 24B2091 darwin-arm64
        • Chrome (web)                   • chrome                               • web-javascript • Google Chrome 131.0.6778.265
    
    [✓] Network resources [317ms]
        • All expected network resources are available.
    
    • No issues found!

    stable

    [✓] Flutter (Channel stable, 3.29.2, on macOS 15.1.1 24B2091 darwin-arm64, locale en-US) [822ms]
        • Flutter version 3.29.2 on channel stable at /Users/mahesh/Development/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision c236373904 (2 weeks ago), 2025-03-13 16:17:06 -0400
        • Engine revision 18b71d647a
        • Dart version 3.7.2
        • DevTools version 2.42.3
    [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [3.2s]
        • Android SDK at /Users/mahesh/Library/Android/sdk
        • Platform android-35, build-tools 35.0.0
        • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.0) [3.1s]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16A242d
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [136ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2024.3) [135ms]
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.2.1) [134ms]
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin version 61.2.4
        • Dart plugin version 212.5080.8
    
    [✓] VS Code (version 1.96.2) [18ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.102.0
    
    [✓] Connected device (4 available) [6.7s]
        • iPad Pro 11-inch (M4) (mobile)  • A97192B5-5CFD-4164-BF2A-A6E2972614FF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-0
          (simulator)
        • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 15.1.1 24B2091 darwin-arm64
        • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 15.1.1 24B2091 darwin-arm64
        • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 131.0.6778.265
    
    [✓] Network resources [294ms]
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
  3. added
    has reproducible steps
    found in release: 3.29
    found in release: 3.31
    framework
    p: material_ui
    team-design
    and removed
    in triage
    on Mar 28, 2025
  4. changed the title [-]Bug in DataTable widget: DataTableRow loses hover state when moving the cursor along it.[/-] [+][DataTable]: DataTableRow hover flickers when moving the cursor along the row[/+] on Mar 28, 2025
  5. dkwingsmt commented on Apr 2, 2025

    @dkwingsmt
    Contributor

    Seems to me that the cursor hovered on the (invisible) column divider, which doesn't react to hover events.

  6. added
    fyi-design
    P2
    on Apr 2, 2025
  7. removed
    fyi-design
    on Apr 2, 2025
  8. flutter-triage-bot commented on Apr 2, 2025

    @flutter-triage-bot

    The fyi-design label is redundant with the team-design label.

  9. added
    triaged-design
    on Apr 2, 2025
  10. Tosemite commented on Apr 4, 2025

    @Tosemite
    Contributor

    Hello!

    It seems that issue is caused by an unusual logic behind RenderTable, TableRowInkWell and underlying MouseRegion.
    InkResponse.getRectCallback is used to redefine Rect region for pressed, hover, focus state colors. Hover action, however, is defined by MouseRegion widget that does not get the same Rect and instead uses default boundaries of TableRowInkWell, which are broken by column dividers.

    I would assume that some work needs to be done in either of those widgets, though have no idea how to do it without introducing new features, such as simillar getRectCallback for MouseRegion.

    I would like to take this issue, but want to hear other opinions on solution first!

  11. added
    package
    and removed
    framework
    on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2found in release: 3.29found in release: 3.31has reproducible stepsp: material_uipackageteam-designtriaged-design

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions