该百分比指示器中显示的最大日期为20
如果我当前的未决日是10,那么它将显示进度条的一半。
我怎么能这样表演?
示例代码如下:
class _ApplyLeaveState extends State<ApplyLeave> {
double percent = 20.0;
Widget build(BuildContext context) {
double height = MediaQuery
.of(context)
.size
.height;
double width = MediaQuery
.of(context)
.size
.width;
return WillPopScope(
onWillPop: () async {
return false;
},
child: Scaffold(
backgroundColor: Colors.white,
drawer: SideBar(),
appBar: AppBar(
title: Text(app_leave),
),
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 15.0),
child: Align(
alignment: Alignment.center,
child: CircularPercentIndicator(
radius: 100.0,
lineWidth: 15.0,
percent: 0.6,
center: Text(
leave_pending,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.black),
),
backgroundColor: Colors.grey,
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.blue,
),
),
),
我试过这个代码吗?
3条答案
按热度按时间u1ehiz5o1#
试试这个代码
以上代码输出:
juud5qan2#
逻辑是
你可以玩widget。
5m1hhzi43#