Skip to content

Instantly share code, notes, and snippets.

View SahanAmarsha's full-sized avatar
🏠
Working from home

Sahan Amarsha SahanAmarsha

🏠
Working from home
View GitHub Profile
@SahanAmarsha
SahanAmarsha / live.gif
Last active May 28, 2020 20:32
Lions Cricke App- Live Cricket Match updates streaming app and recent or upcoming matches details also can be viewed in this app
live.gif
@SahanAmarsha
SahanAmarsha / pulse_animation_controller.dart
Last active May 27, 2022 15:39
Defining a Pulse/Resize Animation in Flutter
AnimationController _controller;
Animation<Size> _myAnimation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 1000),
@SahanAmarsha
SahanAmarsha / basic_layout.dart
Last active June 5, 2020 10:28
Basic layout for showcase animations
import 'package:flutter/material.dart';
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin{
//*-----defining animation and animation controller-----*
@SahanAmarsha
SahanAmarsha / heart_animation.dart
Last active June 5, 2020 10:57
How to use heart animation using Animation Buidler Widget
body: Center(
child:
AnimatedBuilder(animation: _myAnimation,
builder: (ctx, ch) => Container(
width: _myAnimation.value.width,
height: _myAnimation.value.height,
decoration: BoxDecoration(
image: new DecorationImage(
image: new AssetImage(
@SahanAmarsha
SahanAmarsha / fade_animation_controller.dart
Last active June 5, 2020 11:20
How to define a fade animation in your Flutter app
AnimationController _controller;
Animation _myAnimation;
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 1200),
@SahanAmarsha
SahanAmarsha / fade_animation.dart
Created June 5, 2020 10:54
Hot to use Fade Animations in Flutter
body: Center(
child:
FadeTransition(
opacity: _myAnimation,
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
image: new DecorationImage(
image: new AssetImage(
@SahanAmarsha
SahanAmarsha / slide_animation_controller.dart
Created June 5, 2020 11:42
Defining a Slide Transition for Flutter App
AnimationController _controller;
Animation<Offset> _myAnimation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
@SahanAmarsha
SahanAmarsha / slide_animation.dart
Created June 5, 2020 11:56
Using the SlideTransition widget to animate
body: Center(
child:
SlideTransition(
position: _myAnimation,
child: const Padding(
padding: EdgeInsets.all(8.0),
child: FlutterLogo(size: 150.0),
),
),
),
@SahanAmarsha
SahanAmarsha / flip_animation_controller.dart
Created June 9, 2020 17:01
Defining the Flip Animation
AnimationController _controller;
Animation _myAnimation;
AnimationStatus _animationStatus = AnimationStatus.dismissed;
@override
void initState() {
super.initState();
_controller =
AnimationController(vsync: this, duration: Duration(seconds: 1));
@SahanAmarsha
SahanAmarsha / flip_animation.dart
Created June 9, 2020 17:03
Implementing the 3d Flip Animation
body: Center(
child: Transform(
alignment: FractionalOffset.center,
transform: Matrix4.identity()
..setEntry(3, 2, 0.002)
..rotateX(pi*(_myAnimation.value)),
child: Container(
color: Colors.blueAccent,
width: 200,
height: 200,