Created
December 6, 2022 16:05
-
-
Save HansMuller/f7b3acb6c8d05fa9893bbeb291921015 to your computer and use it in GitHub Desktop.
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 'dart:ui' show lerpDouble; | |
import 'package:flutter/material.dart'; | |
class Home extends StatefulWidget { | |
const Home({ super.key }); | |
@override | |
State<Home> createState() => _HomeState(); | |
} | |
class _HomeState extends State<Home> with SingleTickerProviderStateMixin { | |
double opacity = 1.0; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: AnimatedOpacity( | |
opacity: opacity, | |
duration: Duration(milliseconds: 400), | |
child: TextButton( | |
onPressed: () { | |
setState(() { opacity -= 0.2; }); | |
}, | |
child: Text('Press Me'), | |
), | |
), | |
), | |
); | |
} | |
} | |
void main() { | |
runApp( | |
MaterialApp( | |
theme: ThemeData.light(useMaterial3: true), | |
home: Home(), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment