diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index b90047a..0eb01f0 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -30,6 +30,13 @@ + + + + + + @@ -352,6 +359,7 @@ + diff --git a/justMUSIC/lib/screens/feed_screen.dart b/justMUSIC/lib/screens/feed_screen.dart index 8249732..746f420 100644 --- a/justMUSIC/lib/screens/feed_screen.dart +++ b/justMUSIC/lib/screens/feed_screen.dart @@ -1,3 +1,4 @@ +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'; @@ -13,7 +14,10 @@ class FeedScreen extends StatefulWidget { State createState() => _FeedScreenState(); } -class _FeedScreenState extends State { +class _FeedScreenState extends State + with SingleTickerProviderStateMixin { + late AnimationController animationController; + late Animation animation; List friendFeed = [ PostComponent(), PostComponent(), @@ -26,19 +30,32 @@ class _FeedScreenState extends State { @override void initState() { - displayFeed = friendFeed; super.initState(); + displayFeed = friendFeed; + animationController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 400), + ); + animation = CurvedAnimation( + parent: animationController, + curve: Curves.easeInOutSine, + ); + animationController.forward(); } void changeFeed(bool choice) { // Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre if (choice) { setState(() { + animationController.reset(); displayFeed = friendFeed; + animationController.forward(); }); } else { setState(() { + animationController.reset(); displayFeed = discoveryFeed; + animationController.forward(); }); } } @@ -49,29 +66,34 @@ class _FeedScreenState extends State { backgroundColor: bgColor, body: Stack( children: [ - SingleChildScrollView( - child: SizedBox( - width: double.infinity, - child: Align( - child: ConstrainedBox( - constraints: BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: defaultPadding), - child: Container( - width: double.infinity, - child: Padding( - padding: EdgeInsets.only(top: 100.h), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: displayFeed, - ), - )), + CircularRevealAnimation( + animation: animation, +// centerAlignment: Alignment.centerRight, + centerOffset: Offset(70, 0), + child: SingleChildScrollView( + child: SizedBox( + width: double.infinity, + child: Align( + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: 500), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: defaultPadding), + child: Container( + width: double.infinity, + child: Padding( + padding: EdgeInsets.only(top: 100.h), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: displayFeed, + ), + )), + ), ), ), - ), - )), + )), + ), ), IgnorePointer( child: Container( diff --git a/justMUSIC/pubspec.lock b/justMUSIC/pubspec.lock index bbae3a5..bbc6777 100644 --- a/justMUSIC/pubspec.lock +++ b/justMUSIC/pubspec.lock @@ -29,6 +29,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.1" + circular_reveal_animation: + dependency: "direct main" + description: + name: circular_reveal_animation + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" clock: dependency: transitive description: diff --git a/justMUSIC/pubspec.yaml b/justMUSIC/pubspec.yaml index 6666edd..036e576 100644 --- a/justMUSIC/pubspec.yaml +++ b/justMUSIC/pubspec.yaml @@ -44,6 +44,7 @@ dependencies: auto_size_text: ^3.0.0 gradient_borders: ^1.0.0 text_scroll: ^0.2.0 + circular_reveal_animation: ^2.0.1 dev_dependencies: flutter_test: