Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed border styling of data grid view #511

Merged
merged 7 commits into from
May 19, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions lib/layout/data_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,18 @@ class DataGrid extends StatefulWidget
'dividerThickness': (val) =>
controller.dividerThickness = Utils.optionalDouble(val),
'border': (Map val) {
Copy link
Contributor

@vusters vusters May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everywhere else we use borderRadius/borderWidth/borderColor. Can we make this consistent with that? borderRadius is commonly used but not borderWidth/borderColor, so put it in side another map is not ideal. Also nested style does not support binding currently.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure you use Utils's classes. Don't parse common properties yourself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everywhere else we use borderRadius/borderWidth/borderColor. Can we make this consistent with that? borderRadius is commonly used but not borderWidth/borderColor, so put it in side another map is not ideal. Also nested style does not support binding currently.

Okay sure, I'll update it

Map<String, dynamic> map = {};
val.forEach((key, value) {
if (value is Map) {
Color color = Utils.getColor(value['color']) ?? Colors.black;
double width = Utils.getDouble(value['width'], fallback: 1.0);
map[key] = BorderSide(color: color, width: width);
} else if (key == 'borderRadius') {
double? radius = Utils.optionalDouble(value);
map[key] = (radius == null)
? BorderRadius.zero
: BorderRadius.circular(radius);
if (val.isNotEmpty) {
BorderRadius borderRadius = BorderRadius.zero;
if (val['borderRadius'] != null) {
borderRadius = BorderRadius.circular(
Utils.getDouble(val['borderRadius'], fallback: 0.0));
}
});
controller.border = TableBorder(
top: map['top'] ?? BorderSide.none,
right: map['right'] ?? BorderSide.none,
bottom: map['bottom'] ?? BorderSide.none,
left: map['left'] ?? BorderSide.none,
horizontalInside: map['horizontalInside'] ?? BorderSide.none,
verticalInside: map['verticalInside'] ?? BorderSide.none,
borderRadius: map['borderRadius'] ?? BorderRadius.zero);
controller.border = TableBorder.all(
width: Utils.getDouble(val['width'], fallback: 1.0),
color: Utils.getColor(val['color']) ?? const Color(0xFF000000),
borderRadius: borderRadius,
);
}
},
};
}
Expand Down