Skip to content

Cannot center dataColumn label #40526

@deadsoul44

Description

@deadsoul44

I cannot center align dataColumn label as seen in the following picture although I wrap the label in center widget.

image

When I comment the following code section in data_table.dart file, everything works as expected as in the following picture.

/*
if (onSort != null) {
  final Widget arrow = _SortArrow(
    visible: sorted,
    down: sorted ? ascending : null,
    duration: _sortArrowAnimationDuration,
  );
  const Widget arrowPadding = SizedBox(width: _sortArrowPadding);
  label = Row(
    textDirection: numeric ? TextDirection.rtl : null,
    children: <Widget>[ label, arrowPadding, arrow ],
  );
}
*/

image

I think arrow widget still takes some space although onSort is null.

See the issue also on Stack Overflow:

https://stackoverflow.com/questions/56615116/how-do-you-center-the-label-in-a-flutter-datacolumn-widget/57945257#57945257

My Flutter Doctor:

[√] Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [Version 10.0.17134.1006], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.5)
[√] Connected device (1 available)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions