mnemo_cards/lib/widgets/horizontal_progress.dart

40 lines
976 B
Dart
Raw Normal View History

2024-06-11 00:28:57 +00:00
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;
2024-06-12 23:00:13 +00:00
final bool hasBorder;
2024-06-11 00:28:57 +00:00
2024-06-12 23:00:13 +00:00
HorizontalProgressWidget(
this.value,
this.length,
this.color, {
this.hasBorder = false,
});
2024-06-11 00:28:57 +00:00
@override
Widget build(BuildContext context) {
2024-06-12 23:00:13 +00:00
return Container(
height: 16.h,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
2024-06-11 00:28:57 +00:00
color: white,
2024-06-12 23:00:13 +00:00
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,
2024-06-11 00:28:57 +00:00
),
),
);
}
}