Skip to content

Commit 51e427e

Browse files
committed
refactor: use new search for filter text field
1 parent 9d14517 commit 51e427e

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

lib/components/library/user_albums.dart

+3-5
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ class UserAlbums extends HookConsumerWidget {
6262
child: Column(
6363
crossAxisAlignment: CrossAxisAlignment.start,
6464
children: [
65-
TextField(
65+
SearchBar(
6666
onChanged: (value) => searchText.value = value,
67-
decoration: InputDecoration(
68-
prefixIcon: const Icon(SpotubeIcons.filter),
69-
hintText: context.l10n.filter_albums,
70-
),
67+
leading: const Icon(SpotubeIcons.filter),
68+
hintText: context.l10n.filter_albums,
7169
),
7270
const SizedBox(height: 20),
7371
AnimatedCrossFade(

lib/components/library/user_artists.dart

+3-5
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ class UserArtists extends HookConsumerWidget {
5353
padding: const EdgeInsets.symmetric(horizontal: 8.0),
5454
child: ColoredBox(
5555
color: theme.scaffoldBackgroundColor,
56-
child: TextField(
56+
child: SearchBar(
5757
onChanged: (value) => searchText.value = value,
58-
decoration: InputDecoration(
59-
prefixIcon: const Icon(SpotubeIcons.filter),
60-
hintText: context.l10n.filter_artist,
61-
),
58+
leading: const Icon(SpotubeIcons.filter),
59+
hintText: context.l10n.filter_artist,
6260
),
6361
),
6462
),

lib/components/library/user_playlists.dart

+3-5
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,10 @@ class UserPlaylists extends HookConsumerWidget {
7777
children: [
7878
Padding(
7979
padding: const EdgeInsets.all(10),
80-
child: TextField(
80+
child: SearchBar(
8181
onChanged: (value) => searchText.value = value,
82-
decoration: InputDecoration(
83-
hintText: context.l10n.filter_playlists,
84-
prefixIcon: const Icon(SpotubeIcons.filter),
85-
),
82+
hintText: context.l10n.filter_playlists,
83+
leading: const Icon(SpotubeIcons.filter),
8684
),
8785
),
8886
AnimatedCrossFade(

lib/themes/theme.dart

+16
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,21 @@ ThemeData theme(Color seed, Brightness brightness) {
4949
contentTextStyle: TextStyle(color: scheme.surface),
5050
),
5151
sliderTheme: SliderThemeData(overlayShape: SliderComponentShape.noOverlay),
52+
searchBarTheme: SearchBarThemeData(
53+
constraints: const BoxConstraints(maxWidth: double.infinity),
54+
backgroundColor: MaterialStatePropertyAll(
55+
Color.lerp(
56+
scheme.surfaceVariant,
57+
scheme.surface,
58+
brightness == Brightness.light ? .9 : .7,
59+
),
60+
),
61+
elevation: const MaterialStatePropertyAll(0),
62+
shape: MaterialStatePropertyAll(
63+
RoundedRectangleBorder(
64+
borderRadius: BorderRadius.circular(10),
65+
),
66+
),
67+
),
5268
);
5369
}

0 commit comments

Comments
 (0)