buildProgress static method

Widget buildProgress({
  1. Color? activeColor,
  2. Color? inactiveColor,
  3. double progress = 1,
  4. double height = 4,
  5. double width = 100,
})

Implementation

static Widget buildProgress(
    {Color? activeColor,
    Color? inactiveColor,
    double progress = 1,
    double height = 4,
    double width = 100}) {
  if (inactiveColor == null) {
    inactiveColor = Colors.grey;
  }

  if (progress > 1) {
    progress /= 100;
  }
  return Container(
    width: width,
    height: height,
    decoration: BoxDecoration(
        color: inactiveColor,
        borderRadius: BorderRadius.all(Radius.circular(4))),
    child: Stack(
      children: <Widget>[
        Container(
          width: width * progress,
          height: height,
          decoration: BoxDecoration(
              color: activeColor,
              borderRadius: BorderRadius.all(Radius.circular(4))),
        )
      ],
    ),
  );
}