当前位置:网站首页>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 .
边栏推荐
- The king of pirated Dall · e? 50000 images per day, crowded hugging face server, and openai ordered to change its name
- 剪掉ImageNet 20%数据量,模型性能不下降!Meta斯坦福等提出新方法,用知识蒸馏给数据集瘦身...
- Kotlin compose and native nesting
- 程序员搞开源,读什么书最合适?
- 解决Navicat激活、注册时候出现No All Pattern Found的问题
- Apache DolphinScheduler 系统架构设计
- 观测云与 TDengine 达成深度合作,优化企业上云体验
- Solve the problem of no all pattern found during Navicat activation and registration
- MySQL字符类型学习笔记
- Coffeescript Chinese character to pinyin code
猜你喜欢
为什么不建议你用 MongoDB 这类产品替代时序数据库?
程序员如何活成自己喜欢的模样?
How to implement complex SQL such as distributed database sub query and join?
From "chemist" to developer, from Oracle to tdengine, two important choices in my life
【系统设计】指标监控和告警系统
Solve the problem of no all pattern found during Navicat activation and registration
Node-RED系列(二九):使用slider与chart节点来实现双折线时间序列图
The writing speed is increased by dozens of times, and the application of tdengine in tostar intelligent factory solution
Wechat applet - simple diet recommendation (2)
【小技巧】获取matlab中cdfplot函数的x轴,y轴的数值
随机推荐
Design and exploration of Baidu comment Center
小程序启动性能优化实践
Apache DolphinScheduler 系统架构设计
Those who are good at using soldiers, hide in the invisible, and explain the best promotional value works in depth in 90 minutes
Tianlong Babu TLBB series - about items dropped from packages
How to get the STW (pause) time of GC (garbage collector)?
卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程
分布式数据库下子查询和 Join 等复杂 SQL 如何实现?
ArcGIS Pro 创建要素
写入速度提升数十倍,TDengine 在拓斯达智能工厂解决方案上的应用
Kotlin compose multiple item scrolling
Cerebral Cortex:有向脑连接识别帕金森病中广泛存在的功能网络异常
观测云与 TDengine 达成深度合作,优化企业上云体验
程序员如何活成自己喜欢的模样?
TDengine 离线升级流程
TypeError: Cannot read properties of undefined (reading ‘cancelToken‘)
tongweb设置gzip
Meitu lost 300 million yuan in currency speculation for half a year. Huawei was exposed to expand its enrollment in Russia. Alphago's peers have made another breakthrough in chess. Today, more big new
Is it really reliable for AI to make complex decisions for enterprises? Participate in the live broadcast, Dr. Stanford to share his choice | qubit · viewpoint
Observation cloud and tdengine have reached in-depth cooperation to optimize the cloud experience of enterprises