You can use an Row widget with a combination of Container
and LinearProgressIndicator
Since I am not aware of the rest of the app I'll be providing a sample widget tree for your reference.
Widget Tree:
Row(
children: <Widget>[
Container([...]),
LinearProgressIndicator([...]),
Container([...]),
LinearProgressIndicator([...]),
Container([...]),
]
)
To make a circular Container
along with the color
transition,
AnimatedContainer(
duration: Duration(seconds:2),
width: x,
height: x,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(x/2),
// color: (progressvalue>200)? Colors.yellow : Colors.grey
)
)
Sample Logic:
Container1 - progressValue > 0
LinearProgressIndicator - (progressValue-10) to 110
Container2 - progressValue > 110
LinearProgressIndicator - (progressValue-120) to 220
Container2 - progressValue > 220
The above logic can be modified as per your convenience.
Working example for LinearProgressIndicator
,
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
debugShowCheckedModeBanner: false,
home: new MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
MyAppState createState() => new MyAppState();
}
class MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Slider Demo'),
),
body: new Container(
color: Colors.blueAccent,
padding: new EdgeInsets.all(32.0),
child: new ProgressIndicatorDemo(),
),
);
}
}
class ProgressIndicatorDemo extends StatefulWidget {
@override
_ProgressIndicatorDemoState createState() =>
new _ProgressIndicatorDemoState();
}
class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo>
with SingleTickerProviderStateMixin {
AnimationController controller;
Animation<double> animation;
@override
void initState() {
super.initState();
controller = AnimationController(
duration: const Duration(milliseconds: 2000), vsync: this);
animation = Tween(begin: 0.0, end: 1.0).animate(controller)
..addListener(() {
setState(() {
// the state that has changed here is the animation object’s value
});
});
controller.repeat();
}
@override
void dispose() {
controller.stop();
super.dispose();
}
@override
Widget build(BuildContext context) {
return new Center(
child: new Container(
child: LinearProgressIndicator( value: animation.value,),
)
);
}
}