From d7b63b754f30c653845461f3479abf6655a58200 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Thu, 24 Mar 2022 14:55:41 +0100 Subject: [PATCH] Better integration of filter button --- lib/ui/music_player.dart | 13 ++++++++++++- lib/ui/player_app.dart | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/ui/music_player.dart b/lib/ui/music_player.dart index 9ae5868..fda3f13 100644 --- a/lib/ui/music_player.dart +++ b/lib/ui/music_player.dart @@ -43,7 +43,7 @@ class _MusicPlayerState extends State { final List _stack = []; int currMusicPos = 0; - var _showPlaylist = true; + var _showPlaylist = false; final _filterController = fluent.TextEditingController(); MusicsList? _filteredList; @@ -130,6 +130,11 @@ class _MusicPlayerState extends State { }); } + void _clearFilter() { + _filterController.text = ""; + _refreshFilteredList(); + } + @override void dispose() { super.dispose(); @@ -285,6 +290,12 @@ class _MusicPlayerState extends State { controller: _filterController, placeholder: "Filter list...", onChanged: (s) => _refreshFilteredList(), + suffix: _filterController.text.isEmpty + ? null + : fluent.IconButton( + icon: const Icon(fluent.FluentIcons.clear), + onPressed: _clearFilter, + ), ), Flexible( child: ListView.builder( diff --git a/lib/ui/player_app.dart b/lib/ui/player_app.dart index a6d6602..dd083f5 100644 --- a/lib/ui/player_app.dart +++ b/lib/ui/player_app.dart @@ -22,7 +22,9 @@ class PlayerApp extends StatelessWidget { home: fluent.FluentTheme( child: const AppHome(), data: fluent.ThemeData( - iconTheme: const IconThemeData(color: Colors.white)), + iconTheme: const IconThemeData(color: Colors.white), + brightness: fluent.Brightness.dark, + ), ), ); }