animation on loading of the list

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

@ -30,6 +30,13 @@
</list> </list>
</value> </value>
</entry> </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"> <entry key="clock">
<value> <value>
<list> <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/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/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/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/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/collection-1.16.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/crypto-3.0.2/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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -13,7 +14,10 @@ class FeedScreen extends StatefulWidget {
State<FeedScreen> createState() => _FeedScreenState(); 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 = [ List<PostComponent> friendFeed = [
PostComponent(), PostComponent(),
PostComponent(), PostComponent(),
@ -26,19 +30,32 @@ class _FeedScreenState extends State<FeedScreen> {
@override @override
void initState() { void initState() {
displayFeed = friendFeed;
super.initState(); 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) { void changeFeed(bool choice) {
// Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre // Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre
if (choice) { if (choice) {
setState(() { setState(() {
animationController.reset();
displayFeed = friendFeed; displayFeed = friendFeed;
animationController.forward();
}); });
} else { } else {
setState(() { setState(() {
animationController.reset();
displayFeed = discoveryFeed; displayFeed = discoveryFeed;
animationController.forward();
}); });
} }
} }
@ -49,7 +66,11 @@ class _FeedScreenState extends State<FeedScreen> {
backgroundColor: bgColor, backgroundColor: bgColor,
body: Stack( body: Stack(
children: [ children: [
SingleChildScrollView( CircularRevealAnimation(
animation: animation,
// centerAlignment: Alignment.centerRight,
centerOffset: Offset(70, 0),
child: SingleChildScrollView(
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: Align( child: Align(
@ -73,6 +94,7 @@ class _FeedScreenState extends State<FeedScreen> {
), ),
)), )),
), ),
),
IgnorePointer( IgnorePointer(
child: Container( child: Container(
height: 240.h, height: 240.h,

@ -29,6 +29,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.1" 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: clock:
dependency: transitive dependency: transitive
description: description:

@ -44,6 +44,7 @@ dependencies:
auto_size_text: ^3.0.0 auto_size_text: ^3.0.0
gradient_borders: ^1.0.0 gradient_borders: ^1.0.0
text_scroll: ^0.2.0 text_scroll: ^0.2.0
circular_reveal_animation: ^2.0.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save