v0.3.0
flutter_animate_on_scroll
基於滾動事件動畫化元件的 Flutter 套件。輕鬆創造令人著迷的互動式滾動動畫,以提升您的使用者介面。
48喜歡 106近 30 天下載160Pub 分數
AndroidiOSWebmacOSWindowsLinux
一個用於滾動時動畫的Flutter動畫套件。
以下為英文專案原文快照,最新內容請造訪 GitHub。
Enables you to create flutter animations on scroll, faster, efficient and with less code.
Put the dependency inside your pubspec.yml and run packages get.
Provide required child [Widget], you can play with animation delay, curves, duration...
import './src/components/custom_info.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate_on_scroll/flutter_animate_on_scroll.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20).copyWith(top: 80),
child: Column(
children: [
FadeIn(
config: BaseAnimationConfig(
child: const CustomInfo(name: 'Fade In')
),
),
const SizedBox(height: 20),
FadeInDown(
config: BaseAnimationConfig(
delay: 200.ms,
child: const CustomInfo(name: 'Fade In Down'),
),
),
const SizedBox(height: 20),
FadeInUp(
config: BaseAnimationConfig(
delay: 400.ms,
child: const CustomInfo(name: 'Fade In Up'),
),
),
const SizedBox(height: 20),
FadeInLeft(
config: BaseAnimationConfig(
delay: 600.ms,
child: const CustomInfo(name: 'Fade In Left'),
),
),
const SizedBox(height: 20),
FadeInRight(
config: BaseAnimationConfig(
delay: 200.ms,
child: const CustomInfo(name: 'Fade In Right'),
),
),
const SizedBox(height: 20),
const Divider(),
FadeOut(
config: BaseAnimationConfig(
delay: 400.ms,
child: const CustomInfo(name: 'Fade Out'),
),
),
const SizedBox(height: 20),
FadeOutUp(
config: BaseAnimationConfig(
delay: 600.ms,
child: const CustomInfo(name: 'Fade Out Up'),
),
),
const SizedBox(height: 20),
FadeOutDown(
config: BaseAnimationConfig(
delay: 800.ms,
child: const CustomInfo(name: 'Fade Out Down'),
),
),
const SizedBox(height: 20),
FadeOutLeft(
config: BaseAnimationConfig(
delay: 400.ms,
child: const CustomInfo(name: 'Fade Out Left'),
),
),
const SizedBox(height: 20),
FadeOutRight(
config: BaseAnimationConfig(
delay: 600.ms,
child: const CustomInfo(name: 'Fade Out Right'),
),
),
const SizedBox(height: 220),
],
),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_animate_on_scroll/flutter_animate_on_scroll.dart';
import '../components/custom_info.dart';
class CustomAnimationExample extends StatefulWidget {
const CustomAnimationExample({super.key});
@override
State<CustomAnimationExample> createState() => _CustomAnimationExampleState();
}
class _CustomAnimationExampleState extends State<CustomAnimationExample>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin{
late AnimationController _animationController;
late Animation<double> _animation;
@override
void initState() {
_animationController = AnimationController(vsync: this, duration: 600.ms);
_animation = Tween<double>(begin: 0.3, end: 1.0).animate(
CurvedAnimation(parent: _animationController, curve: Curves.bounceInOut),
);
super.initState();
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20).copyWith(top: 80),
child: Column(
children: [
CustomAnimated(
animationController: _animationController,
animation: _animation,
child: ScaleTransition(
scale: _animation,
child: const CustomInfo(name: 'Custom Animation'),
),
),
const SizedBox(height: 20),
const Divider(),
const SizedBox(height: 220),
],
),
),
),
);
}
}
https://github.com/FadiChaalab/flutter_animate_on_scroll/assets/58008170/25ed91f2-e2b0-4321-a077-b22248e69f55
依賴清單 3 項
{"sdk":"flutter"}{"sdk":"flutter"}^5.0.0先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗