当前位置:网站首页>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 .
边栏推荐
- Mobile heterogeneous computing technology GPU OpenCL programming (Advanced)
- Cent7 Oracle database installation error
- 从“化学家”到开发者,从甲骨文到TDengine,我人生的两次重要抉择
- Online chain offline integrated chain store e-commerce solution
- Tianlong Babu TLBB series - questions about skill cooling and the number of attack ranges
- QT timer realizes dynamic display of pictures
- 解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
- 盗版DALL·E成梗图之王?日产5万张图像,挤爆抱抱脸服务器,OpenAI勒令改名
- 程序员如何活成自己喜欢的模样?
- La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu
猜你喜欢
程序员搞开源,读什么书最合适?
解决Navicat激活、注册时候出现No All Pattern Found的问题
如何正确的评测视频画质
【系统设计】指标监控和告警系统
解决idea调试过程中liquibase – Waiting for changelog lock….导致数据库死锁问题
剪掉ImageNet 20%数据量,模型性能不下降!Meta斯坦福等提出新方法,用知识蒸馏给数据集瘦身...
Coordinate system of view
The king of pirated Dall · e? 50000 images per day, crowded hugging face server, and openai ordered to change its name
卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程
[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
随机推荐
Tianlong Babu TLBB series - questions about skill cooling and the number of attack ranges
解决Navicat激活、注册时候出现No All Pattern Found的问题
双容水箱液位模糊PID控制系统设计与仿真(Matlab/Simulink)
Roll up, break 35 - year - old Anxiety, animation Demonstration CPU recording Function call Process
The writing speed is increased by dozens of times, and the application of tdengine in tostar intelligent factory solution
TDengine ×英特尔边缘洞见软件包 加速传统行业的数字化转型
MySQL character type learning notes
QT timer realizes dynamic display of pictures
Unity particle special effects series - the poison spray preform is ready, and the unitypackage package can be used directly - next
Tutorial on building a framework for middle office business system
[tips] get the x-axis and y-axis values of cdfplot function in MATLAB
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
Tdengine connector goes online Google Data Studio app store
Coffeescript Chinese character to pinyin code
如何正确的评测视频画质
Resolve the horizontal (vertical) sliding conflict between viewpager and WebView
Openes version query
tongweb设置gzip
Develop and implement movie recommendation applet based on wechat cloud
一种用于干式脑电图的高密度256通道电极帽