@@ -62,14 +62,6 @@ class DataGrid extends StatefulWidget
62
62
'DataColumns' : (List cols) {
63
63
this .cols = cols;
64
64
},
65
- 'headingTextStyle' : (Map styles) {
66
- controller.headingTextController = TextController ();
67
- TextUtils .setStyles (styles, controller.headingTextController! );
68
- },
69
- 'dataTextStyle' : (Map styles) {
70
- controller.dataTextController = TextController ();
71
- TextUtils .setStyles (styles, controller.dataTextController! );
72
- },
73
65
'horizontalMargin' : (val) =>
74
66
controller.horizontalMargin = Utils .optionalDouble (val),
75
67
'dataRowHeight' : (val) =>
@@ -80,29 +72,6 @@ class DataGrid extends StatefulWidget
80
72
controller.columnSpacing = Utils .optionalDouble (val),
81
73
'dividerThickness' : (val) =>
82
74
controller.dividerThickness = Utils .optionalDouble (val),
83
- 'border' : (Map val) {
84
- Map <String , dynamic > map = {};
85
- val.forEach ((key, value) {
86
- if (value is Map ) {
87
- Color color = Utils .getColor (value['color' ]) ?? Colors .black;
88
- double width = Utils .getDouble (value['width' ], fallback: 1.0 );
89
- map[key] = BorderSide (color: color, width: width);
90
- } else if (key == 'borderRadius' ) {
91
- double ? radius = Utils .optionalDouble (value);
92
- map[key] = (radius == null )
93
- ? BorderRadius .zero
94
- : BorderRadius .circular (radius);
95
- }
96
- });
97
- controller.border = TableBorder (
98
- top: map['top' ] ?? BorderSide .none,
99
- right: map['right' ] ?? BorderSide .none,
100
- bottom: map['bottom' ] ?? BorderSide .none,
101
- left: map['left' ] ?? BorderSide .none,
102
- horizontalInside: map['horizontalInside' ] ?? BorderSide .none,
103
- verticalInside: map['verticalInside' ] ?? BorderSide .none,
104
- borderRadius: map['borderRadius' ] ?? BorderRadius .zero);
105
- },
106
75
};
107
76
}
108
77
}
@@ -173,7 +142,7 @@ class EnsembleDataRowState extends State<EnsembleDataRow> {
173
142
}
174
143
}
175
144
176
- class DataGridController extends WidgetController {
145
+ class DataGridController extends BoxController {
177
146
List <Widget >? children;
178
147
double ? horizontalMargin;
179
148
TextController ? headingTextController;
@@ -182,7 +151,22 @@ class DataGridController extends WidgetController {
182
151
double ? columnSpacing;
183
152
TextController ? dataTextController;
184
153
double ? dividerThickness;
185
- TableBorder border = const TableBorder ();
154
+
155
+ @override
156
+ Map <String , Function > getBaseSetters () {
157
+ Map <String , Function > setters = super .getBaseSetters ();
158
+ setters.addAll ({
159
+ 'headingText' : (Map styles) {
160
+ headingTextController = TextController ();
161
+ TextUtils .setStyles (styles, headingTextController! );
162
+ },
163
+ 'dataText' : (Map styles) {
164
+ dataTextController = TextController ();
165
+ TextUtils .setStyles (styles, dataTextController! );
166
+ },
167
+ });
168
+ return setters;
169
+ }
186
170
}
187
171
188
172
class DataGridState extends WidgetState <DataGrid > with TemplatedWidgetState {
@@ -317,7 +301,12 @@ class DataGridState extends WidgetState<DataGrid> with TemplatedWidgetState {
317
301
dataTextStyle: dataTextStyle,
318
302
columnSpacing: widget.controller.columnSpacing,
319
303
dividerThickness: widget.controller.dividerThickness,
320
- border: widget.controller.border,
304
+ border: TableBorder .all (
305
+ color: widget.controller.borderColor ?? Colors .black,
306
+ width: widget.controller.borderWidth? .toDouble () ?? 1.0 ,
307
+ borderRadius:
308
+ widget.controller.borderRadius? .getValue () ?? BorderRadius .zero,
309
+ ),
321
310
);
322
311
return SingleChildScrollView (
323
312
scrollDirection: Axis .vertical,
0 commit comments