Skip to content

Commit 16ac630

Browse files
Merge branch 'dev' into dv/dynamic-view-loader
2 parents 3cf4573 + 7426f8b commit 16ac630

File tree

5 files changed

+431
-23
lines changed

5 files changed

+431
-23
lines changed
Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:freezed_annotation/freezed_annotation.dart';
3+
import 'package:stac/src/parsers/widgets/stac_border_side/stac_border_side.dart';
34
import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart';
45
import 'package:stac/src/utils/color_utils.dart';
56

@@ -9,10 +10,16 @@ part 'stac_border.g.dart';
910
@freezed
1011
abstract class StacBorder with _$StacBorder {
1112
const factory StacBorder({
13+
// Uniform border properties (applies to all sides)
1214
String? color,
1315
@Default(BorderStyle.solid) BorderStyle borderStyle,
1416
@Default(StacDouble(1.0)) StacDouble width,
1517
@Default(StacDouble(BorderSide.strokeAlignInside)) StacDouble strokeAlign,
18+
// Individual border sides
19+
StacBorderSide? top,
20+
StacBorderSide? right,
21+
StacBorderSide? bottom,
22+
StacBorderSide? left,
1623
}) = _StacBorder;
1724

1825
factory StacBorder.fromJson(Map<String, dynamic> json) =>
@@ -21,11 +28,26 @@ abstract class StacBorder with _$StacBorder {
2128

2229
extension StacBorderParser on StacBorder {
2330
Border parse(BuildContext context) {
24-
return Border.all(
25-
color: color.toColor(context) ?? const Color(0xFF000000),
26-
width: width.parse,
27-
style: borderStyle,
28-
strokeAlign: strokeAlign.parse,
29-
);
31+
// Check if individual border sides are specified
32+
final hasIndividualSides =
33+
top != null || right != null || bottom != null || left != null;
34+
35+
if (hasIndividualSides) {
36+
// Use individual border sides
37+
return Border(
38+
top: top.parse(context),
39+
right: right.parse(context),
40+
bottom: bottom.parse(context),
41+
left: left.parse(context),
42+
);
43+
} else {
44+
// Fall back to uniform border behavior for all sides
45+
return Border.all(
46+
color: color.toColor(context) ?? const Color(0xFF000000),
47+
width: width.parse,
48+
style: borderStyle,
49+
strokeAlign: strokeAlign.parse,
50+
);
51+
}
3052
}
3153
}

packages/stac/lib/src/parsers/widgets/stac_border/stac_border.freezed.dart

Lines changed: 213 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)