Last active
December 5, 2019 10:01
-
-
Save Schwusch/8a1b3992fd5c1686f2c66b6d9269cfe2 to your computer and use it in GitHub Desktop.
blog_examples
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) => MaterialApp( | |
home: TiltedPyramid(), | |
); | |
} | |
class TiltedPyramid extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => Scaffold( | |
body: Center( | |
child: Stack( | |
alignment: Alignment.center, | |
children: List.generate( | |
25, | |
(index) => Transform( | |
transform: Matrix4.identity() | |
..translate(-index * 5.0, -index * 5.0, 0) | |
..setEntry(3, 2, 0.001) | |
..rotateX(-0.06 * index) | |
..rotateY(0.06 * index) | |
..rotateZ(-0.01 * index), | |
alignment: FractionalOffset.center, | |
child: Container( | |
height: 200.0 - 7 * index, | |
width: 200.0 - 7 * index, | |
decoration: BoxDecoration( | |
border: Border.all(), | |
gradient: LinearGradient( | |
begin: Alignment.centerLeft, | |
end: Alignment.centerRight, | |
stops: [0.1, 0.9], | |
colors: [Colors.green, Colors.red], | |
), | |
), | |
), | |
), | |
), | |
), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment