diff --git a/.idea/Project_JustMusic.iml b/.idea/Project_JustMusic.iml index ea13052..80e8d93 100644 --- a/.idea/Project_JustMusic.iml +++ b/.idea/Project_JustMusic.iml @@ -9,6 +9,9 @@ + + + diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 3b44ee2..2e78728 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -9,6 +9,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -86,6 +135,13 @@ + + + + + + @@ -93,6 +149,13 @@ + + + + + + @@ -121,6 +184,13 @@ + + + + + + @@ -163,6 +233,20 @@ + + + + + + + + + + + + @@ -303,6 +387,13 @@ + + + + + + @@ -331,6 +422,13 @@ + + + + + + @@ -363,6 +461,13 @@ + + + + + + + @@ -374,6 +479,8 @@ + + @@ -383,6 +490,8 @@ + + @@ -402,10 +511,12 @@ + + @@ -413,6 +524,7 @@ + diff --git a/Sources/justMUSIC/.metadata b/Sources/justMUSIC/.metadata index 700134a..e1179a6 100644 --- a/Sources/justMUSIC/.metadata +++ b/Sources/justMUSIC/.metadata @@ -21,6 +21,18 @@ migration: - platform: ios create_revision: 18a827f3933c19f51862dde3fa472197683249d6 base_revision: 18a827f3933c19f51862dde3fa472197683249d6 + - platform: linux + create_revision: 18a827f3933c19f51862dde3fa472197683249d6 + base_revision: 18a827f3933c19f51862dde3fa472197683249d6 + - platform: macos + create_revision: 18a827f3933c19f51862dde3fa472197683249d6 + base_revision: 18a827f3933c19f51862dde3fa472197683249d6 + - platform: web + create_revision: 18a827f3933c19f51862dde3fa472197683249d6 + base_revision: 18a827f3933c19f51862dde3fa472197683249d6 + - platform: windows + create_revision: 18a827f3933c19f51862dde3fa472197683249d6 + base_revision: 18a827f3933c19f51862dde3fa472197683249d6 # User provided section diff --git a/Sources/justMUSIC/android/.gitignore b/Sources/justMUSIC/android/.gitignore deleted file mode 100644 index 6f56801..0000000 --- a/Sources/justMUSIC/android/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java - -# Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app -key.properties -**/*.keystore -**/*.jks diff --git a/Sources/justMUSIC/android/app/build.gradle b/Sources/justMUSIC/android/app/build.gradle deleted file mode 100644 index 50538fd..0000000 --- a/Sources/justMUSIC/android/app/build.gradle +++ /dev/null @@ -1,71 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.justmusic" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/Sources/justMUSIC/android/app/src/debug/AndroidManifest.xml b/Sources/justMUSIC/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index 44a649b..0000000 --- a/Sources/justMUSIC/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/Sources/justMUSIC/android/app/src/main/AndroidManifest.xml b/Sources/justMUSIC/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index ea3a368..0000000 --- a/Sources/justMUSIC/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Sources/justMUSIC/android/app/src/main/kotlin/com/example/justmusic/MainActivity.kt b/Sources/justMUSIC/android/app/src/main/kotlin/com/example/justmusic/MainActivity.kt deleted file mode 100644 index b8bd3a1..0000000 --- a/Sources/justMUSIC/android/app/src/main/kotlin/com/example/justmusic/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.justmusic - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/Sources/justMUSIC/android/app/src/main/res/drawable-v21/launch_background.xml b/Sources/justMUSIC/android/app/src/main/res/drawable-v21/launch_background.xml deleted file mode 100644 index f74085f..0000000 --- a/Sources/justMUSIC/android/app/src/main/res/drawable-v21/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/Sources/justMUSIC/android/app/src/main/res/drawable/launch_background.xml b/Sources/justMUSIC/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f..0000000 --- a/Sources/justMUSIC/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4..0000000 Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b7..0000000 Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d4391..0000000 Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d..0000000 Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372e..0000000 Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/Sources/justMUSIC/android/app/src/main/res/values-night/styles.xml b/Sources/justMUSIC/android/app/src/main/res/values-night/styles.xml deleted file mode 100644 index 06952be..0000000 --- a/Sources/justMUSIC/android/app/src/main/res/values-night/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/Sources/justMUSIC/android/app/src/main/res/values/styles.xml b/Sources/justMUSIC/android/app/src/main/res/values/styles.xml deleted file mode 100644 index cb1ef88..0000000 --- a/Sources/justMUSIC/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/Sources/justMUSIC/android/app/src/profile/AndroidManifest.xml b/Sources/justMUSIC/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index 44a649b..0000000 --- a/Sources/justMUSIC/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/Sources/justMUSIC/android/build.gradle b/Sources/justMUSIC/android/build.gradle deleted file mode 100644 index 83ae220..0000000 --- a/Sources/justMUSIC/android/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - ext.kotlin_version = '1.6.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/Sources/justMUSIC/android/gradle.properties b/Sources/justMUSIC/android/gradle.properties deleted file mode 100644 index 94adc3a..0000000 --- a/Sources/justMUSIC/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true diff --git a/Sources/justMUSIC/android/gradle/wrapper/gradle-wrapper.properties b/Sources/justMUSIC/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index cb24abd..0000000 --- a/Sources/justMUSIC/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/Sources/justMUSIC/android/settings.gradle b/Sources/justMUSIC/android/settings.gradle deleted file mode 100644 index 44e62bc..0000000 --- a/Sources/justMUSIC/android/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':app' - -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() - -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } - -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/Sources/justMUSIC/assets/images/explicit_icon.png b/Sources/justMUSIC/assets/images/explicit_icon.png new file mode 100644 index 0000000..0cb0a5b Binary files /dev/null and b/Sources/justMUSIC/assets/images/explicit_icon.png differ diff --git a/Sources/justMUSIC/assets/images/search_icon.png b/Sources/justMUSIC/assets/images/search_icon.png new file mode 100644 index 0000000..eb44ee1 Binary files /dev/null and b/Sources/justMUSIC/assets/images/search_icon.png differ diff --git a/Sources/justMUSIC/lib/components/editable_post_component.dart b/Sources/justMUSIC/lib/components/editable_post_component.dart index c461854..b25b1c8 100644 --- a/Sources/justMUSIC/lib/components/editable_post_component.dart +++ b/Sources/justMUSIC/lib/components/editable_post_component.dart @@ -1,3 +1,4 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/Material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -16,6 +17,7 @@ class _EditablePostComponentState extends State { return ClipRRect( borderRadius: BorderRadius.circular(25), child: Container( + constraints: BoxConstraints(maxWidth: 400), width: double.infinity, color: warningBttnColor, child: Column( @@ -32,7 +34,7 @@ class _EditablePostComponentState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(18), // implement image - child: Image( + child: const Image( image: AssetImage("assets/images/exemple_cover.png"), fit: BoxFit.cover, width: double.infinity, @@ -41,25 +43,31 @@ class _EditablePostComponentState extends State { ), ), Padding( - padding: EdgeInsets.fromLTRB(15.sp, 25.sp, 15.sp, 25.sp), + padding: EdgeInsets.fromLTRB(15, 25, 15, 25), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text("France, Lyon", - style: GoogleFonts.plusJakartaSans( - color: Colors.white, fontSize: 13.sp)), + AutoSizeText( + "France, Lyon", + style: GoogleFonts.plusJakartaSans( + color: Colors.white, fontSize: 13.sp), + maxFontSize: 20, + ), Image( image: AssetImage("assets/images/camera_icon.png"), width: 30, ), - Text("10 Juil. 2023", - style: GoogleFonts.plusJakartaSans( - color: Colors.white, fontSize: 13.sp)), + AutoSizeText( + "10 Juil. 2023", + style: GoogleFonts.plusJakartaSans( + color: Colors.white, fontSize: 13.sp), + maxFontSize: 20, + ), ], ), ), Padding( - padding: EdgeInsets.fromLTRB(15.sp, 0, 10.sp, 25.sp), + padding: EdgeInsets.fromLTRB(15, 0, 10, 25), child: SizedBox( width: double.infinity, child: TextFormField( @@ -68,13 +76,13 @@ class _EditablePostComponentState extends State { cursorColor: primaryColor, style: GoogleFonts.plusJakartaSans( color: Colors.white, - fontSize: 13.sp, + fontSize: 13, fontWeight: FontWeight.w300), maxLines: 4, maxLength: 120, decoration: InputDecoration( counterStyle: GoogleFonts.plusJakartaSans( - color: grayText, fontSize: 9.sp), + color: grayText, fontSize: 9), focusedBorder: const OutlineInputBorder( borderSide: BorderSide(width: 0, color: Colors.transparent), @@ -93,7 +101,7 @@ class _EditablePostComponentState extends State { hintText: 'Description...', hintStyle: GoogleFonts.plusJakartaSans( color: grayText, - fontSize: 13.sp, + fontSize: 13, fontWeight: FontWeight.w300), ), ), diff --git a/Sources/justMUSIC/lib/components/music_list_component.dart b/Sources/justMUSIC/lib/components/music_list_component.dart new file mode 100644 index 0000000..2173ce4 --- /dev/null +++ b/Sources/justMUSIC/lib/components/music_list_component.dart @@ -0,0 +1,71 @@ +import 'package:flutter/Material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:justmusic/components/play_button_component.dart'; +import 'package:justmusic/values/constants.dart'; + +class MusicListComponent extends StatelessWidget { + const MusicListComponent({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.only(bottom: 14), + child: Row( + children: [ + const ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image( + image: AssetImage("assets/images/exemple_cover.png"), + width: 60, + height: 60, + ), + ), + const SizedBox( + width: 10, + ), + Expanded( + flex: 10, + child: Wrap( + alignment: WrapAlignment.center, + direction: Axis.vertical, + runSpacing: 3, + spacing: 3, + children: [ + Wrap( + verticalDirection: VerticalDirection.up, + spacing: 5, + runSpacing: 8, + runAlignment: WrapAlignment.end, + alignment: WrapAlignment.end, + children: [ + Text( + "A.C. Milan", + overflow: TextOverflow.ellipsis, + style: GoogleFonts.plusJakartaSans( + fontSize: 16, + color: Colors.white, + fontWeight: FontWeight.w700), + ), + Icon( + Icons.explicit, + color: Colors.grey.withOpacity(0.7), + size: 17, + ) + ], + ), + Text( + "Booba", + overflow: TextOverflow.ellipsis, + style: GoogleFonts.plusJakartaSans( + color: Colors.grey, fontWeight: FontWeight.w400), + ) + ], + ), + ), + Spacer(), + PlayButtonComponent() + ], + ), + ); + } +} diff --git a/Sources/justMUSIC/lib/components/play_button_component.dart b/Sources/justMUSIC/lib/components/play_button_component.dart new file mode 100644 index 0000000..3c20faa --- /dev/null +++ b/Sources/justMUSIC/lib/components/play_button_component.dart @@ -0,0 +1,67 @@ +import 'package:audioplayers/audioplayers.dart'; +import 'package:flutter/Material.dart'; +import 'package:flutter_animated_play_button/flutter_animated_play_button.dart'; +import 'package:ionicons/ionicons.dart'; +import 'package:justmusic/values/constants.dart'; + +class PlayButtonComponent extends StatefulWidget { + const PlayButtonComponent({Key? key}) : super(key: key); + + @override + State createState() => _PlayButtonComponentState(); +} + +class _PlayButtonComponentState extends State { + bool isPlaying = true; + final player = AudioPlayer(); + void switchStatePlaying() { + setState(() { + isPlaying = !isPlaying; + }); + stopSong(); + } + + @override + void initState() { + player.onPlayerComplete.listen((event) { + switchStatePlaying(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + if (!isPlaying) { + playSong(); + } else {} + return isPlaying + ? GestureDetector( + onTap: switchStatePlaying, + child: Icon( + Ionicons.play_circle_outline, + color: Colors.grey.withOpacity(0.3), + size: 30, + ), + ) + : GestureDetector( + onTap: switchStatePlaying, + child: Container( + width: 30, + height: 30, + child: AnimatedPlayButton( + stopped: false, + color: Colors.grey.withOpacity(0.3), + onPressed: () {}, + ), + )); + } + + Future playSong() async { + await player.play(UrlSource( + 'https://p.scdn.co/mp3-preview/d38052978a79adced2187cd8b6497bb10bedc452?cid=eb2aab666a43490f82eef0bb064d363f')); + } + + Future stopSong() async { + await player.stop(); + } +} diff --git a/Sources/justMUSIC/lib/components/post_button_component.dart b/Sources/justMUSIC/lib/components/post_button_component.dart index 96c0d06..eff93b2 100644 --- a/Sources/justMUSIC/lib/components/post_button_component.dart +++ b/Sources/justMUSIC/lib/components/post_button_component.dart @@ -8,6 +8,7 @@ class PostButtonComponent extends StatelessWidget { @override Widget build(BuildContext context) { return Container( + constraints: BoxConstraints(maxWidth: 400), decoration: BoxDecoration( gradient: LinearGradient(colors: [ Color(0xFF141414), @@ -15,7 +16,7 @@ class PostButtonComponent extends StatelessWidget { Color(0xFF141414) ]), borderRadius: BorderRadius.circular(10000)), - padding: EdgeInsets.symmetric(vertical: 25.sp), + padding: EdgeInsets.symmetric(vertical: 25), width: double.infinity, child: Align( child: Text( @@ -24,7 +25,7 @@ class PostButtonComponent extends StatelessWidget { color: Color(0xFF474747), fontWeight: FontWeight.w800, fontStyle: FontStyle.italic, - fontSize: 24.sp), + fontSize: 24), ), ), ); diff --git a/Sources/justMUSIC/lib/components/search_bar_component.dart b/Sources/justMUSIC/lib/components/search_bar_component.dart index 0aa0a3e..ca7cf9b 100644 --- a/Sources/justMUSIC/lib/components/search_bar_component.dart +++ b/Sources/justMUSIC/lib/components/search_bar_component.dart @@ -1,12 +1,13 @@ import 'package:flutter/Material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import '../values/constants.dart'; class SearchBarComponent extends StatefulWidget { final String? text; - const SearchBarComponent({Key? key, this.text}) : super(key: key); + final VoidCallback? callback; + const SearchBarComponent({Key? key, this.text, this.callback}) + : super(key: key); @override State createState() => _SearchBarComponentState(); @@ -15,16 +16,19 @@ class SearchBarComponent extends StatefulWidget { class _SearchBarComponentState extends State { @override Widget build(BuildContext context) { - return ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(20)), - child: Container( - color: searchBarColor, - width: double.infinity, - padding: - EdgeInsets.fromLTRB(defaultPadding, 16.sp, defaultPadding, 16.sp), - child: Text( - widget.text ?? "Chercher une musique...", - style: GoogleFonts.plusJakartaSans(color: Colors.white), + return GestureDetector( + onTap: widget.callback, + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(20)), + child: Container( + constraints: BoxConstraints(maxWidth: 600), + color: searchBarColor, + width: double.infinity, + padding: EdgeInsets.fromLTRB(defaultPadding, 16, defaultPadding, 16), + child: Text( + widget.text ?? "Chercher une musique...", + style: GoogleFonts.plusJakartaSans(color: Colors.white), + ), ), ), ); diff --git a/Sources/justMUSIC/lib/screens/post_screen.dart b/Sources/justMUSIC/lib/screens/post_screen.dart index 641bdfa..0bac5a5 100644 --- a/Sources/justMUSIC/lib/screens/post_screen.dart +++ b/Sources/justMUSIC/lib/screens/post_screen.dart @@ -1,5 +1,8 @@ +import 'dart:ui'; + import 'package:flutter/Material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:justmusic/screens/search_song_screen.dart'; import '../components/editable_post_component.dart'; import '../components/post_button_component.dart'; @@ -13,27 +16,73 @@ class PostScreen extends StatefulWidget { State createState() => _PostScreenState(); } -class _PostScreenState extends State { +class _PostScreenState extends State + with SingleTickerProviderStateMixin { final scrollController = ScrollController(); + late AnimationController _controller; + late Animation _animation; + + @override + void initState() { + _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 400), + ); + + _animation = Tween(begin: 0.0, end: 400.0).animate( + CurvedAnimation( + parent: _controller, + curve: Curves.easeOut, + ), + ); + super.initState(); + } + + void openDetailPost() { + showModalBottomSheet( + transitionAnimationController: _controller, + barrierColor: Colors.black.withOpacity(0.7), + backgroundColor: Colors.transparent, + elevation: 1, + constraints: const BoxConstraints( + maxWidth: 600, + ), + isScrollControlled: true, + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), topRight: Radius.circular(20))), + builder: ((context) { + return const ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), topRight: Radius.circular(20)), + child: SearchSongScreen()); + }), + ); + } + @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: true, backgroundColor: bgColor, body: Container( - padding: EdgeInsets.only( - left: defaultPadding, top: defaultPadding, right: defaultPadding), - width: double.infinity, - height: double.infinity, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/background_justMusic.png"), - fit: BoxFit.cover, - ), + padding: + const EdgeInsets.only(left: defaultPadding, right: defaultPadding), + width: double.infinity, + height: double.infinity, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/background_justMusic.png"), + fit: BoxFit.cover, ), - child: Stack( - children: [ - SingleChildScrollView( + ), + child: Stack( + alignment: Alignment.topCenter, + children: [ + ScrollConfiguration( + behavior: ScrollBehavior().copyWith(scrollbars: false), + child: SingleChildScrollView( controller: scrollController, child: Column( mainAxisAlignment: MainAxisAlignment.end, @@ -43,18 +92,25 @@ class _PostScreenState extends State { ), EditablePostComponent(), SizedBox( - height: 40.sp, + height: 40.h, ), PostButtonComponent(), SizedBox( - height: 40.sp, + height: 40.h, ), ], ), ), - SearchBarComponent(), - ], - )), + ), + Padding( + padding: EdgeInsets.only(top: defaultPadding), + child: SearchBarComponent( + callback: openDetailPost, + ), + ), + ], + ), + ), ); } } diff --git a/Sources/justMUSIC/lib/screens/search_song_screen.dart b/Sources/justMUSIC/lib/screens/search_song_screen.dart new file mode 100644 index 0000000..521c25f --- /dev/null +++ b/Sources/justMUSIC/lib/screens/search_song_screen.dart @@ -0,0 +1,134 @@ +import 'dart:ui'; + +import 'package:flutter/Material.dart'; +import 'package:flutter/services.dart'; +import 'package:google_fonts/google_fonts.dart'; + +import '../components/music_list_component.dart'; +import '../values/constants.dart'; + +class SearchSongScreen extends StatefulWidget { + const SearchSongScreen({Key? key}) : super(key: key); + + @override + State createState() => _SearchSongScreenState(); +} + +class _SearchSongScreenState extends State { + Future resetFullScreen() async { + await SystemChannels.platform.invokeMethod( + 'SystemChrome.restoreSystemUIOverlays', + ); + } + + @override + Widget build(BuildContext context) { + double screenHeight = MediaQuery.of(context).size.height; + return GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + resetFullScreen(); + } + }, + child: BackdropFilter( + filter: ImageFilter.blur( + sigmaX: 25.0, + sigmaY: 25.0, + ), + child: Container( + color: bgAppBar.withOpacity(0.5), + height: screenHeight - 50, + padding: const EdgeInsets.only( + top: 10, left: defaultPadding, right: defaultPadding), + child: Column( + children: [ + Align( + child: Container( + width: 60, + height: 5, + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.circular(20))), + ), + const SizedBox( + height: 10, + ), + Padding( + padding: const EdgeInsets.only(bottom: 10), + child: SizedBox( + height: 40, + child: TextFormField( + keyboardAppearance: Brightness.dark, + onEditingComplete: resetFullScreen, + validator: (value) { + if (value == null || value.isEmpty) { + return 'TODO'; + } + return null; + }, + cursorColor: Colors.white, + keyboardType: TextInputType.text, + style: GoogleFonts.plusJakartaSans(color: grayText), + decoration: InputDecoration( + prefixIcon: const Icon( + Icons.search, + color: grayColor, + ), + focusedBorder: const OutlineInputBorder( + borderSide: + BorderSide(width: 1, color: grayColor), + borderRadius: + BorderRadius.all(Radius.circular(10))), + contentPadding: const EdgeInsets.only( + top: 0, + bottom: 0, + left: defaultPadding, + right: defaultPadding), + fillColor: searchBarColor, + filled: true, + focusColor: grayText, + enabledBorder: const OutlineInputBorder( + borderSide: + BorderSide(width: 1, color: grayColor), + borderRadius: + BorderRadius.all(Radius.circular(10))), + hintText: 'Chercher un son', + hintStyle: + GoogleFonts.plusJakartaSans(color: grayColor)), + ), + ), + ), + Expanded( + child: ScrollConfiguration( + behavior: ScrollBehavior().copyWith(scrollbars: false), + child: SingleChildScrollView( + child: Column( + children: const [ + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + MusicListComponent(), + ], + ), + ), + )) + ], + ), + ), + )); + } +} diff --git a/Sources/justMUSIC/pubspec.lock b/Sources/justMUSIC/pubspec.lock index f06f84c..039e07f 100644 --- a/Sources/justMUSIC/pubspec.lock +++ b/Sources/justMUSIC/pubspec.lock @@ -8,6 +8,55 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.9.0" + audioplayers: + dependency: "direct main" + description: + name: audioplayers + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" + audioplayers_android: + dependency: transitive + description: + name: audioplayers_android + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" + audioplayers_darwin: + dependency: transitive + description: + name: audioplayers_darwin + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" + audioplayers_linux: + dependency: transitive + description: + name: audioplayers_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + audioplayers_platform_interface: + dependency: transitive + description: + name: audioplayers_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.1" + audioplayers_web: + dependency: transitive + description: + name: audioplayers_web + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + audioplayers_windows: + dependency: transitive + description: + name: audioplayers_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" auto_size_text: dependency: "direct main" description: @@ -85,11 +134,25 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.2" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.4" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_animated_play_button: + dependency: "direct main" + description: + name: flutter_animated_play_button + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" flutter_lints: dependency: "direct dev" description: @@ -116,6 +179,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" font_awesome_flutter: dependency: transitive description: @@ -158,6 +226,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.2" + ionicons: + dependency: "direct main" + description: + name: ionicons + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.2" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.4" lints: dependency: transitive description: @@ -296,6 +378,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.1" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" term_glyph: dependency: transitive description: @@ -324,6 +413,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.7" vector_math: dependency: transitive description: diff --git a/Sources/justMUSIC/pubspec.yaml b/Sources/justMUSIC/pubspec.yaml index c84080c..abbc303 100644 --- a/Sources/justMUSIC/pubspec.yaml +++ b/Sources/justMUSIC/pubspec.yaml @@ -49,6 +49,9 @@ dependencies: zoom_tap_animation: ^1.1.0 custom_draggable_widget: ^0.0.2 modal_bottom_sheet: ^2.1.2 + flutter_animated_play_button: ^0.3.0 + audioplayers: ^4.1.0 + ionicons: ^0.2.2 dev_dependencies: flutter_test: