当前位置:网站首页>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 .
边栏推荐
- B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条...
- mysql80服务不启动
- Kotlin compose and native nesting
- Tdengine connector goes online Google Data Studio app store
- MySQL字符类型学习笔记
- 90%的人都不懂的泛型,泛型的缺陷和应用场景
- 从“化学家”到开发者,从甲骨文到TDengine,我人生的两次重要抉择
- 善用兵者,藏于无形,90 分钟深度讲解最佳推广价值作品
- 让AI替企业做复杂决策真的靠谱吗?参与直播,斯坦福博士来分享他的选择|量子位·视点...
- View Slide
猜你喜欢

Common fault analysis and Countermeasures of using MySQL in go language

苹果 5G 芯片研发失败?想要摆脱高通为时过早

Implementation of smart home project

Uncover the practice of Baidu intelligent testing in the field of automatic test execution

【小技巧】獲取matlab中cdfplot函數的x軸,y軸的數值

观测云与 TDengine 达成深度合作,优化企业上云体验

La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu

【OpenCV 例程200篇】219. 添加数字水印(盲水印)

Idea debugs com intellij. rt.debugger. agent. Captureagent, which makes debugging impossible
![[C language] the use of dynamic memory development](/img/b7/3337bf0df9232d3a44eaeb46b39c63.png)
[C language] the use of dynamic memory development "malloc"
随机推荐
Tdengine already supports the industrial Intel edge insight package
How to correctly evaluate video image quality
ArcGIS Pro 创建要素
高级 OpenCV:BGR 像素强度图
Online chain offline integrated chain store e-commerce solution
Fluent development: setting method of left and right alignment of child controls in row
解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
Hard core, have you ever seen robots play "escape from the secret room"? (code attached)
天龙八部TLBB系列 - 关于技能冷却和攻击范围数量的问题
一种用于干式脑电图的高密度256通道电极帽
【C语言】动态内存开辟的使用『malloc』
Unity particle special effects series - the poison spray preform is ready, and the unitypackage package is directly used - on
分布式数据库下子查询和 Join 等复杂 SQL 如何实现?
美图炒币半年亏了3个亿,华为被曝在俄罗斯扩招,AlphaGo的同类又刷爆一种棋,今日更多大新闻在此...
How to use sqlcipher tool to decrypt encrypted database under Windows system
On July 2, I invite you to TD Hero online press conference
Tutorial on building a framework for middle office business system
oracle 多行数据合并成一行数据
Data visualization platform based on template configuration
Mobile heterogeneous computing technology GPU OpenCL programming (Advanced)