我想知道是否有办法改变线性和圆形进度条的宽度/长度/高度。我正在尝试使用它制作一个经验条,但不确定是否可能。另外,我知道这些值仅在0.0和1.0之间,但我认为(不确定)我能够创建一个公式,使其仍然有效。
我想知道是否有办法改变线性和圆形进度条的宽度/长度/高度。我正在尝试使用它制作一个经验条,但不确定是否可能。另外,我知道这些值仅在0.0和1.0之间,但我认为(不确定)我能够创建一个公式,使其仍然有效。
SizedBox(
height: 300.0,
width: 300.0,
child:
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.blue),
strokeWidth: 5.0)
)
通过这种方式,Circular Progress Indicator不会占据包含它的父容器的宽度和高度。
祝好!
<Widget>[Center(child: CircularProgressIndicator())]
我该如何将创建加载指示器的类与我的按钮结合起来,以便在按下按钮时,指示器打开并翻转到下一页?
以下是代码:
class Loader extends StatefulWidget {
@override
State createState() => LoaderState();
}
class LoaderState extends State<Loader> with SingleTickerProviderStateMixin {
AnimationController controller;
Animation<double> animation;
@override
void initState() {
super.initState();
controller = AnimationController(
duration: Duration(milliseconds: 1200), vsync: this);
animation = CurvedAnimation(parent: controller, curve: Curves.elasticOut);
animation.addListener(() {
this.setState(() {});
});
animation.addStatusListener((AnimationStatus status) {});
controller.repeat();
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
color: Colors.blue,
height: 3.0,
width: animation.value * 100.0,
),
Padding(
padding: EdgeInsets.only(bottom: 5.0),
),
Container(
color: Colors.blue[300],
height: 3.0,
width: animation.value * 75.0,
),
Padding(
padding: EdgeInsets.only(bottom: 5.0),
),
Container(
color: Colors.blue,
height: 3.0,
width: animation.value * 50.0,
)
],
);
}
}
Expanded(
child: Padding(
padding:
EdgeInsets.only(left: 20.0, right: 5.0, top:20.0),
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FirstScreen()));
},
child: Container(
alignment: Alignment.center,
height: 45.0,
decoration: BoxDecoration(
color: Color(0xFF1976D2),
borderRadius: BorderRadius.circular(9.0)),
child: Text('Login',
style: TextStyle(
fontSize: 20.0, color: Colors.white))),
),
),
),