Skip to content

Instantly share code, notes, and snippets.

@Schwusch
Last active December 5, 2019 10:01
Show Gist options
  • Save Schwusch/8a1b3992fd5c1686f2c66b6d9269cfe2 to your computer and use it in GitHub Desktop.
Save Schwusch/8a1b3992fd5c1686f2c66b6d9269cfe2 to your computer and use it in GitHub Desktop.
blog_examples
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