作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在尝试向 Flutter 中的 LinearProgressIndicator
添加边框半径。
当我在下面的代码中用另一个小部件(例如 Text
)替换 LinearProgressIndicator
时,它按预期工作。
Container(
decoration: new BoxDecoration(
borderRadius:
new BorderRadius.all(const Radius.circular(20.0))),
child: LinearProgressIndicator(
value: _time,
),
)
最佳答案
1) 使用微件
Container(
margin: EdgeInsets.symmetric(vertical: 20),
width: 300,
height: 20,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(10)),
child: LinearProgressIndicator(
value: 0.7,
valueColor: AlwaysStoppedAnimation<Color>(Color(0xff00ff00)),
backgroundColor: Color(0xffD6D6D6),
),
),
)
2) 使用依赖
不同类型指标列表 https://pub.dev/packages/percent_indicator
试试这个模板代码
child: Padding(
padding: EdgeInsets.all(15.0),
child: LinearPercentIndicator(
width: MediaQuery.of(context).size.width - 50,
animation: true,
lineHeight: 20.0,
animationDuration: 2000,
percent: 0.9,
linearStrokeCap: LinearStrokeCap.roundAll,
progressColor: Colors.greenAccent,
),
)
关于flutter - 如何在 Flutter 中向 LinearProgressIndicator 添加边界/角半径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57534160/
我是一名优秀的程序员,十分优秀!