Skip to content

Instantly share code, notes, and snippets.

View letsar's full-sized avatar
🦋
Flutter forever

Romain Rastel letsar

🦋
Flutter forever
View GitHub Profile
@letsar
letsar / slidable_in_depth_05.dart
Created August 24, 2018 13:44
slidable_in_depth_05
// For the main actions we have to reverse the order if we want the last item at the bottom of the stack.
int displayIndex = showActions ? count - index - 1 : index;
return ctx.createPositioned(
position: animations[index].value,
extent: actionExtent,
child: actionDelegate.build(context, displayIndex,
actionsMoveAnimation, SlidableRenderingMode.slide),
);
import 'dart:async';
import 'package:flutter/material.dart';
const _kDuration = const Duration(milliseconds: 4000);
const _kActionSize = 64.0;
const _kCount = 3;
const _kAnimInterval01 = const Interval(.00, .30);
const _kAnimInterval02 = const Interval(.00, .30);
const _kDuration = const Duration(milliseconds: 4000);
const _kActionSize = 64.0;
const _kCount = 3;
const _kAnimInterval01 = const Interval(.00, .30);
const _kAnimInterval02 = const Interval(.00, .30);
const _kAnimInterval03 = const Interval(.30, .60);
const _kAnimInterval04 = const Interval(.60, .90);
/// Animates the skew of transformed widget.
class SkewTransition extends AnimatedWidget {
/// Creates a skew transition.
///
/// The [skew] argument must not be null.
const SkewTransition({
Key key,
@required Animation<double> skew,
this.child,
}) : super(key: key, listenable: skew);
SlidableDrawerDelegateAnimation({
Key key,
this.controller,
}) : dxPositions = <Animation<Offset>>[
Tween<Offset>(
begin: Offset(-1.0, 0.0),
end: Offset(1.0, 0.0),
).animate(
CurvedAnimation(
parent: controller,
Widget _buildAnimation(BuildContext context, Widget child) {
return Container(
child: SkewTransition(
skew: skewTransform1,
child: SkewTransition(
skew: skewTransform2,
child: Container(
width: _kActionSize * 4,
height: 256.0,
color: Colors.black87,
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
builder: _buildAnimation,
animation: controller,
);
}
class SlidableDrawerDelegateDemo extends StatefulWidget {
@override
_SlidableDrawerDelegateDemoState createState() =>
new _SlidableDrawerDelegateDemoState();
}
class _SlidableDrawerDelegateDemoState extends State<SlidableDrawerDelegateDemo>
with TickerProviderStateMixin {
AnimationController _controller;
Tween<Offset>(
begin: Offset(-1.0, 0.0),
end: Offset(0.0, 0.0),
).animate(
CurvedAnimation(
parent: controller,
curve: Interval(.30, .60),
),
),
const _kAnimInterval01 = const Interval(.00, .30);
const _kAnimInterval02 = const Interval(.00, .30);
const _kAnimInterval03 = const Interval(.30, .60);
const _kAnimInterval04 = const Interval(.60, .90);
const _kAnimInterval05 = const Interval(.60, .90);