Skip to content

Commit 27cea68

Browse files
7576457FeodorFitsner
authored andcommitted
fix: apply default Tooltip decoration values (#5575)
1 parent 833c67c commit 27cea68

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

packages/flet/lib/src/utils/box.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ BoxDecoration? parseBoxDecoration(dynamic value, BuildContext context,
5959

6060
var shape = parseBoxShape(value["shape"], BoxShape.rectangle)!;
6161
var borderRadius = parseBorderRadius(value["border_radius"]);
62-
var color = parseColor(value["color"], theme);
62+
var color = parseColor(value["bgcolor"], theme);
6363
var gradient = parseGradient(value["gradient"], theme);
6464
var blendMode = parseBlendMode(value["blend_mode"]);
6565

packages/flet/lib/src/utils/tooltip.dart

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,25 @@ Tooltip? parseTooltip(dynamic value, BuildContext context, Widget widget) {
3232

3333
/// The tooltip shape defaults to a rounded rectangle with a border radius of
3434
/// 4.0. Tooltips will also default to an opacity of 90%
35+
var defaultDecoration = BoxDecoration(
36+
borderRadius: BorderRadius.circular(4.0),
37+
color: parseColor(
38+
value["bgcolor"],
39+
theme,
40+
theme.brightness == Brightness.light
41+
? Colors.grey[700]
42+
: Colors.white));
3543
var decoration = parseBoxDecoration(value["decoration"], context);
36-
decoration?.copyWith(
37-
color: parseColor(
38-
value["bgcolor"],
39-
theme,
40-
theme.brightness == Brightness.light
41-
? Colors.grey[700]
42-
: Colors.white)!);
44+
var finalDecoration = defaultDecoration.copyWith(
45+
color: decoration?.color,
46+
borderRadius: decoration?.borderRadius,
47+
border: decoration?.border,
48+
boxShadow: decoration?.boxShadow,
49+
gradient: decoration?.gradient,
50+
image: decoration?.image,
51+
shape: decoration?.shape,
52+
backgroundBlendMode: decoration?.backgroundBlendMode,
53+
);
4354
return Tooltip(
4455
message: value["message"],
4556
enableFeedback: parseBool(value["enable_feedback"]),
@@ -49,7 +60,7 @@ Tooltip? parseTooltip(dynamic value, BuildContext context, Widget widget) {
4960
exitDuration: parseDuration(value["exit_duration"]),
5061
preferBelow: parseBool(value["prefer_below"]),
5162
padding: parseEdgeInsets(value["padding"]),
52-
decoration: decoration,
63+
decoration: finalDecoration,
5364
textStyle: parseTextStyle(value["text_style"], theme),
5465
verticalOffset: parseDouble(value["vertical_offset"]),
5566
margin: parseEdgeInsets(value["margin"]),

0 commit comments

Comments
 (0)