main.dart
import 'package:flutter/material.dart';
void main() => runApp(const FlutterExample());
class FlutterExample extends StatelessWidget {
const FlutterExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Example',
theme: ThemeData(primarySwatch: Colors.red),
home: const StateExample()
);
}
}
class StateExample extends StatefulWidget {
const StateExample({Key? key}) : super(key: key);
@override
_StateExampleState createState() => _StateExampleState();
}
class _StateExampleState extends State<StateExample>{
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFFEFEFA),
appBar: AppBar(
title: const Text("Flutter - Container Transform")
),
body: bodyContent(),
);
}
bodyContent() {
return Center(
child: Container(
child: const Text(
"I am a Text",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
transform: Matrix4.rotationZ(0.3),
padding: const EdgeInsets.all(30),
margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.blue[500],
borderRadius: BorderRadius.circular(20)
)
),
);
}
}
![](https://fluttertuts.wordpress.com/wp-content/uploads/2021/05/20f15-fluttercontainertransformexample.png)
More flutter tutorials
- flutter – Image network
- flutter – ListView example
- flutter – ListView infinite list
- flutter – ListView horizontal height
- flutter – ListView card
- flutter – ListView remove item
- flutter – ListView add item
- flutter – Container shape
- flutter – Container shape circle
- flutter – Container shadow only bottom
- flutter – Container elevation
- flutter – Container background image
- flutter – RotatedBox example
- flutter – AnimatedPadding example
- flutter – How to use OutlinedButton