Skip to content

PaginatedDataTable widget ignoring dataTableTheme's dataRowMinHeight and dataRowMaxHeight #133633

@MarkOSullivan94

Description

@MarkOSullivan94

Is there an existing issue for this?

Steps to reproduce

  1. Create new Flutter project
  2. Add Theme to your MaterialApp widget and ensure the theme includes configuration for dataTableTheme and within that configuration have assigned a value to dataRowMinHeight and dataRowMaxHeight
  3. Add a PaginatedDataTable
  4. The dataRowMinHeight and dataRowMaxHeight values from your theme will have been ignored

Expected results

The PaginatedDataTable will respect and adhere to the values assigned to the app theme's dataTableTheme.

Actual results

Instead of making use of the theme values, it is using the value of kMinInteractiveDimension instead.

Code sample

Code sample
import 'dart:math';

import 'package:flutter/material.dart';

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Bug Report',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        dataTableTheme: const DataTableThemeData(
          dataRowMinHeight: 70.0,
          dataRowMaxHeight: 80.0,
        ),
        useMaterial3: true,
      ),
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: PaginatedDataTable(
              // dataRowMinHeight: 70.0,
              // dataRowMaxHeight: 80.0,
              source: MyDataSource(),
              header: Text('Table 1'),
              rowsPerPage: 5,
              columns: const [
                DataColumn(label: Flexible(child: Text('ID'))),
                DataColumn(label: Flexible(child: Text('Title'))),
                DataColumn(label: Flexible(child: Text('Cost'))),
              ],
            ),
          ),
        ), // This trailing comma makes auto-formatting nicer for build methods.
      ),
    );
  }
}

class MyDataSource extends DataTableSource {
  final List<Map<String, dynamic>> _data = List.generate(
    200,
    (index) {
      return {
        "id": '$index',
        "title": "Item $index",
        "cost": '${Random().nextInt(10000)}',
      };
    },
  );

  @override
  DataRow? getRow(int index) {
    final data = _data[index];
    return DataRow(
      cells: [
        DataCell(Text(data['id'])),
        DataCell(Text(data['title'])),
        DataCell(Text(data['cost'])),
      ],
    );
  }

  @override
  bool get isRowCountApproximate => false;

  @override
  int get rowCount => _data.length;

  @override
  int get selectedRowCount => 0;
}

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.0, on macOS 13.5.1 22G90 darwin-arm64, locale en-GB)
    • Flutter version 3.13.0 on channel stable at /Users/mos/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (2 weeks ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/mos/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Users/mos/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 13.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F17a
    ✗ Flutter requires Xcode 14 or higher.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/mos/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 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/mos/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 75.1.4
    • Dart plugin version 232.8660.129

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.70.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.5.1 22G90 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 116.0.5845.110

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

! Doctor found issues in 1 category.

Metadata

Metadata

Labels

P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions