62 lines
1.8 KiB
Dart
62 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
class StreakWidget extends StatelessWidget {
|
||
final int dayCount;
|
||
final Color color; // Optional color parameter
|
||
|
||
StreakWidget({
|
||
Key? key,
|
||
required this.dayCount,
|
||
this.color = Colors.white, // Default to white if not provided
|
||
}) : super(key: key);
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Container(
|
||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
const Text(
|
||
"Congratulations! You’re 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,
|
||
),
|
||
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,
|
||
),
|
||
),
|
||
),
|
||
const Text(
|
||
" streak!",
|
||
style: TextStyle(fontSize: 24),
|
||
textAlign: TextAlign.center,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
}
|