bytedesk-flutter/bytedesk_demo/lib/notification/custom_animation.dart

25 lines
721 B

4 years ago
import 'package:flutter/material.dart';
import 'ios_toast.dart';
/// Example to show how to popup overlay with custom animation.
class CustomAnimationToast extends StatelessWidget {
4 years ago
final double? value;
4 years ago
static final Tween<Offset> tweenOffset = Tween<Offset>(begin: Offset(0, 40), end: Offset(0, 0));
static final Tween<double> tweenOpacity = Tween<double>(begin: 0, end: 1);
4 years ago
const CustomAnimationToast({Key? key, @required this.value}) : super(key: key);
4 years ago
@override
Widget build(BuildContext context) {
return Transform.translate(
4 years ago
offset: tweenOffset.transform(value!),
4 years ago
child: Opacity(
child: IosStyleToast(),
4 years ago
opacity: tweenOpacity.transform(value!),
4 years ago
),
);
}
}