当前位置:网站首页>Shutter clip clipping component
Shutter clip clipping component
2022-06-23 13:54:00 【xiangxiongfly915】
List of articles
Flutter Clip Clipping components
sketch
Flutter Some clipping tools are provided , For clipping components .
Use
Original picture

Image.asset("images/avatar.jpg", width: 100, height: 100);
ClipRect
Rectangular clipping .

ClipRect(
child: Align(
child: avatar,
alignment: Alignment.topCenter,
heightFactor: 0.5,
),
)
ClipOval
Round cut .

ClipOval(
child: avatar,
clipBehavior: Clip.antiAlias, // Anti-Aliasing , Usually used to deal with circles and arcs
)
ClipRRect
Rectangle fillet clipping .

ClipRRect(
child: avatar,
borderRadius: BorderRadius.circular(10),
)
ClipPath
Path clipping .
shape:ShapeBorder type , Define clipping shapes .
- RoundedRectangleBorder: Rounded rectangle .
- ContinuousRectangleBorder: Smooth transition between line and fillet , And RoundedRectangleBorder similar , But the fillet effect is smaller .
- StadiumBorder: Like a football field , Half round at both ends .
- BeveledRectangleBorder: Beveled rectangle .

ClipPath.shape(
shape: const StadiumBorder(),
child: SizedBox(
width: 100,
height: 60,
child: Image.asset("images/avatar.jpg", fit: BoxFit.cover),
),
),
Custom clipping

Container(
color: Colors.red,
child: ClipRect(
clipper: MyClipper1(),
child: avatar,
),
)
class MyClipper1 extends CustomClipper<Rect> {
@override
Rect getClip(Size size) {
return const Rect.fromLTWH(0, 0, 30, 30);
}
@override
bool shouldReclip(covariant CustomClipper<Rect> oldClipper) {
return false;
}
}

Container(
color: Colors.green,
child: ClipPath(
clipper: TrianglePath(),
child: avatar,
),
)
class TrianglePath extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.moveTo(size.width / 2, 0);
path.lineTo(0, size.height);
path.lineTo(size.width, size.height);
path.close();
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
return true;
}
}
边栏推荐
- windows 安装 MySQL
- 爱思唯尔-Elsevier期刊的校稿流程记录(Proofs)(海王星Neptune)(遇到问题:latex去掉章节序号)
- leetcode:42.接雨水
- Simplify deployment with openvino model server and tensorflow serving
- [Yunzhou said live room] - digital security special session will be officially launched tomorrow afternoon
- 栈和队列的基本使用
- [untitled]
- What a talented company that can turn SAP system into a chicken rib!
- 微信小程序之flex属性
- Detailed explanation of serial port, com, UART, TTL, RS232 (485) differences
猜你喜欢
随机推荐
php接收和发送数据
【深入理解TcaplusDB技术】单据受理之表管理
First exposure! The only Alibaba cloud native security panorama behind the highest level in the whole domain
[untitled]
Use xtradiagram Diagramcontrol for drawing and controlling process graphics
Input adjustment of wechat applet
vulnhub靶机Os-hackNos-1
前AMD芯片架构师吐槽,取消 K12 处理器项目是因为 AMD 怂了!
2022软科大学专业排名出炉!西电AI专业排名超清北,南大蝉联全国第一 !
Stick to five things to get you out of your confusion!
In depth analysis of mobilenet and its variants
How to use androd gradle module dependency replacement
Yyds dry inventory solution sword finger offer: judge whether it is a balanced binary tree
What does it mean for AI developers after 2022
Scope of groovy
sed -i命令怎么使用
实战 | 如何制作一个SLAM轨迹真值获取装置?
Overview of national parks in the United States
【课程预告】基于飞桨和OpenVINO 的AI表计产业解决方案 | 工业读表与字符检测
Interrupt and polling







