Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit d563aca

Browse files
committed
changing background color conditions
1 parent a030601 commit d563aca

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MyApp extends StatelessWidget {
1313
return MaterialApp(
1414
title: 'Example',
1515
theme: ThemeData(
16-
primarySwatch: Colors.blue,
16+
primarySwatch: Colors.blue
1717
),
1818
home: SafeArea(
1919
child: Scaffold(

lib/widgets/filterable_list.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@ class FilterableList extends StatelessWidget {
5050

5151
@override
5252
Widget build(BuildContext context) {
53+
final ThemeData theme = Theme.of(context);
54+
final ScaffoldState? scaffold = Scaffold.maybeOf(context);
55+
56+
Color _suggestionBackgroundColor = suggestionBackgroundColor ?? scaffold?.widget.backgroundColor ?? theme.scaffoldBackgroundColor;
57+
5358
return Material(
5459
elevation: 5,
5560
borderRadius: BorderRadius.circular(5),
56-
color: suggestionBackgroundColor ?? Colors.white,
61+
color: _suggestionBackgroundColor,
5762
child: Container(
5863
constraints: BoxConstraints(
5964
maxHeight: maxListHeight

0 commit comments

Comments
 (0)