Skip to content

Instantly share code, notes, and snippets.

@chooyan-eng
Last active October 19, 2025 14:15
Show Gist options
  • Select an option

  • Save chooyan-eng/7864595840215a5876a1fbddcf58d18c to your computer and use it in GitHub Desktop.

Select an option

Save chooyan-eng/7864595840215a5876a1fbddcf58d18c to your computer and use it in GitHub Desktop.
for Flutter Alliance 2025
import 'package:animated_to/animated_to.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool _isTop = true;
final _title = 'AnimatedTo Changes\nYour Moving Animations, but How?';
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() => _isTop = !_isTop);
},
child: Container(
width: double.infinity,
height: double.infinity,
padding: const EdgeInsets.all(20),
child: Align(
alignment: _isTop ? Alignment.topCenter : Alignment.bottomCenter,
child: AnimatedTo.spring(
globalKey: GlobalObjectKey(_title),
child: Text(
_title,
style: TextStyle(fontSize: 24),
textAlign: TextAlign.center,
),
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment