@@ -29,60 +29,50 @@ class TableHeader<T> extends StatelessWidget {
2929 TableRow (
3030 children: [
3131 const SizedBox .shrink (),
32- ...colDefs.asMap ().keys.map ((labelIndex) {
33- final colDef = colDefs[labelIndex];
32+ ...colDefs.mapIndexedAndLast ((index, colDef, _) {
3433 final bool isOrderedByThisColumn =
3534 colDef.label == order? .column.label;
36- TextStyle labelStyle = MacosTheme .of (context).typography.headline;
37- if (isOrderedByThisColumn) {
38- labelStyle = labelStyle.copyWith (fontWeight: FontWeight .w600);
39- }
4035
41- Widget orderDirectionArrow = const SizedBox .shrink ();
42- if (isOrderedByThisColumn) {
43- orderDirectionArrow = CustomPaint (
44- size: const Size .square (16 ),
45- painter: _SortDirectionCaretPainter (
46- color: MemexColor .grid,
47- up: order? .direction == TableOrderDirection .ascending,
48- ),
49- );
50- }
36+ final TextStyle labelStyle = isOrderedByThisColumn
37+ ? MacosTheme .of (context)
38+ .typography
39+ .headline
40+ .copyWith (fontWeight: FontWeight .w600)
41+ : MacosTheme .of (context).typography.headline;
42+
43+ final Widget orderDirectionArrow = isOrderedByThisColumn
44+ ? CustomPaint (
45+ size: const Size .square (16 ),
46+ painter: _SortDirectionCaretPainter (
47+ color: MemexColor .grid,
48+ up: order? .direction == TableOrderDirection .ascending,
49+ ),
50+ )
51+ : const SizedBox .shrink ();
5152
5253 return GestureDetector (
5354 onTap: () {
5455 if (columnHeaderClicked != null ) {
5556 columnHeaderClicked !(colDef);
5657 }
5758 },
58- child: Padding (
59- padding: const EdgeInsets .symmetric (vertical: 5 ),
60- child: Container (
61- decoration: BoxDecoration (
62- border: Border (
63- right: (labelIndex == colDefs.length - 1 )
64- ? BorderSide .none
65- : const BorderSide (color: MemexColor .grid),
66- ),
67- ),
68- child: Padding (
69- padding: const EdgeInsets .symmetric (
70- horizontal: 10 ,
71- vertical: 3 ,
72- ),
73- child: Row (
74- children: [
75- const Spacer (),
76- Text (colDef.label, style: labelStyle),
77- const Spacer (),
78- orderDirectionArrow,
79- ],
80- ),
81- ),
82- ),
83- ),
59+ child: [
60+ const Spacer (),
61+ Text (colDef.label, style: labelStyle),
62+ const Spacer (),
63+ orderDirectionArrow,
64+ ]
65+ .toRow ()
66+ .padding (horizontal: 10 , vertical: 3 )
67+ .border (
68+ right: 1.0 ,
69+ color: (index == colDefs.length - 1 )
70+ ? MemexColor .transparent
71+ : MemexColor .grid,
72+ )
73+ .padding (vertical: 5 ),
8474 );
85- }). toList () ,
75+ }),
8676 const SizedBox .shrink (),
8777 ],
8878 decoration: const BoxDecoration (
0 commit comments