diff --git a/lib/providers/home.dart b/lib/providers/home.dart index 2c73855..5fabdc6 100644 --- a/lib/providers/home.dart +++ b/lib/providers/home.dart @@ -83,7 +83,7 @@ class HomeProvider with ChangeNotifier { if (track.id == null) { final secondMatch = track.artiste == '' ? track.album : track.artiste; final resultUrl = await yt.search - .search(track.title + ' ' + secondMatch!, filter: TypeFilters.video); + .search('${track.title} ${secondMatch!}', filter: TypeFilters.video); track.id = resultUrl.first.id.value; } const invidiousUrl = [ @@ -102,7 +102,7 @@ class HomeProvider with ChangeNotifier { print(source.url); await player.play(source); } catch (e) { - print('Play error: ' + e.toString()); + print('Play error: $e'); } Future.delayed(const Duration(milliseconds: 50)); @@ -168,27 +168,27 @@ class HomeProvider with ChangeNotifier { List> get radioList { List> menuItems = [ - const DropdownMenuItem(child: Text("FIP"), value: "fip"), - const DropdownMenuItem(child: Text("Electro"), value: "fip_electro"), - const DropdownMenuItem(child: Text("Groove"), value: "fip_groove"), - const DropdownMenuItem(child: Text("Rock"), value: "fip_rock"), - const DropdownMenuItem(child: Text("Jazz"), value: "fip_jazz"), - const DropdownMenuItem(child: Text("Pop"), value: "fip_pop"), - const DropdownMenuItem(child: Text("Reggae"), value: "fip_reggae"), - const DropdownMenuItem(child: Text("World"), value: "fip_world"), + const DropdownMenuItem(value: "fip", child: Text("FIP")), + const DropdownMenuItem(value: "fip_electro", child: Text("Electro")), + const DropdownMenuItem(value: "fip_groove", child: Text("Groove")), + const DropdownMenuItem(value: "fip_rock", child: Text("Rock")), + const DropdownMenuItem(value: "fip_jazz", child: Text("Jazz")), + const DropdownMenuItem(value: "fip_pop", child: Text("Pop")), + const DropdownMenuItem(value: "fip_reggae", child: Text("Reggae")), + const DropdownMenuItem(value: "fip_world", child: Text("World")), const DropdownMenuItem( - child: Text("Nouveautés"), value: "fip_nouveautes"), + value: "fip_nouveautes", child: Text("Nouveautés")), ]; return menuItems; } List> get pageList { List> menuItems = [ - const DropdownMenuItem(child: Text("25"), value: "3"), - const DropdownMenuItem(child: Text("50"), value: "6"), - const DropdownMenuItem(child: Text("100"), value: "12"), - const DropdownMenuItem(child: Text("200"), value: "25"), - const DropdownMenuItem(child: Text("500"), value: "62"), + const DropdownMenuItem(value: "3", child: Text("25")), + const DropdownMenuItem(value: "6", child: Text("50")), + const DropdownMenuItem(value: "12", child: Text("100")), + const DropdownMenuItem(value: "25", child: Text("200")), + const DropdownMenuItem(value: "62", child: Text("500")), ]; return menuItems; } diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 1d67501..1fcf3d3 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -127,7 +127,7 @@ class _HomeScreenState extends State { child: Column(children: [ const SizedBox(height: 20), Text( - 'Error: ' + snapshot.error.toString(), + 'Error: ${snapshot.error}', style: TextStyle(color: Colors.grey[500]), ), ]), @@ -263,18 +263,18 @@ class _HomeScreenState extends State { // playerProvider.reload(); }, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.grey[900], + backgroundColor: Colors.grey[300], + shape: const CircleBorder(), + padding: const EdgeInsets.all(12), + ), child: Icon( hp.player.state.name == 'playing' ? Icons.pause : Icons.play_arrow, color: Colors.grey[900], size: 30), - style: ElevatedButton.styleFrom( - shape: const CircleBorder(), - padding: const EdgeInsets.all(12), - primary: Colors.grey[300], - onPrimary: Colors.grey[900], - ), ), Column(children: [ IconButton( @@ -387,7 +387,7 @@ Widget trackLine(Track track) { return SizedBox( height: 30, child: Row( - children: [Text(track.title + ' - ' + track.artiste)], + children: [Text('${track.title} - ${track.artiste}')], ), ); } @@ -479,10 +479,11 @@ TableRow _buildTableRow(Track track, BuildContext context) { final secondMatch = track.artiste == '' ? track.album : track.artiste; final resultUrl = await yt.search - .search(track.title + ' ' + secondMatch!); + .search('${track.title} ${secondMatch!}'); track.id = resultUrl.first.id.value; } if (track.id != null) { + // ignore: use_build_context_synchronously hp.downloadMusic(context, track); } isDownloading = -1; diff --git a/pubspec.lock b/pubspec.lock index d980a83..1ec154d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,70 +7,70 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.3.0" + version: "3.3.1" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.3.1" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" audioplayers: dependency: "direct main" description: name: audioplayers url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-rc.4" + version: "1.0.1" audioplayers_android: dependency: transitive description: name: audioplayers_android url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-rc.2" + version: "1.0.1" audioplayers_darwin: dependency: transitive description: name: audioplayers_darwin url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-rc.4" + version: "1.0.1" audioplayers_linux: dependency: transitive description: name: audioplayers_linux url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-rc.3" + version: "1.0.0" audioplayers_platform_interface: dependency: transitive description: name: audioplayers_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-rc.2" + version: "1.0.0" audioplayers_web: dependency: transitive description: name: audioplayers_web url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-rc.3" + version: "1.0.0" audioplayers_windows: dependency: transitive description: name: audioplayers_windows url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-rc.3" + version: "1.0.0" boolean_selector: dependency: transitive description: @@ -84,21 +84,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: @@ -112,42 +105,42 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" csslib: dependency: transitive description: name: csslib url: "https://pub.dartlang.org" source: hosted - version: "0.17.1" + version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "2.0.1" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.2" + version: "6.1.4" flutter: dependency: "direct main" description: flutter @@ -159,7 +152,7 @@ packages: name: flutter_lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" flutter_test: dependency: "direct dev" description: flutter @@ -176,7 +169,7 @@ packages: name: freezed_annotation url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.1.0" html: dependency: transitive description: @@ -190,28 +183,28 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.13.4" + version: "0.13.5" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" icons_launcher: dependency: "direct dev" description: name: icons_launcher url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "2.0.5" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.1.3" + version: "3.2.0" js: dependency: transitive description: @@ -225,35 +218,35 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.5.0" + version: "4.6.0" lints: dependency: transitive description: name: lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" miniplayer: dependency: "direct main" description: @@ -276,63 +269,63 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "2.0.20" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.0.11" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.3" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "5.0.0" platform: dependency: transitive description: @@ -360,7 +353,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "6.0.2" + version: "6.0.3" sky_engine: dependency: transitive description: flutter @@ -372,7 +365,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -393,28 +386,28 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" universal_io: dependency: "direct main" description: @@ -442,35 +435,35 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.5.2" + version: "3.0.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0+1" + version: "0.2.0+2" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.3.1" + version: "6.1.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.1.1" youtube_explode_dart: dependency: "direct main" description: name: youtube_explode_dart url: "https://pub.dartlang.org" source: hosted - version: "1.11.0" + version: "1.12.0" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.8.1" + dart: ">=2.17.1 <3.0.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0e54783..497d985 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,12 +27,16 @@ dependencies: universal_io: ^2.0.4 # ffmpeg_cli: ^0.1.0 audioplayers: ^1.0.0-rc.4 + # git: + # url: https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers_linux + # ref: main + dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^1.0.0 - icons_launcher: ^1.1.3 + flutter_lints: ^2.0.1 + icons_launcher: ^2.0.5 flutter_icons: android: true