Skip to content

Instantly share code, notes, and snippets.

@imaNNeo
Created November 13, 2020 08:16
Show Gist options
  • Select an option

  • Save imaNNeo/f26311f5e74e69de921fc97510e00a7a to your computer and use it in GitHub Desktop.

Select an option

Save imaNNeo/f26311f5e74e69de921fc97510e00a7a to your computer and use it in GitHub Desktop.
import 'dart:ui';
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() {
runApp(MyApp());
}
// Degree / Radians converter
const double degrees2Radians = math.pi / 180.0;
const double radians2Degrees = 180.0 / math.pi;
double degrees(double radians) => radians * radians2Degrees;
double radians(double degrees) => degrees * degrees2Radians;
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter 4 Fun',
home: MainPage(),
);
}
}
class MainPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final rowHeight = 300.0;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
title: Text('Flutter4Fun.com'),
),
backgroundColor: Color(0xffFF6958),
body: Center(
child: Container(
height: 240,
child: Stack(
alignment: Alignment.center,
children: [
Transform.translate(
offset: Offset(-10, 0),
child: Transform(
alignment: FractionalOffset.center,
transform: Matrix4.identity()
..setEntry(3, 2, 0.01)
..rotateY(radians(1.5)),
child: Container(
height: 216,
margin: EdgeInsets.symmetric(horizontal: 40),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.1),
borderRadius: BorderRadius.all(Radius.circular(22)),
),
),
),
),
Transform.translate(
offset: Offset(-44, 0),
child: Transform(
alignment: FractionalOffset.center,
transform: Matrix4.identity()
..setEntry(3, 2, 0.01)
..rotateY(radians(8)),
child: Container(
height: 188,
margin: EdgeInsets.symmetric(horizontal: 40),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.4),
borderRadius: BorderRadius.all(Radius.circular(22)),
),
),
),
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment