Line data Source code
1 : import 'package:flutter/material.dart'; 2 : import 'package:pal/src/theme.dart'; 3 : 4 : /* Bar render class : Renders the progress bar with the given value */ 5 : class ProgressBarRender extends StatefulWidget { 6 : final double value; 7 : 8 4 : const ProgressBarRender({Key key, this.value}) : super(key: key); 9 : 10 2 : @override 11 2 : _ProgressBarRenderState createState() => _ProgressBarRenderState(); 12 : } 13 : 14 : class _ProgressBarRenderState extends State<ProgressBarRender> { 15 2 : @override 16 : Widget build(BuildContext context) { 17 2 : return FractionallySizedBox( 18 : widthFactor: 0.9, 19 2 : child: DecoratedBox( 20 2 : decoration: BoxDecoration( 21 2 : gradient: LinearGradient( 22 : //* ANIMATION MOVES THE LEFT GRADIENT COLOR 23 2 : stops: [ 24 4 : widget.value, 25 : 0 26 : ], 27 : // IN THE ORDER BELOW : DARK / GREY 28 2 : colors: [ 29 6 : PalTheme.of(context).colors.dark, 30 2 : Color(0xFFC1BFD6), 31 : ]), 32 : ), 33 : // PROGRESS BAR HEIGHT 34 2 : child: Container( 35 : height: 4, 36 : ), 37 : ), 38 : ); 39 : } 40 : }