From 34033732243e0339f3a87be2ffc4095c417da144 Mon Sep 17 00:00:00 2001 From: Lucas Delanier Date: Fri, 28 Jul 2023 23:48:16 +0200 Subject: [PATCH] add switch on post --- .../justMUSIC/lib/components/back_button.dart | 34 ++++++++ Sources/justMUSIC/lib/main.dart | 4 +- .../justMUSIC/lib/screens/feed_screen.dart | 81 ++++++++++++------- .../justMUSIC/lib/screens/post_screen.dart | 32 +++++--- .../lib/screens/search_song_screen.dart | 6 +- Sources/justMUSIC/pubspec.lock | 7 ++ Sources/justMUSIC/pubspec.yaml | 1 + 7 files changed, 122 insertions(+), 43 deletions(-) create mode 100644 Sources/justMUSIC/lib/components/back_button.dart diff --git a/Sources/justMUSIC/lib/components/back_button.dart b/Sources/justMUSIC/lib/components/back_button.dart new file mode 100644 index 0000000..5e771fa --- /dev/null +++ b/Sources/justMUSIC/lib/components/back_button.dart @@ -0,0 +1,34 @@ +import 'package:flutter/Material.dart'; + +import '../values/constants.dart'; + +class BackButtonComponent extends StatefulWidget { + const BackButtonComponent({Key? key}) : super(key: key); + + @override + State createState() => _BackButtonComponentState(); +} + +class _BackButtonComponentState extends State { + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: ClipOval( + child: Container( + height: 40, + width: 40, + color: Colors.white, + child: Center( + child: Icon( + Icons.arrow_back_outlined, + color: bgColor, + ), + ), + ), + ), + ); + } +} diff --git a/Sources/justMUSIC/lib/main.dart b/Sources/justMUSIC/lib/main.dart index f2a3bb2..a9a9de3 100644 --- a/Sources/justMUSIC/lib/main.dart +++ b/Sources/justMUSIC/lib/main.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:justmusic/screens/post_screen.dart'; +import 'package:justmusic/screens/feed_screen.dart'; import 'package:justmusic/view_model/UserViewModel.dart'; void main() { @@ -34,7 +34,7 @@ class MyApp extends StatelessWidget { primarySwatch: Colors.blue, ), home: const SafeArea( - child: PostScreen(), + child: FeedScreen(), )); }, designSize: Size(390, 844), diff --git a/Sources/justMUSIC/lib/screens/feed_screen.dart b/Sources/justMUSIC/lib/screens/feed_screen.dart index 08f6f73..d26be5f 100644 --- a/Sources/justMUSIC/lib/screens/feed_screen.dart +++ b/Sources/justMUSIC/lib/screens/feed_screen.dart @@ -2,6 +2,7 @@ import 'package:circular_reveal_animation/circular_reveal_animation.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:google_fonts/google_fonts.dart'; import '../components/comment_component.dart'; import '../components/post_component.dart'; import '../components/top_nav_bar_component.dart'; @@ -82,38 +83,55 @@ class _FeedScreenState extends State topLeft: Radius.circular(20), topRight: Radius.circular(20))), builder: ((context) { return Container( - height: 720.h, - margin: const EdgeInsets.only( - top: defaultPadding, - 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, - ), - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.only( - topRight: Radius.circular(15), - topLeft: Radius.circular(15)), + height: 720.h, + margin: const EdgeInsets.only(top: 10), + 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: 20, + ), + Expanded( + child: ClipRRect( + borderRadius: BorderRadius.only( + topRight: Radius.circular(15), + topLeft: Radius.circular(15)), + child: Padding( + padding: EdgeInsets.only( + left: defaultPadding, right: defaultPadding), child: SingleChildScrollView( child: Wrap( // to apply margin in the main axis of the wrap runSpacing: 10, children: [ - const PostComponent( + PostComponent( callback: null, ), - Container(height: 40), + Container(height: 10), + Align( + child: RichText( + text: TextSpan( + text: "3", + style: GoogleFonts.plusJakartaSans( + color: Colors.white, + fontWeight: FontWeight.w600), + children: [ + TextSpan( + text: " commentaires", + style: GoogleFonts.plusJakartaSans( + color: Colors.white, + fontWeight: FontWeight.w300), + ) + ])), + ), + SizedBox(height: 20), CommentComponent(), CommentComponent(), CommentComponent(), @@ -123,8 +141,17 @@ class _FeedScreenState extends State ), ), ), - ], - )); + ), + Container( + padding: EdgeInsets.only(top: 300), + height: 70, + width: double.infinity, + color: Colors.grey, + child: TextField(), + ), + ], + ), + ); }), ); } diff --git a/Sources/justMUSIC/lib/screens/post_screen.dart b/Sources/justMUSIC/lib/screens/post_screen.dart index 0bac5a5..e6a625b 100644 --- a/Sources/justMUSIC/lib/screens/post_screen.dart +++ b/Sources/justMUSIC/lib/screens/post_screen.dart @@ -1,12 +1,10 @@ import 'dart:ui'; - import 'package:flutter/Material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:justmusic/components/back_button.dart'; import 'package:justmusic/screens/search_song_screen.dart'; - import '../components/editable_post_component.dart'; import '../components/post_button_component.dart'; -import '../components/search_bar_component.dart'; import '../values/constants.dart'; class PostScreen extends StatefulWidget { @@ -66,6 +64,21 @@ class _PostScreenState extends State return Scaffold( resizeToAvoidBottomInset: true, backgroundColor: bgColor, + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size(double.infinity, 80), + child: SafeArea( + child: Padding( + padding: const EdgeInsets.only( + left: defaultPadding, + right: defaultPadding, + top: defaultPadding), + child: Row( + children: [BackButtonComponent()], + ), + ), + ), + ), body: Container( padding: const EdgeInsets.only(left: defaultPadding, right: defaultPadding), @@ -88,9 +101,12 @@ class _PostScreenState extends State mainAxisAlignment: MainAxisAlignment.end, children: [ SizedBox( - height: 150.h, + height: 100.h, + ), + GestureDetector( + onTap: openDetailPost, + child: EditablePostComponent(), ), - EditablePostComponent(), SizedBox( height: 40.h, ), @@ -102,12 +118,6 @@ class _PostScreenState extends State ), ), ), - 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 index 521c25f..031e919 100644 --- a/Sources/justMUSIC/lib/screens/search_song_screen.dart +++ b/Sources/justMUSIC/lib/screens/search_song_screen.dart @@ -34,8 +34,8 @@ class _SearchSongScreenState extends State { }, child: BackdropFilter( filter: ImageFilter.blur( - sigmaX: 25.0, - sigmaY: 25.0, + sigmaX: 60.0, + sigmaY: 60.0, ), child: Container( color: bgAppBar.withOpacity(0.5), @@ -49,7 +49,7 @@ class _SearchSongScreenState extends State { width: 60, height: 5, decoration: BoxDecoration( - color: Colors.white.withOpacity(0.3), + color: Color(0xFF3A3A3A).withOpacity(0.6), borderRadius: BorderRadius.circular(20))), ), const SizedBox( diff --git a/Sources/justMUSIC/pubspec.lock b/Sources/justMUSIC/pubspec.lock index 039e07f..843edcb 100644 --- a/Sources/justMUSIC/pubspec.lock +++ b/Sources/justMUSIC/pubspec.lock @@ -406,6 +406,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.2.0" + top_snackbar_flutter: + dependency: "direct main" + description: + name: top_snackbar_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" typed_data: dependency: transitive description: diff --git a/Sources/justMUSIC/pubspec.yaml b/Sources/justMUSIC/pubspec.yaml index abbc303..339aa4f 100644 --- a/Sources/justMUSIC/pubspec.yaml +++ b/Sources/justMUSIC/pubspec.yaml @@ -52,6 +52,7 @@ dependencies: flutter_animated_play_button: ^0.3.0 audioplayers: ^4.1.0 ionicons: ^0.2.2 + top_snackbar_flutter: ^3.1.0 dev_dependencies: flutter_test: