jelly_animation 0.0.1
jelly_animation: ^0.0.1 copied to clipboard
A lightweight Flutter widget that wraps any child with a smooth, continuous jelly-like breathing animation using sine curves and scale transforms.
import 'package:flutter/material.dart';
import 'package:jelly_animation/jelly_animation.dart';
void main() => runApp(const JellyExampleApp());
class JellyExampleApp extends StatelessWidget {
const JellyExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData.dark(useMaterial3: true),
home: const JellyPlayground(),
);
}
}
class JellyPlayground extends StatefulWidget {
const JellyPlayground({super.key});
@override
State<JellyPlayground> createState() => _JellyPlaygroundState();
}
class _JellyPlaygroundState extends State<JellyPlayground> {
bool _enabled = true;
double _scaleAmount = 0.08;
double _durationMs = 1000;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Jelly Animation Example')),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
// Basic usage — wrap any widget with JellyWidget
JellyWidget(
enabled: _enabled,
scaleAmount: _scaleAmount,
duration: Duration(milliseconds: _durationMs.round()),
child: Container(
width: 140,
height: 140,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Colors.deepOrange, Colors.amber],
),
borderRadius: BorderRadius.circular(32),
),
child: const Icon(Icons.favorite, size: 56, color: Colors.white),
),
),
const Spacer(),
// Controls
SwitchListTile(
title: const Text('Enabled'),
value: _enabled,
onChanged: (v) => setState(() => _enabled = v),
),
ListTile(
title: Text('Scale: ${_scaleAmount.toStringAsFixed(2)}'),
subtitle: Slider(
value: _scaleAmount,
min: 0.01,
max: 0.25,
onChanged: (v) => setState(() => _scaleAmount = v),
),
),
ListTile(
title: Text('Duration: ${_durationMs.round()} ms'),
subtitle: Slider(
value: _durationMs,
min: 200,
max: 3000,
onChanged: (v) => setState(() => _durationMs = v),
),
),
const SizedBox(height: 24),
],
),
);
}
}