44 lines
1.1 KiB
Dart
44 lines
1.1 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import '../theme/themes.dart';
|
|
|
|
class HorizontalProgressWidget extends StatelessWidget {
|
|
final int value;
|
|
final int length;
|
|
final Color color;
|
|
final Color? borderColor;
|
|
final double? height;
|
|
|
|
HorizontalProgressWidget(
|
|
this.value,
|
|
this.length,
|
|
this.color, {
|
|
this.borderColor,
|
|
this.height,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: height ?? 16.h,
|
|
clipBehavior: Clip.hardEdge,
|
|
decoration: BoxDecoration(
|
|
color: white,
|
|
border: borderColor != null ? Border.all(color: borderColor!) : null,
|
|
borderRadius: BorderRadius.circular(16.h),
|
|
),
|
|
child: AnimatedFractionallySizedBox(
|
|
alignment: Alignment.centerLeft,
|
|
widthFactor: length == 0 ? 0 : value.toDouble() / length,
|
|
duration: Duration(milliseconds: 600),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(16.h),
|
|
color: color,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|