Created
February 16, 2020 09:40
-
-
Save ryanlid/511f767d40447085b61ff11043b405d1 to your computer and use it in GitHub Desktop.
Transform 矩阵转换
This file contains 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(MaterialApp( | |
title: "Transform矩阵转换示例", | |
home: LayoutDemo(), | |
)); | |
} | |
class LayoutDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Transform矩阵转换示例"), | |
), | |
body: Center( | |
// 父容器作为背景 | |
child: Container( | |
// 背景颜色 | |
color: Colors.grey, | |
// 矩阵转换 | |
child: Transform( | |
// 对齐方式 | |
alignment: Alignment.topRight, | |
// 设置旋转值 | |
transform: Matrix4.rotationZ(0.3), | |
// 设置旋转容器 | |
child: Container( | |
padding: EdgeInsets.all(0.8), | |
color: Color(0xFFE8581C), | |
child: Text("Transform矩阵转换示例"), | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment