当前位置:网站首页>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 .
边栏推荐
- cent7安装Oracle数据库报错
- The writing speed is increased by dozens of times, and the application of tdengine in tostar intelligent factory solution
- 双容水箱液位模糊PID控制系统设计与仿真(Matlab/Simulink)
- 分布式数据库下子查询和 Join 等复杂 SQL 如何实现?
- Tdengine connector goes online Google Data Studio app store
- Six simple cases of QT
- [technical live broadcast] how to rewrite tdengine code from 0 to 1 with vscode
- Analysis on the wallet system architecture of Baidu trading platform
- Generics, generic defects and application scenarios that 90% of people don't understand
- 剪掉ImageNet 20%数据量,模型性能不下降!Meta斯坦福等提出新方法,用知识蒸馏给数据集瘦身...
猜你喜欢
剪掉ImageNet 20%数据量,模型性能不下降!Meta斯坦福等提出新方法,用知识蒸馏给数据集瘦身...
[200 opencv routines] 219 Add digital watermark (blind watermark)
Cent7 Oracle database installation error
Single chip microcomputer principle and Interface Technology (esp8266/esp32) machine human draft
7 月 2 日邀你来TD Hero 线上发布会
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
善用兵者,藏于无形,90 分钟深度讲解最佳推广价值作品
90%的人都不懂的泛型,泛型的缺陷和应用场景
[tips] get the x-axis and y-axis values of cdfplot function in MATLAB
Solve liquibase – waiting for changelog lock Cause database deadlock
随机推荐
A high density 256 channel electrode cap for dry EEG
7 月 2 日邀你来TD Hero 线上发布会
剪掉ImageNet 20%数据量,模型性能不下降!Meta斯坦福等提出新方法,用知识蒸馏给数据集瘦身...
ArcGIS Pro creating features
Baidu app's continuous integration practice based on pipeline as code
Openes version query
Cerebral cortex: directed brain connection recognition widespread functional network abnormalities in Parkinson's disease
Roll up, break through 35 year old anxiety, and animate the CPU to record the function call process
TDengine 离线升级流程
Why don't you recommend using products like mongodb to replace time series databases?
How to correctly evaluate video image quality
Viewpager pageradapter notifydatasetchanged invalid problem
MySQL character type learning notes
Tianlong Babu TLBB series - about items dropped from packages
Theme. AppCompat. Light. Darkactionbar not found
Implementation of smart home project
硬核,你见过机器人玩“密室逃脱”吗?(附代码)
百度智能小程序巡检调度方案演进之路
Tdengine already supports the industrial Intel edge insight package
解决Navicat激活、注册时候出现No All Pattern Found的问题