mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00

* feat: add riverpod based favorite album provider * feat: add album is saved, new releases and tracks providers * feat: add artist related providers * feat: add all categories providers * feat: add lyrics provider * feat: add playlist related providers * feat: add search provider * feat: add view and spotify friends provider * feat: add playlist create and update and favorite handlers * feat: use providers in home screen * chore: fix dart lint issues * feat: use new providers for playlist and albums screen * feat: use providers in artist page * feat: use providers on library page * feat: use provider for playlist and album card and heart button * feat: use provider in search page * feat: use providers in generate playlist * feat: use provider in lyrics screen * feat: use provider for create playlist * feat: use provider in add track dialog * feat: use providers in remaining pages and remove fl_query * fix: remove direct access to provider.value * fix: glitching when loading * fix: user album loading next page indicator * feat: make many provider autoDispose after 5 minutes of no usage * fix: ignore episodes in tracks
93 lines
2.6 KiB
Dart
93 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:spotube/collections/spotube_icons.dart';
|
|
import 'package:spotube/extensions/context.dart';
|
|
|
|
class ExpandableSearchField extends StatelessWidget {
|
|
final bool isFiltering;
|
|
final ValueChanged<bool> onChangeFiltering;
|
|
final TextEditingController searchController;
|
|
final FocusNode searchFocus;
|
|
|
|
const ExpandableSearchField({
|
|
super.key,
|
|
required this.isFiltering,
|
|
required this.onChangeFiltering,
|
|
required this.searchController,
|
|
required this.searchFocus,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AnimatedOpacity(
|
|
duration: const Duration(milliseconds: 200),
|
|
opacity: isFiltering ? 1 : 0,
|
|
child: AnimatedSize(
|
|
duration: const Duration(milliseconds: 200),
|
|
child: SizedBox(
|
|
height: isFiltering ? 50 : 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
child: CallbackShortcuts(
|
|
bindings: {
|
|
LogicalKeySet(LogicalKeyboardKey.escape): () {
|
|
onChangeFiltering(false);
|
|
searchController.clear();
|
|
searchFocus.unfocus();
|
|
}
|
|
},
|
|
child: TextField(
|
|
focusNode: searchFocus,
|
|
controller: searchController,
|
|
decoration: InputDecoration(
|
|
hintText: context.l10n.search_tracks,
|
|
isDense: true,
|
|
prefixIcon: const Icon(SpotubeIcons.search),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ExpandableSearchButton extends StatelessWidget {
|
|
final bool isFiltering;
|
|
final FocusNode searchFocus;
|
|
final Widget icon;
|
|
final ValueChanged<bool>? onPressed;
|
|
|
|
const ExpandableSearchButton({
|
|
super.key,
|
|
required this.isFiltering,
|
|
required this.searchFocus,
|
|
this.icon = const Icon(SpotubeIcons.filter),
|
|
this.onPressed,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
|
|
return IconButton(
|
|
icon: icon,
|
|
style: IconButton.styleFrom(
|
|
backgroundColor:
|
|
isFiltering ? theme.colorScheme.secondaryContainer : null,
|
|
foregroundColor: isFiltering ? theme.colorScheme.secondary : null,
|
|
minimumSize: const Size(25, 25),
|
|
),
|
|
onPressed: () {
|
|
if (isFiltering) {
|
|
searchFocus.requestFocus();
|
|
} else {
|
|
searchFocus.unfocus();
|
|
}
|
|
onPressed?.call(!isFiltering);
|
|
},
|
|
);
|
|
}
|
|
}
|