@@ -54,8 +54,8 @@ class CollapseOnScrollActionButton extends StatefulWidget
54
54
this .collapseDuration = const Duration (milliseconds: 500 ),
55
55
this .requiredScrollOffset = 64.0 ,
56
56
this .padding = const EdgeInsets .symmetric (
57
- vertical: 8 .0 ,
58
- horizontal: 22 .0 ,
57
+ vertical: 12 .0 ,
58
+ horizontal: 24 .0 ,
59
59
),
60
60
this .blurred = true ,
61
61
required this .onPressed,
@@ -75,12 +75,8 @@ class _CollapseOnScrollActionButtonState
75
75
76
76
/// Create a animated accent color using the [_colorAnimation] .
77
77
Color get _accentColor {
78
- final int contrastingColorValue =
79
- (0xFFFFFFFF - widget.backgroundColor.value);
80
- final Color ? contrastingColor =
81
- Color .lerp (Color (contrastingColorValue), widget.backgroundColor, 0.75 );
82
- return Color .lerp (
83
- widget.backgroundColor, contrastingColor, _colorAnimation.value) ??
78
+ return Color .lerp (widget.accentColor, widget.backgroundColor,
79
+ _colorAnimation.value) ??
84
80
widget.accentColor;
85
81
}
86
82
@@ -96,6 +92,13 @@ class _CollapseOnScrollActionButtonState
96
92
return _animationOnScrollController.animationController;
97
93
}
98
94
95
+ Color get _textColor => widget.backgroundColor.applyColorByContrast (
96
+ LitColors .white,
97
+ Color .lerp (LitColors .grey500, LitColors .grey380,
98
+ 1.0 - _colorAnimation.value) ??
99
+ LitColors .grey500,
100
+ );
101
+
99
102
@override
100
103
void initState () {
101
104
_colorAnimation = AnimationController (
@@ -152,9 +155,9 @@ class _CollapseOnScrollActionButtonState
152
155
),
153
156
child: Text (
154
157
widget.label,
155
- style: LitTextStyles .sansSerif .copyWith (
156
- color: Colors .white ,
157
- fontSize: (1.0 - _scrollAnimation.value) * 15 .0 ,
158
+ style: LitSansSerifStyles .button .copyWith (
159
+ color: _textColor ,
160
+ fontSize: (1.0 - _scrollAnimation.value) * 16 .0 ,
158
161
letterSpacing: 0.75 ,
159
162
),
160
163
),
@@ -164,8 +167,8 @@ class _CollapseOnScrollActionButtonState
164
167
),
165
168
Icon (
166
169
widget.icon,
167
- color: Colors .white ,
168
- size: 15 .0 ,
170
+ color: _textColor ,
171
+ size: 16 .0 ,
169
172
),
170
173
],
171
174
),
0 commit comments