refactor: use new search for filter text field

This commit is contained in:
Kingkor Roy Tirtho 2023-06-10 22:39:12 +06:00
parent 9d14517202
commit 51e427e83c
4 changed files with 25 additions and 15 deletions

View File

@ -62,12 +62,10 @@ class UserAlbums extends HookConsumerWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextField(
SearchBar(
onChanged: (value) => searchText.value = value,
decoration: InputDecoration(
prefixIcon: const Icon(SpotubeIcons.filter),
hintText: context.l10n.filter_albums,
),
leading: const Icon(SpotubeIcons.filter),
hintText: context.l10n.filter_albums,
),
const SizedBox(height: 20),
AnimatedCrossFade(

View File

@ -53,12 +53,10 @@ class UserArtists extends HookConsumerWidget {
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: ColoredBox(
color: theme.scaffoldBackgroundColor,
child: TextField(
child: SearchBar(
onChanged: (value) => searchText.value = value,
decoration: InputDecoration(
prefixIcon: const Icon(SpotubeIcons.filter),
hintText: context.l10n.filter_artist,
),
leading: const Icon(SpotubeIcons.filter),
hintText: context.l10n.filter_artist,
),
),
),

View File

@ -77,12 +77,10 @@ class UserPlaylists extends HookConsumerWidget {
children: [
Padding(
padding: const EdgeInsets.all(10),
child: TextField(
child: SearchBar(
onChanged: (value) => searchText.value = value,
decoration: InputDecoration(
hintText: context.l10n.filter_playlists,
prefixIcon: const Icon(SpotubeIcons.filter),
),
hintText: context.l10n.filter_playlists,
leading: const Icon(SpotubeIcons.filter),
),
),
AnimatedCrossFade(

View File

@ -49,5 +49,21 @@ ThemeData theme(Color seed, Brightness brightness) {
contentTextStyle: TextStyle(color: scheme.surface),
),
sliderTheme: SliderThemeData(overlayShape: SliderComponentShape.noOverlay),
searchBarTheme: SearchBarThemeData(
constraints: const BoxConstraints(maxWidth: double.infinity),
backgroundColor: MaterialStatePropertyAll(
Color.lerp(
scheme.surfaceVariant,
scheme.surface,
brightness == Brightness.light ? .9 : .7,
),
),
elevation: const MaterialStatePropertyAll(0),
shape: MaterialStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
),
);
}