Created
July 26, 2020 01:27
-
-
Save cshannon3/74e08e91a0c10a5a1fde2a1ada002616 to your computer and use it in GitHub Desktop.
Day 1 Component from Portfolio Page- based off http://www.jonathanpatterson.com/product-design-portfolio.html
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:flutter/material.dart'; | |
void main() {runApp(MyApp());} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Container( | |
color: Colors.red, child: Stack(children: [VisionText()])))); | |
} | |
} | |
class VisionText extends StatefulWidget { | |
@override | |
_VisionTextState createState() => _VisionTextState(); | |
} | |
class _VisionTextState extends State<VisionText> | |
with SingleTickerProviderStateMixin { | |
AnimationController controller; | |
Animation<double> animation; | |
@override | |
void initState() { | |
super.initState(); | |
controller = | |
AnimationController(duration: const Duration(seconds: 1), vsync: this); | |
animation = Tween<double>(begin: 0, end: 1.0).animate(new CurvedAnimation( | |
parent: controller, | |
curve: new Interval(0.0, 1.0, curve: Curves.easeIn))) | |
..addListener(() { | |
setState(() {}); | |
}); | |
controller.forward(from: 0.0); | |
} | |
@override | |
void dispose() { | |
controller.dispose(); | |
super.dispose(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
double fontWidth = 900; | |
Size s = MediaQuery.of(context).size; | |
return Positioned( | |
top: 100.0, | |
left: (s.width - fontWidth) / 2, | |
child: Container( | |
height: 450, | |
width: fontWidth, | |
child: Transform( | |
origin: Offset(350.0, 200.0), | |
transform: Matrix4.skewX(-animation.value * 0.5 + 0.5) | |
..rotateZ(-animation.value * 0.5 + 0.5) | |
..scale(animation.value * 0.5 + | |
0.5), | |
child: Text( | |
"VISION", | |
style: TextStyle( | |
fontSize: 260.0, | |
color: Colors.white.withOpacity(animation.value)), | |
), | |
), | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment