当前位置:网站首页>初识 Flutter 的绘图组件 — CustomPaint
初识 Flutter 的绘图组件 — CustomPaint
2022-06-25 04:01:00 【岛上码农】
简介
在有些场景中,我们会需要绘制一些高度定制化的组件,比如 UI 设计师给我们出了个难题 —— 弄一个奇形怪状的边框。看在 UI 设计师是一个漂亮小姐姐的份上,又不好意思说这个做不了(那样也很没面子)。这个时候我们就不能直接使用 Flutter 自带的那些组件了,而是需要手动绘制组件,那就会需要用到 CuntomPaint 组件。CustomPaint 组件和前端的 Canvas差不多,允许我们在一个画布上绘制各种元素,包括点、线、矩形、圆弧、文字、图片等等。
CustomPaint 介绍
CustomPaint是一个 Widget,其中有三个重要的参数:
CustomPaint(
child: childWidget(),
foregroundPainter: foregroundPainter(),
painter: backgroundPainter(),
)
child:CustomPaint的子组件;painter和foregroundPainter:都是CustomPainter类,用于定义canvas绘制的内容。区别在于,首先是执行painter的绘制指令。然后是在背景上渲染child子组件。最后,foregroundPainter的内容会绘制
边栏推荐
- Package for gbase 8s
- GBASE 8s 索引B+树
- ThinkPHP is integrated with esaywechat. What's wrong with wechat payment callback without callback?
- 哪个编程语言实现hello world最烦琐?
- Basic introduction of gbase 8s blocking technology
- 机器学习深度学习——向量化
- Join() in JSZ
- Easyrecovery15 very easy to use computer data recovery software
- GBASE 8s的级联删除功能
- CTF_ Web: file contains pseudo protocol with PHP
猜你喜欢

JS arguments

WPF 使用 MAUI 的自绘制逻辑

Machine learning deep learning -- Vectorization

重磅直播 | 相移法+多频外差之数学原理推导+实现

CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)

CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep

30岁了开始自学编程,家里比较困难还来得及吗?

LabVIEW development gas regulator

mongodb集群

在 .NET 6 中使用 dotnet format 格式化代码
随机推荐
Gbase 8s index b+ tree
Xiaobai learns MySQL - Statistical 'opportunism'
What is data persistence?
GBASE 8s存儲過程語法結構
什么是持久化?redis 持久化中的RDB和AOF是什么?
CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
jsz中的join()
2.0springmvc uses restful
GBASE 8s 索引B+树
Immutable学习之路----告别传统拷贝
Blob page in gbase 8s
Upgrade PHP to php7 X (III) failure of wechat payment callback
深度学习——几种学习类型
CTF_ Web: file contains pseudo protocol with PHP
Thorough understanding of database transactions
华为鸿蒙开发第四课
Retrofit 源码分析
什么是数据持久化?
js的sort()函数
Easyrecovery15 very easy to use computer data recovery software