当前位置:网站首页>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 .
边栏推荐
- Wechat applet - simple diet recommendation (2)
- 程序员搞开源,读什么书最合适?
- ArcGIS Pro creating features
- Theme. AppCompat. Light. Darkactionbar not found
- The king of pirated Dall · e? 50000 images per day, crowded hugging face server, and openai ordered to change its name
- C#函数返回多个值方法
- Charm of code language
- 为什么不建议你用 MongoDB 这类产品替代时序数据库?
- Apache dolphin scheduler system architecture design
- Design of stepping motor controller based on single chip microcomputer (forward rotation and reverse rotation indicator gear)
猜你喜欢

How Windows bat script automatically executes sqlcipher command

高级 OpenCV:BGR 像素强度图

【小技巧】获取matlab中cdfplot函数的x轴,y轴的数值

90%的人都不懂的泛型,泛型的缺陷和应用场景

剪掉ImageNet 20%数据量,模型性能不下降!Meta斯坦福等提出新方法,用知识蒸馏给数据集瘦身...

为什么不建议你用 MongoDB 这类产品替代时序数据库?

【C语言】动态内存开辟的使用『malloc』

QT realizes signal transmission and reception between two windows

从“化学家”到开发者,从甲骨文到 TDengine,我人生的两次重要抉择

oracle 多行数据合并成一行数据
随机推荐
Coordinate system of view
Apache dolphin scheduler system architecture design
ArcGIS Pro creating features
Solve the problem of no all pattern found during Navicat activation and registration
Tdengine can read and write through dataX, a data synchronization tool
基于单片机步进电机控制器设计(正转反转指示灯挡位)
观测云与 TDengine 达成深度合作,优化企业上云体验
Android SQLite database encryption
Cross process communication Aidl
[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
. Net delay queue
一文读懂TDengine的窗口查询功能
Comment obtenir le temps STW du GC (collecteur d'ordures)?
Idea debugs com intellij. rt.debugger. agent. Captureagent, which makes debugging impossible
Pagoda panel MySQL cannot be started
Cerebral cortex: directed brain connection recognition widespread functional network abnormalities in Parkinson's disease
为什么不建议你用 MongoDB 这类产品替代时序数据库?
MySQL字符类型学习笔记
从“化学家”到开发者,从甲骨文到 TDengine,我人生的两次重要抉择
Node-RED系列(二九):使用slider与chart节点来实现双折线时间序列图