当前位置:网站首页>Fluent generates icon prompt logo widget
Fluent generates icon prompt logo widget
2022-07-05 10:10:00 【cppphp】
Sometimes in order to provide users with some additional status , Often in Icon The corner of the is displayed with additional icons , Such as the common digital red dot logo , We don't implement the red dot logo today , Instead, use a smaller Icon Make prompt logo , To show some other States , Such as “ Mushroom meter ”app One of them IconButton There is a logo in the upper left corner and the upper right corner of the button respectively to indicate that the timing record and the alarm record have been opened . The example is as follows :
Flutter There is no ready-made Icon Prompt logo Widget, Of course, it can be implemented with a third-party library , But it is not always convenient to use ready-made wheels , In fact, it's very simple to realize this function . Just use Stack and Positioned It can be done easily , The code is as follows :
/// Generate badged Icon
/// icondata - IconData type , contain Icon Icon data
/// sups - List<IconData?> type , Include superscript Icon An array of icon data
/// color - Color type , Specify the superscript badge color
Widget supIcon(IconData icondata, List<IconData?> sups,{color=Colors.yellow}) {
List<Widget> _pos = [Icon(icondata)];
for (var i = 0; i < sups.length; i++) {
if (sups[i] != null) {
_pos.add(
Positioned(
top: i == 0 || i == 1 ? -6.0 : null,
left: i == 0 || i == 3 ? -6.0 : null,
right: i == 1 || i == 2 ? -6.0 : null,
bottom: i == 2 || i == 3 ? -6.0 : null,
child: Icon(
sups[i],
size: 16,
color: color,
)),
);
}
}
return Stack(
clipBehavior: Clip.none,
children: _pos
);
}
The code is simple , But realized the logo of four corners . The calling code is also relatively simple , There is no art here .
边栏推荐
- 自动化规范检查软件如何发展而来?
- How Windows bat script automatically executes sqlcipher command
- TDengine 已经支持工业英特尔 边缘洞见软件包
- 天龙八部TLBB系列 - 关于技能冷却和攻击范围数量的问题
- 一文读懂TDengine的窗口查询功能
- Coordinate system of view
- The writing speed is increased by dozens of times, and the application of tdengine in tostar intelligent factory solution
- Evolution of Baidu intelligent applet patrol scheduling scheme
- 历史上的今天:第一本电子书问世;磁条卡的发明者出生;掌上电脑先驱诞生...
- Tdengine already supports the industrial Intel edge insight package
猜你喜欢
MySQL character type learning notes
MySQL字符类型学习笔记
正式上架!TDengine 插件入驻 Grafana 官网
卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程
The king of pirated Dall · e? 50000 images per day, crowded hugging face server, and openai ordered to change its name
Roll up, break 35 - year - old Anxiety, animation Demonstration CPU recording Function call Process
TDengine × Intel edge insight software package accelerates the digital transformation of traditional industries
【OpenCV 例程200篇】219. 添加数字水印(盲水印)
Generics, generic defects and application scenarios that 90% of people don't understand
QT timer realizes dynamic display of pictures
随机推荐
搞数据库是不是越老越吃香?
Tianlong Babu TLBB series - single skill group injury
TDengine 连接器上线 Google Data Studio 应用商店
Getting started with Apache dolphin scheduler (one article is enough)
能源势动:电力行业的碳中和该如何实现?
Are databases more popular as they get older?
【系统设计】指标监控和告警系统
程序员搞开源,读什么书最合适?
Tdengine already supports the industrial Intel edge insight package
La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu
How to get the STW (pause) time of GC (garbage collector)?
How to implement complex SQL such as distributed database sub query and join?
Kotlin compose multiple item scrolling
Kotlin Compose 多个条目滚动
【技术直播】如何用 VSCode 从 0 到 1 改写 TDengine 代码
The comparison of every() and some() in JS uses a power storage plan
程序员如何活成自己喜欢的模样?
【小技巧】獲取matlab中cdfplot函數的x軸,y軸的數值
TDengine × Intel edge insight software package accelerates the digital transformation of traditional industries
把欧拉的创新带向世界 SUSE 要做那个引路人