Skip to content

Commit

Permalink
Update drawing in the right side
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Aug 15, 2023
1 parent 6a8efef commit 1021bba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* fix: `RoundedBackgroundTextField` automatic line break is respected
* fix: `RoundedBackgroundText.selectable` text is no longer duplicated
* fix: outerRadius is correctly calculated when normalizing the lines
* fix: update painting cases on the right side

## 0.4.2

Expand Down
1 change: 0 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ class _MyAppState extends State<MyApp> {
case _HighlightTextType.text:
return RoundedBackgroundText(
'''Rounded Background Text Showcase
It handles well all font sizes and weights, as well as text alignments
Contributions are welcome!
Done with so much <3 by @bdlukaa''',
Expand Down
44 changes: 22 additions & 22 deletions lib/src/rounded_background_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -527,31 +527,31 @@ class RoundedBackgroundTextPainter extends CustomPainter {
}

if (next != null) {
final factor = info.fullWidth - next.fullWidth;

if (info == lastInfo) {
if (info == previous) {
// if it's the last line
drawBottomRightCorner(info);
}
if (info.fullWidth > next.fullWidth) {
// If the factor is greater than the outer radius, draw the inner corner.
// Otherwise draw only the top right corner
if (factor >= innerRadius) {
drawTopRightCorner(info);
drawInnerCorner(next, false);
} else {
drawTopRightCorner(info, factor);
}
} else if (info.fullWidth < next.fullWidth) {
// If the factor is greater than the inner radius, draw the inner corner.
// Otherwise draw only the bottom right corner
if (factor >= innerRadius) {
drawInnerCorner(info, true);
drawBottomRightCorner(next);
} else {
drawBottomRightCorner(info);
}
} else if (info.fullWidth < previous.fullWidth) {
// if the current one is less than the previous one
drawTopRightCorner(previous);
drawInnerCorner(info, false);
// drawInnerCorner(info);
} else if (info.fullWidth > previous.fullWidth) {
// if the current one is bigger than the previous one
drawInnerCorner(previous, true);
drawBottomRightCorner(info);
} else {
// if the current one is equal to the previous one, ignore it
}
} else {
// if it's the first line
if (previous.fullWidth < info.fullWidth) {
// if the current one is bigger than the previous one
drawInnerCorner(previous);
drawBottomRightCorner(info);
} else if (previous.fullWidth > info.fullWidth) {
drawTopRightCorner(previous);
drawInnerCorner(info, false);
}
drawTopRightCorner(info);
}

Expand Down

0 comments on commit 1021bba

Please sign in to comment.