简体   繁体   English

如何使容器的边框在颤动中变成两种颜色?

[英]How to make the border of a Container two-colored in flutter?

Flutter uses the two-colored warning Containers when a Renderflex is overflowing.当 Renderflex 溢出时,Flutter 使用两种颜色的警告容器。 However is it possible to color the border of a Container in that way in my flutter app?但是,是否可以在我的 flutter 应用程序中以这种方式为容器的边框着色?

Container(
  decoration: BoxDecoration(
    border: Border.all(color: Colors.yellow .... Colors.black)   <--- somehow (?)
  ),
  child: Text('My border')
}

在此处输入图片说明

You can do this with Gradient or Custom Paint.您可以使用渐变或自定义绘制来做到这一点。 There is an example like that有一个这样的例子

How to create a background with stripes in Flutter 如何在 Flutter 中创建带条纹的背景

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM