Skip to content

Commit abf22df

Browse files
author
mislav
committed
Add border-radius feature for div elements
This commit introduces a new feature that allows div elements to have rounded borders. Any div can now be styled with rounded corners. Fixes Sub6Resources#1317 Closes Sub6Resources#1075
1 parent 79ec194 commit abf22df

File tree

3 files changed

+150
-101
lines changed

3 files changed

+150
-101
lines changed

lib/src/css_box_widget.dart

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,22 @@ class CssBoxWidget extends StatelessWidget {
7171
textDirection: direction,
7272
shrinkWrap: shrinkWrap,
7373
children: [
74-
Container(
75-
decoration: BoxDecoration(
76-
border: style.border,
77-
color: style.backgroundColor, //Colors the padding and content boxes
74+
ClipRRect(
75+
borderRadius: style.borderRadius ?? BorderRadius.zero,
76+
child: Container(
77+
decoration: BoxDecoration(
78+
border: style.border,
79+
color: style.backgroundColor, //Colors the padding and content boxes
80+
),
81+
width: _shouldExpandToFillBlock() ? double.infinity : null,
82+
padding: padding,
83+
child: top
84+
? child
85+
: MediaQuery(
86+
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
87+
child: child,
88+
),
7889
),
79-
width: _shouldExpandToFillBlock() ? double.infinity : null,
80-
padding: padding,
81-
child: top
82-
? child
83-
: MediaQuery(
84-
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
85-
child: child,
86-
),
8790
),
8891
if (markerBox != null) Text.rich(markerBox),
8992
],

0 commit comments

Comments
 (0)