diff --git a/.idea/dafl_music.iml b/.idea/dafl_music.iml index 7d01c35..98db980 100644 --- a/.idea/dafl_music.iml +++ b/.idea/dafl_music.iml @@ -11,6 +11,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml deleted file mode 100644 index f8237c9..0000000 --- a/.idea/libraries/Dart_Packages.xml +++ /dev/null @@ -1,692 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index cb79f3d..b6e6985 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart index 71bb08e..55baa53 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart @@ -1,3 +1,8 @@ + + +import 'package:text_scroll/text_scroll.dart'; +import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart'; + import '../../../main.dart'; import '../../../model/music.dart'; import './w_settings.dart'; @@ -28,14 +33,18 @@ class MainPageProfil extends StatefulWidget { class _MainPageProfilState extends State { String? username = MyApp.controller.currentUser.usernameDafl; - late Music currentmusic; + late Future data; + + Future getdata() async { + return MyApp.api.getTrackInfo( await MyApp.api.getCurrentlyPlayingTrack()); + + } @override initState() { super.initState(); username = MyApp.controller.currentUser.usernameDafl; MyApp.controller.currentUser.actualiseCurrentMusic(); - currentmusic = MyApp.controller.currentUser.currentMusic; } @override @@ -226,53 +235,123 @@ class _MainPageProfilState extends State { ), ], ), - Container( - margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), - height: height * 0.14, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.0), - color: const Color(0xFFD9D9D9).withOpacity(0.08), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), - child: ClipRRect( - borderRadius: BorderRadius.circular(15), - child: FadeInImage.assetNetwork( - height: 90, - width: 90, - placeholder: - "assets/images/loadingPlaceholder.gif", - image: currentmusic.linkCover))), - Container( - margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), - child: Column( + FutureBuilder( + future: getdata(), + builder: (context, snapshot){ + if(snapshot.connectionState == ConnectionState.done){ + return Container( + margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), + height: height * 0.14, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + color: const Color(0xFFD9D9D9).withOpacity(0.08), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.network(snapshot.data!['cover'], + height: 90, + width: 90, + ))), + Container( + margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + snapshot.data!['name'].length > 22? + SizedBox(width: 220, + child: ScrollLoopAutoScroll( + delayAfterScrollInput: Duration(seconds: 1), + delay: Duration(seconds: 1), + child: Text( + snapshot.data!['name'], + style: TextStyle(fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.bold), + ), + duration: Duration(seconds: 100), + scrollDirection: Axis.horizontal, + ),) + :Text( + snapshot.data!['name'], + style: TextStyle(fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.bold), + ), + + + Text( + snapshot.data!['artist'], + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w400, + color: Colors.grey), + ), + ], + ), + ) + ], + ), + ); + } + else{ + return Container( + margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), + height: height * 0.14, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + color: const Color(0xFFD9D9D9).withOpacity(0.08), + ), + child: Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( - currentmusic.name, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500, - color: Colors.white), - ), - Text( - currentmusic.artist, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - color: Colors.grey), - ), + Container( + margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.asset("assets/images/loadingPlaceholder.gif", + height: 90, + width: 90))), + Container( + margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 150, + height: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.grey.withOpacity(0.7), + ), + ), + SizedBox(height: 10,), + Container( + width: 100, + height: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.grey.withOpacity(0.4), + ), + ), + ], + ), + ) ], ), - ) - ], - ), - ), + ); + } + + }) + , ], ), ), @@ -339,4 +418,5 @@ class _MainPageProfilState extends State { ), ); } + } diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock index 0662299..3799d6e 100644 --- a/Sources/dafl_project_flutter/pubspec.lock +++ b/Sources/dafl_project_flutter/pubspec.lock @@ -106,6 +106,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.5" + fading_edge_scrollview: + dependency: transitive + description: + name: fading_edge_scrollview + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" fake_async: dependency: transitive description: @@ -322,6 +329,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + marquee: + dependency: "direct main" + description: + name: marquee + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.3" matcher: dependency: transitive description: @@ -483,6 +497,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.1" + scroll_loop_auto_scroll: + dependency: "direct main" + description: + name: scroll_loop_auto_scroll + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.5" sky_engine: dependency: transitive description: flutter @@ -530,6 +551,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.12" + text_scroll: + dependency: "direct main" + description: + name: text_scroll + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1" typed_data: dependency: transitive description: diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 96ede70..01eca08 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -29,6 +29,9 @@ dependencies: home_indicator: ^2.0.2 geolocator: ^9.0.2 flutter_styled_toast: ^2.1.3 + marquee: ^2.2.3 + text_scroll: ^0.1.1 + scroll_loop_auto_scroll: ^0.0.2 dev_dependencies: flutter_test: