mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
fixes [[`DataTable`] Unable to center the label of a DataColumn without side effects](https://github.com/flutter/flutter/issues/143340) ### Code sample <details> <summary>expand to view the code sample</summary> ```dart 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( debugShowCheckedModeBanner: false, home: MaterialApp( home: Material( child: DataTable( columns: <DataColumn>[ DataColumn( headingRowAlignment: MainAxisAlignment.center, onSort: (int columnIndex, bool ascending) {}, label: const Text('Header'), ), ], sortColumnIndex: 0, rows: const <DataRow>[ DataRow( cells: <DataCell>[ DataCell(Center(child: Text('Data'))), ], ), ], ), ), ), ); } } ``` </details> ### Center `DataColumn.mainAxisAlignment` without sort arrow  ### Center `DataColumn.mainAxisAlignment` with sort arrow 