当前位置:网站首页>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 .
边栏推荐
- A high density 256 channel electrode cap for dry EEG
- TDengine 离线升级流程
- Why don't you recommend using products like mongodb to replace time series databases?
- The writing speed is increased by dozens of times, and the application of tdengine in tostar intelligent factory solution
- Matrix processing practice
- Baidu app's continuous integration practice based on pipeline as code
- The comparison of every() and some() in JS uses a power storage plan
- Cerebral Cortex:有向脑连接识别帕金森病中广泛存在的功能网络异常
- 如何正确的评测视频画质
- Are databases more popular as they get older?
猜你喜欢
Tdengine connector goes online Google Data Studio app store
TDengine可通过数据同步工具 DataX读写
Mysql80 service does not start
H. 265 introduction to coding principles
双容水箱液位模糊PID控制系统设计与仿真(Matlab/Simulink)
卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程
QT realizes signal transmission and reception between two windows
How Windows bat script automatically executes sqlcipher command
Uncover the practice of Baidu intelligent testing in the field of automatic test execution
B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条...
随机推荐
Android SQLite database encryption
自动化规范检查软件如何发展而来?
Kotlin Compose 与原生 嵌套使用
天龙八部TLBB系列 - 单体技能群伤
高级 OpenCV:BGR 像素强度图
【系统设计】指标监控和告警系统
oracle 多行数据合并成一行数据
The king of pirated Dall · e? 50000 images per day, crowded hugging face server, and openai ordered to change its name
About getfragmentmanager () and getchildfragmentmanager ()
Apache DolphinScheduler 系统架构设计
宝塔面板MySQL无法启动
Unity particle special effects series - the poison spray preform is ready, and the unitypackage package is directly used - on
Design of stepping motor controller based on single chip microcomputer (forward rotation and reverse rotation indicator gear)
硬核,你见过机器人玩“密室逃脱”吗?(附代码)
苹果 5G 芯片研发失败?想要摆脱高通为时过早
The popularity of B2B2C continues to rise. What are the benefits of enterprises doing multi-user mall system?
C#函数返回多个值方法
把欧拉的创新带向世界 SUSE 要做那个引路人
盗版DALL·E成梗图之王?日产5万张图像,挤爆抱抱脸服务器,OpenAI勒令改名
Kotlin compose and native nesting