[英]put a transparent container on top of the text - Futter
i have feature like this我有这样的功能
i confuse how to create this on flutter, how do I make the text look like the image above, is there a container above it, if so, how do I validate it if I want to display the container if the text exceeds 5 lines我很困惑如何在flutter上创建这个,如何使文本看起来像上图,上面是否有容器,如果有,如果文本超过5行我想显示容器如何验证
this will useful.这会很有用。
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// shadow Container with text first data
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(width: 1.0, color: Colors.red),
),
gradient: LinearGradient(
begin: const Alignment(0.0, -1),
end: const Alignment(0.0, 1),
colors: <Color>[
const Color(0xffFFFFFF),
const Color(0xff1A1717),
],
),
),
child: Center(
child: Text(
"i confuse how to create this on flutter, how do I make the text look like the image above, is there a container above it, if so, how do I validate it if I want to display the container if the text exceeds 5 lines",
style: TextStyle(fontSize: 20))),
),
// secound Data
const Text(
'|| See more',
),
],
),
If you don't want to use containers and you want this you can use:如果你不想使用容器而你想要这个,你可以使用:
Text( style: TextStyle( overflow: TextOverFlow.fade)
Try this尝试这个
try to stack it with container and create a gradient with 2 colors ( white and transparent.尝试将它与容器堆叠起来并创建一个渐变 2 colors(白色和透明。
Stack(
children : [
..your widget
if(!expand) // if not expand
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.top,
end: Alignment.bottom,
colors: [Colors.white, Colors.yellow],
),
),
)
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.