WOISectionBar constructor

WOISectionBar({
  1. Key? key,
  2. required double width,
  3. required List<int> sections,
  4. bool borderedSections = false,
  5. Color borderColor = Colors.black,
  6. double borderWidth = 1,
  7. bool prefixAndSuffixText = true,
  8. double barHeight = 15,
  9. BoxShadow progressIndicatorShadow = const BoxShadow(color: Colors.black, blurRadius: 10, spreadRadius: 0),
  10. int currentProgress = 0,
  11. Color progressIndicatorColor = Colors.white,
  12. double progressIndicatorBorderRadius = 20,
  13. double barBottomPadding = 0,
  14. double sectionSpacing = 5,
  15. double progressIndicatorSize = 25,
  16. required int initialValue,
  17. Color inactiveBarColor = Colors.grey,
  18. Color activeBarColor = Colors.blueGrey,
  19. TextStyle fontStyle = const TextStyle(fontWeight: FontWeight.w400, fontSize: 18, color: Colors.grey),
  20. double tiltValue = 5,
  21. double textPadding = 5,
})

The WOISectionBar can be divided into multiple different sections that jointly tracks the progress and completion of a single task. Each section as defined by the user can track the progress of all hierarchical steps needed to achieve a goal. The section bar takes width and a list called sections as required parameters. Sections can not contain a value of 0 and currentProgress cannot be greater that the sum of all elements in the section list.

Implementation

WOISectionBar({
  super.key,
  required this.width,
  required this.sections,
  this.borderedSections = false,
  this.borderColor = Colors.black,
  this.borderWidth = 1,
  this.prefixAndSuffixText = true,
  this.barHeight = 15,
  this.progressIndicatorShadow = const BoxShadow(
    color: Colors.black,
    blurRadius: 10,
    spreadRadius: 0,
  ),
  this.currentProgress = 0,
  this.progressIndicatorColor = Colors.white,
  this.progressIndicatorBorderRadius = 20,
  this.barBottomPadding = 0,
  this.sectionSpacing = 5,
  this.progressIndicatorSize = 25,
  required this.initialValue,
  this.inactiveBarColor = Colors.grey,
  this.activeBarColor = Colors.blueGrey,
  this.fontStyle = const TextStyle(
    fontWeight: FontWeight.w400,
    fontSize: 18,
    color: Colors.grey,
  ),
  this.tiltValue = 5,
  this.textPadding = 5,
})  : assert(!sections.contains(0), 'List can not have the value 0'),
      assert(
          currentProgress <=
              sections.reduce((value, element) => value + element),
          'Current progress cannot be greater than the sum of elements of sections list.');