ModernMemoires/lib/views/statistic/widget/streak_widget.dart

62 lines
1.8 KiB
Dart
Raw Normal View History

2023-12-17 23:00:31 +01:00
import 'package:flutter/material.dart';
class StreakWidget extends StatelessWidget {
final int dayCount;
2024-01-08 19:34:48 +01:00
final Color color; // Optional color parameter
2023-12-17 23:00:31 +01:00
2024-01-08 19:34:48 +01:00
StreakWidget({
Key? key,
required this.dayCount,
this.color = Colors.white, // Default to white if not provided
}) : super(key: key);
2023-12-17 23:00:31 +01:00
@override
Widget build(BuildContext context) {
2024-01-08 19:34:48 +01:00
return Container(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"Congratulations! Youre currently ",
style: TextStyle(fontSize: 24),
textAlign: TextAlign.center,
),
Flexible(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"on a ",
style: TextStyle(fontSize: 24),
textAlign: TextAlign.center,
2023-12-17 23:00:31 +01:00
),
2024-01-08 19:34:48 +01:00
Container(
margin: const EdgeInsets.symmetric(vertical: 4),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: color, // Use the color provided
borderRadius: BorderRadius.circular(20),
),
child: Text(
"$dayCount days",
style: const TextStyle(
color: Colors.black,
fontSize: 26,
),
2023-12-17 23:00:31 +01:00
),
),
2024-01-08 19:34:48 +01:00
const Text(
" streak!",
style: TextStyle(fontSize: 24),
textAlign: TextAlign.center,
),
],
),
2023-12-17 23:00:31 +01:00
),
2024-01-08 19:34:48 +01:00
],
),
2023-12-17 23:00:31 +01:00
);
}
}