mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
animations: Add flutter_animate (#1681)
This commit is contained in:
@@ -112,6 +112,11 @@ final miscDemos = [
|
|||||||
route: CardSwipeDemo.routeName,
|
route: CardSwipeDemo.routeName,
|
||||||
builder: (context) => const CardSwipeDemo(),
|
builder: (context) => const CardSwipeDemo(),
|
||||||
),
|
),
|
||||||
|
Demo(
|
||||||
|
name: 'Flutter Animate',
|
||||||
|
route: FlutterAnimateDemo.routeName,
|
||||||
|
builder: (context) => const FlutterAnimateDemo(),
|
||||||
|
),
|
||||||
Demo(
|
Demo(
|
||||||
name: 'Repeating Animation',
|
name: 'Repeating Animation',
|
||||||
route: RepeatingAnimationDemo.routeName,
|
route: RepeatingAnimationDemo.routeName,
|
||||||
|
|||||||
43
animations/lib/src/misc/flutter_animate.dart
Normal file
43
animations/lib/src/misc/flutter_animate.dart
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2023 The Flutter team. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
|
|
||||||
|
// Demonstrating the `flutter_animate` package
|
||||||
|
class FlutterAnimateDemo extends StatelessWidget {
|
||||||
|
static const String routeName = 'misc/flutter_animate';
|
||||||
|
|
||||||
|
const FlutterAnimateDemo({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Flutter Animate Demo'),
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Text(
|
||||||
|
"Hello Flutter Animate",
|
||||||
|
style: Theme.of(context).textTheme.headlineLarge,
|
||||||
|
)
|
||||||
|
.animate(
|
||||||
|
onPlay: (controller) => controller.repeat(),
|
||||||
|
)
|
||||||
|
.then(delay: 250.ms)
|
||||||
|
.fadeIn(duration: 500.ms)
|
||||||
|
.then(delay: 250.ms)
|
||||||
|
.shimmer(duration: 400.ms)
|
||||||
|
.then(delay: 250.ms)
|
||||||
|
.slide()
|
||||||
|
.then(delay: 250.ms)
|
||||||
|
.blur(duration: 500.ms)
|
||||||
|
.then(delay: 100.ms),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ export 'card_swipe.dart';
|
|||||||
export 'carousel.dart';
|
export 'carousel.dart';
|
||||||
export 'curved_animation.dart';
|
export 'curved_animation.dart';
|
||||||
export 'expand_card.dart';
|
export 'expand_card.dart';
|
||||||
|
export 'flutter_animate.dart';
|
||||||
export 'focus_image.dart';
|
export 'focus_image.dart';
|
||||||
export 'hero_animation.dart';
|
export 'hero_animation.dart';
|
||||||
export 'physics_card_drag.dart';
|
export 'physics_card_drag.dart';
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_animate: ^4.1.0
|
||||||
go_router: ^6.0.0
|
go_router: ^6.0.0
|
||||||
window_size: # plugin is not yet part of the flutter framework
|
window_size: # plugin is not yet part of the flutter framework
|
||||||
git:
|
git:
|
||||||
|
|||||||
Reference in New Issue
Block a user