2022-09-16 00:16:46 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class GradientProgressIndicator extends StatefulWidget {
|
|
|
|
const GradientProgressIndicator({required this.progress, super.key});
|
2023-01-30 13:35:06 +01:00
|
|
|
final double? progress;
|
2022-09-16 00:16:46 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<GradientProgressIndicator> createState() =>
|
|
|
|
_GradientProgressIndicatorState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _GradientProgressIndicatorState extends State<GradientProgressIndicator> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Align(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: AnimatedContainer(
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: [
|
|
|
|
Theme.of(context).colorScheme.primary,
|
|
|
|
Theme.of(context).colorScheme.secondary,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
height: 5,
|
2023-08-10 14:25:07 +02:00
|
|
|
width: MediaQuery.sizeOf(context).width * widget.progress!,
|
2022-09-16 00:16:46 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|