当前位置:网站首页>flutter系列之:flutter中的变形金刚Transform
flutter系列之:flutter中的变形金刚Transform
2022-06-27 21:23:00 【InfoQ】
简介
Transform简介
class Transform extends SingleChildRenderObjectWidget
const Transform({
Key? key,
required this.transform,
this.origin,
this.alignment,
this.transformHitTests = true,
this.filterQuality,
Widget? child,
}) : assert(transform != null),
super(key: key, child: child);
Transform.rotate({
Key? key,
required double angle,
this.origin,
this.alignment = Alignment.center,
this.transformHitTests = true,
this.filterQuality,
Widget? child,
}) : transform = Matrix4.rotationZ(angle),
super(key: key, child: child);
Transform.translate({
Key? key,
required Offset offset,
this.transformHitTests = true,
this.filterQuality,
Widget? child,
}) : transform = Matrix4.translationValues(offset.dx, offset.dy, 0.0),
origin = null,
alignment = null,
super(key: key, child: child);
Transform.scale({
Key? key,
required double scale,
this.origin,
this.alignment = Alignment.center,
this.transformHitTests = true,
this.filterQuality,
Widget? child,
}) : transform = Matrix4.diagonal3Values(scale, scale, 1.0),
super(key: key, child: child);
Transform的使用
Widget build(BuildContext context) {
return Center(
child: Transform.rotate(
angle: pi/4,
child: const Icon(
Icons.airplanemode_active,
size: 200,
color: Colors.blue,
),
));
}

return Transform.translate(
offset:const Offset(50.0, 100.0),
child: const Icon(
Icons.airplanemode_active,
size: 200,
color: Colors.blue,
),
);

return Transform.scale(
scale: 0.5,
child: const Icon(
Icons.airplanemode_active,
size: 200,
color: Colors.blue,
),
);

总结
边栏推荐
- How to use the apipost script - global variables
- 思源笔记订阅停止直接删云端数据嘛?
- Does the subscription of Siyuan notes stop deleting cloud data directly?
- C WinForm reads the resources picture
- 零基础自学SQL课程 | SQL基本函数大全
- 小程序referer
- 抓出那些重复的基因
- 通过中金证券经理的开户二维码开股票账户安全吗?还是去证券公司开户安全?
- MSP430F5529 单片机 读取 GY-906 红外温度传感器
- 十大券商注册账户安全吗,会有风险吗?
猜你喜欢
随机推荐
Swing UI——容器(一)
Zero foundation self-study SQL course | case function
C language character pointer and string initialization
How to set the enterprise wechat group robots to send messages regularly?
零基础自学SQL课程 | IF函数
【tinyriscv verilator】分支移植到正点原子达芬奇开发板
获取基因有效长度的N种方法
Google Earth Engine(GEE) 03-矢量数据类型
c语言-日期格式化[通俗易懂]
The file or assembly 'cefsharp.core.runtime.dll' or one of its dependencies could not be loaded. Is not a valid Win32 Application. (exception from hresult:0x800700c1)
ASP.NET仓库进销存ERP管理系统源码 ERP小程序源码
[PCL self study: pclplotter] pclplotter draws data analysis chart
Does the subscription of Siyuan notes stop deleting cloud data directly?
安全省油環保 駱駝AGM啟停電池魅力十足
Super outline exercises
赛尔笔记|视频文本预训练简述
Grab those duplicate genes
Use of go log package log
【剑指Offer】47. 礼物的最大价值
【剑指Offer】48. 最长不含重复字符的子字符串