| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import 'package:flutter/material.dart';
- class GradientRoundedLinearProgressBar extends StatelessWidget {
- final double progress;
- final double height;
- final double width;
- final Color backgroundColor;
- final List<Color> gradientColors;
- final double borderRadius;
- const GradientRoundedLinearProgressBar({
- super.key,
- required this.progress,
- this.height = 12.0,
- this.width = 220.0,
- this.backgroundColor = Colors.grey,
- required this.gradientColors,
- this.borderRadius = 8.0,
- });
- @override
- Widget build(BuildContext context) {
- return ClipRRect(
- borderRadius: BorderRadius.circular(borderRadius),
- child: Container(
- height: height,
- width: width,
- color: backgroundColor,
- child: Stack(
- children: [
- Container(
- width: progress * width,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(borderRadius),
- gradient: LinearGradient(
- colors: gradientColors,
- begin: Alignment.centerLeft,
- end: Alignment.centerRight,
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
|