当前位置:网站首页>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;
}
}
边栏推荐
- Crmeb second open SMS function tutorial
- DBMS in Oracle_ output. put_ How to use line
- How to write vite plug-ins
- Strengthen the sense of responsibility and bottom line thinking to build a "safety dike" for flood fighting and rescue
- Has aaig really awakened its AI personality after reading the global June issue (Part 1)? Which segment of NLP has the most social value? Get new ideas and inspiration ~
- Former amd chip architect roast said that the cancellation of K12 processor project was because amd counseled!
- vulnhub靶机Os-hackNos-1
- ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
- Getting started with reverse debugging - learn about PE structure files
- 2022 年以后,对AI开发人员意味着什么
猜你喜欢

How to solve the task cache compilation problem caused by gradle build cache

Androd Gradle模块依赖替换如何使用

Basic data types of C language and their printouts

Modelsim 安装步骤详解

【深入理解TcaplusDB技术】Tmonitor系统升级

微信小程序之flex属性

Actual combat | how to make a slam track truth acquisition device?

微信小程序之input调整

实战 | 如何制作一个SLAM轨迹真值获取装置?

Quartus call & design D trigger Simulation & timing wave verification
随机推荐
边缘和物联网学术资源
Scope of groovy
Filtre de texte en ligne inférieur à l'outil de longueur spécifiée
Shell process control - 39. Special process control statements
KS008基于SSM的新闻发布系统
Quartus call & design D trigger Simulation & timing wave verification
The way out after the development of Internet technology -- the birth of IVX
理解ADT与OOP
微信小程序之flex属性
Basic data types of C language and their printouts
从类、API、框架三个层面学习如何设计可复用软件的学习心得
How did Tencent's technology bulls complete the overall cloud launch?
Crmeb second open SMS function tutorial
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
Configure SSH Remote Login for H3C switch
Overview of national parks in the United States
CRMEB 二开短信功能教程
kubernetes日志监控系统架构详解
Input adjustment of wechat applet
20000 words + 30 pictures | MySQL log: what is the use of undo log, redo log and binlog?