Skip to content

Instantly share code, notes, and snippets.

@murilinhoPs
Created January 18, 2021 21:25
Show Gist options
  • Save murilinhoPs/e0d43b7a70efc6caa192f89405be9948 to your computer and use it in GitHub Desktop.
Save murilinhoPs/e0d43b7a70efc6caa192f89405be9948 to your computer and use it in GitHub Desktop.
CustomProgressBar with Flutter
import 'package:flutter/material.dart';
class StepProgressBar extends StatelessWidget {
final int currentStep;
final int totalSteps;
final double leftPadding;
final double rightPadding;
final Color selectedColor;
final Color unselectedColor;
const StepProgressBar({
Key key,
@required this.totalSteps,
@required this.currentStep,
this.leftPadding = 35.0,
this.rightPadding = 35.0,
this.selectedColor = const Color(0xff3873B8),
this.unselectedColor = Colors.black,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(
top: 8,
left: leftPadding,
right: rightPadding,
bottom: 8,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40.0),
),
child: LinearProgressIndicator(
value: currentStep / totalSteps,
minHeight: 4,
valueColor: AlwaysStoppedAnimation<Color>(selectedColor),
backgroundColor: unselectedColor.withOpacity(0.2),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment