Skip to content

Commit f6a794a

Browse files
CharlVSsmk762
authored andcommitted
fix(ui): align fade color with theme (#2992)
1 parent 3f3fa9a commit f6a794a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

lib/shared/ui/fading_edge_scroll_view.dart

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,10 @@ class _FadingEdgeScrollViewState extends State<FadingEdgeScrollView>
302302
1,
303303
],
304304
colors: _getColors(
305-
widget.gradientFractionOnStart > 0 && !(_isScrolledToStart ?? true),
306-
widget.gradientFractionOnEnd > 0 && !(_isScrolledToEnd ?? false)),
305+
context,
306+
widget.gradientFractionOnStart > 0 && !(_isScrolledToStart ?? true),
307+
widget.gradientFractionOnEnd > 0 && !(_isScrolledToEnd ?? false),
308+
),
307309
).createShader(
308310
bounds.shift(Offset(-bounds.left, -bounds.top)),
309311
textDirection: Directionality.of(context),
@@ -335,12 +337,16 @@ class _FadingEdgeScrollViewState extends State<FadingEdgeScrollView>
335337
? AlignmentDirectional.centerStart
336338
: AlignmentDirectional.centerEnd;
337339

338-
List<Color> _getColors(bool isStartEnabled, bool isEndEnabled) => [
339-
(isStartEnabled ? Colors.transparent : Colors.white),
340-
Colors.white,
341-
Colors.white,
342-
(isEndEnabled ? Colors.transparent : Colors.white)
343-
];
340+
List<Color> _getColors(
341+
BuildContext context, bool isStartEnabled, bool isEndEnabled) {
342+
final fadeColor = Theme.of(context).scaffoldBackgroundColor;
343+
return [
344+
if (isStartEnabled) Colors.transparent else fadeColor,
345+
fadeColor,
346+
fadeColor,
347+
if (isEndEnabled) Colors.transparent else fadeColor,
348+
];
349+
}
344350
}
345351

346352
extension _Let<T> on T {

0 commit comments

Comments
 (0)