user-interface - 如何创建自定义卡片(颤振小部件)?
问题描述
我正在尝试创建一个看起来像这样的自定义卡片:
任何建议或指导将不胜感激。
解决方案
你应该试试这个https://flutter.dev/docs/development/ui/layout,它会对你有很大的帮助,另一方面,对于右上角的图标,你可以试试 Stack 小部件,其他组件可以放在一个列中, 就像是:
Card(
child: Stack(
children: [
Positioned(
top: 0,
right: 0,
child: Container(
decoration: BoxDecoration(
gradient: RadialGradient(
colors: [
Colors.red,
Colors.white
],
// Todo: to achive it as you have it in the picture you need to play with the radialgradient, check the oficial documentation for radialgradient and check for center, stops and radius properties of radialgradient
)
),
child: Padding(padding: EdgeInsets.all(10.0), child: Icon(Icons.menu /*Replace it with your icon*/)),
),
),
Padding(
padding: EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
Text("some text"),
Text("some text 2"),
Align(
alignment: Alignment.centerRight,
child: Chip(
label: Text('0'),
),
),
],
),
)
],
),
);
这不是完整的答案,您需要使用尺寸、高度、宽度、填充和边距,祝您好运
推荐阅读
- amazon-web-services - 如何使用 AWS ApiGateway 发送和检索特定的 Content-Type?
- laravel - Laravel echo 不监听私人通知回调。尝试了互联网上的所有内容
- javascript - 从 0 开始的堆积条形图 - ChartJS React
- asp.net-core - 是否可以在 ASP.Net.Core 2.2+ 中将视图组件动态添加到剃须刀页面?
- python - 如何在python中为shell命令使用变量值?
- javascript - JS无法读取图像宽度
- sql - 当数组中有数组时如何从 SQL JSON 中选择数据?
- c# - 如何在 Linux 和 MacOS 上导入 PKCS#8 - CngKey.Import 不可用
- python - 尝试使用 Python 和 OpenCV 加载图像时,我在以下代码中收到“属性错误”?
- c# - 具有引用类型的 C# 数组扩展方法 - 如何更改引用