Better integration of filter button

This commit is contained in:
Pierre HUBERT 2022-03-24 14:55:41 +01:00
parent a29e9dcfff
commit d7b63b754f
2 changed files with 15 additions and 2 deletions

View File

@ -43,7 +43,7 @@ class _MusicPlayerState extends State<MusicPlayer> {
final List<MusicEntry> _stack = []; final List<MusicEntry> _stack = [];
int currMusicPos = 0; int currMusicPos = 0;
var _showPlaylist = true; var _showPlaylist = false;
final _filterController = fluent.TextEditingController(); final _filterController = fluent.TextEditingController();
MusicsList? _filteredList; MusicsList? _filteredList;
@ -130,6 +130,11 @@ class _MusicPlayerState extends State<MusicPlayer> {
}); });
} }
void _clearFilter() {
_filterController.text = "";
_refreshFilteredList();
}
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
@ -285,6 +290,12 @@ class _MusicPlayerState extends State<MusicPlayer> {
controller: _filterController, controller: _filterController,
placeholder: "Filter list...", placeholder: "Filter list...",
onChanged: (s) => _refreshFilteredList(), onChanged: (s) => _refreshFilteredList(),
suffix: _filterController.text.isEmpty
? null
: fluent.IconButton(
icon: const Icon(fluent.FluentIcons.clear),
onPressed: _clearFilter,
),
), ),
Flexible( Flexible(
child: ListView.builder( child: ListView.builder(

View File

@ -22,7 +22,9 @@ class PlayerApp extends StatelessWidget {
home: fluent.FluentTheme( home: fluent.FluentTheme(
child: const AppHome(), child: const AppHome(),
data: fluent.ThemeData( data: fluent.ThemeData(
iconTheme: const IconThemeData(color: Colors.white)), iconTheme: const IconThemeData(color: Colors.white),
brightness: fluent.Brightness.dark,
),
), ),
); );
} }