39 lines
976 B
Dart
39 lines
976 B
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 bool hasBorder;
|
|
|
|
HorizontalProgressWidget(
|
|
this.value,
|
|
this.length,
|
|
this.color, {
|
|
this.hasBorder = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: 16.h,
|
|
clipBehavior: Clip.antiAlias,
|
|
decoration: BoxDecoration(
|
|
color: white,
|
|
border: hasBorder ? Border.all(color: color) : null,
|
|
borderRadius: BorderRadius.circular(16.h),
|
|
),
|
|
child: AnimatedFractionallySizedBox(
|
|
alignment: Alignment.centerLeft,
|
|
widthFactor: length == 0 ? 0 : value.toDouble() / length,
|
|
duration: Duration(milliseconds: 600),
|
|
child: Container(
|
|
color: color,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|