animation on loading of the list

pull/14/head
Lucas Delanier 2 years ago
parent 4a4280bb2e
commit 9cf5c4d4fa

@ -30,6 +30,13 @@
</list>
</value>
</entry>
<entry key="circular_reveal_animation">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/circular_reveal_animation-2.0.1/lib" />
</list>
</value>
</entry>
<entry key="clock">
<value>
<list>
@ -352,6 +359,7 @@
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/auto_size_text-3.0.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/characters-1.2.1/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/circular_reveal_animation-2.0.1/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/clock-1.1.1/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/collection-1.16.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/crypto-3.0.2/lib" />

@ -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<FeedScreen> createState() => _FeedScreenState();
}
class _FeedScreenState extends State<FeedScreen> {
class _FeedScreenState extends State<FeedScreen>
with SingleTickerProviderStateMixin {
late AnimationController animationController;
late Animation<double> animation;
List<PostComponent> friendFeed = [
PostComponent(),
PostComponent(),
@ -26,19 +30,32 @@ class _FeedScreenState extends State<FeedScreen> {
@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,7 +66,11 @@ class _FeedScreenState extends State<FeedScreen> {
backgroundColor: bgColor,
body: Stack(
children: [
SingleChildScrollView(
CircularRevealAnimation(
animation: animation,
// centerAlignment: Alignment.centerRight,
centerOffset: Offset(70, 0),
child: SingleChildScrollView(
child: SizedBox(
width: double.infinity,
child: Align(
@ -73,6 +94,7 @@ class _FeedScreenState extends State<FeedScreen> {
),
)),
),
),
IgnorePointer(
child: Container(
height: 240.h,

@ -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:

@ -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:

Loading…
Cancel
Save