From 09d411a6c360ae908deb1de57f210b4237b66ff5 Mon Sep 17 00:00:00 2001 From: robustTechie Date: Thu, 22 Oct 2020 02:20:52 +0530 Subject: [PATCH] play/pause icon in list view --- android/app/build.gradle | 2 +- lib/provider/SongWidget.dart | 27 ++++++++++++++++++++++----- lib/view/My_Music_List.dart | 1 + pubspec.lock | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 6b8b8d3..3a68db9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -39,7 +39,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.amfoss.raag" - minSdkVersion 25 + minSdkVersion 23 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/lib/provider/SongWidget.dart b/lib/provider/SongWidget.dart index d6578f6..6e6dd67 100644 --- a/lib/provider/SongWidget.dart +++ b/lib/provider/SongWidget.dart @@ -59,8 +59,8 @@ class _SongWidgetState extends State with TickerProviderStateMixin { children: [ getAlbumArt(song), Container( - padding: const EdgeInsets.all(8.0), - width: MediaQuery.of(context).size.width * 0.75, + padding: const EdgeInsets.all(6.0), + width: MediaQuery.of(context).size.width * 0.65, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, @@ -83,9 +83,23 @@ class _SongWidgetState extends State with TickerProviderStateMixin { ], ), ), - Icon( - Icons.play_arrow, - ), + + FloatingActionButton( + child: AnimatedIcon( + icon: AnimatedIcons.play_pause, + size: 20.0, + progress: playFABController, + ), + elevation: 2, + mini: true, + backgroundColor: Colors.white70, + splashColor: Colors.purple, + onPressed: () { + audioManagerInstance.isPlaying + ? playFABController.reverse() + : playFABController.forward(); + audioManagerInstance.playOrPause(); + }), ], ), ), @@ -143,6 +157,9 @@ class _SongWidgetState extends State with TickerProviderStateMixin { else return CircleAvatar( backgroundImage: FileImage(File(song.albumArtwork)), + radius: 50, + minRadius: 30, + maxRadius: 70, ); } } diff --git a/lib/view/My_Music_List.dart b/lib/view/My_Music_List.dart index 9599f3f..c32fbcb 100644 --- a/lib/view/My_Music_List.dart +++ b/lib/view/My_Music_List.dart @@ -18,6 +18,7 @@ class MyMusicList extends StatelessWidget { padding: EdgeInsets.all(20), height: MediaQuery.of(context).size.height*0.8, child: Column( + mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [ Row( diff --git a/pubspec.lock b/pubspec.lock index 503dfcd..24be562 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -211,5 +211,5 @@ packages: source: hosted version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.10.0-110 <=2.11.0-177.0.dev" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.12.13 <2.0.0"