Add sortIconBuilder to DataTable, PaginatedDataTable, and DataTableThemeData - #188729
Add sortIconBuilder to DataTable, PaginatedDataTable, and DataTableThemeData#188729puneetkukreja98 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a sortIconWidget property to DataTable and its internal _SortArrow widget, allowing developers to customize the sorting indicator icon in the table's header cells. It also adds corresponding tests to verify the behavior of the custom icon widget under different configurations. The reviewer suggests updating the documentation of sortIconWidget to clarify that custom widgets will undergo default animations and offsets, and recommends exposing this property in PaginatedDataTable for consistency.
Piinks
left a comment
There was a problem hiding this comment.
Once we settle on an API here, we should consider not only applying this to DataTable but also DataTableThemeData and PaginatedDataTable. :)
|
Hi @Piinks, I have updated the PR as requested. Summary of Updates:
This PR is ready for your re-review. Thank you! |
a83ce7f to
f85c882
Compare
282d6a0 to
9804fe7
Compare
|
Hi @Piinks, I've pushed the latest updates. Please take a look when you get a chance. Thanks! |
|
This PR is now ready to move over to flutter/packages! See #188444 for guidance and git commands to help move the PR over. Thank you! |
|
@Piinks I've ported the changes to flutter/packages#12645. Please take a look. |
Description
This PR introduces a
sortIconBuildercallback parameter toDataTable,PaginatedDataTable, andDataTableThemeDatato allow full customization of the column sorting indicator icon and its visibility/orientation states.Key Changes
DataTableSortIconBuilderTypedef: Addedtypedef DataTableSortIconBuilder = Widget Function(BuildContext context, bool visible, bool ascending);.DataTable: AddedsortIconBuilderproperty toDataTable. When provided, it overrides the default_SortArrowwidget in table header cells.PaginatedDataTable: AddedsortIconBuilderproperty and forwarded it down to the underlyingDataTable.DataTableThemeData: AddedsortIconBuilderproperty to allow setting a default custom sort icon builder globally across the app's theme. Theme fallback chain:DataTable.sortIconBuilder->DataTableThemeData.sortIconBuilder-> default_SortArrow.Fixes #91801
Usage Example
Working screen-shot:
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.