Last active
October 19, 2025 14:15
-
-
Save chooyan-eng/7864595840215a5876a1fbddcf58d18c to your computer and use it in GitHub Desktop.
for Flutter Alliance 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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