53 lines
2.0 KiB
Dart
53 lines
2.0 KiB
Dart
|
// Erstellt eine Zeitleiste für Meilensteine
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
|
||
|
Widget buildMilestoneTimeline(List<Map<String, dynamic>> milestones, double totalInterest) {
|
||
|
return SizedBox(
|
||
|
child: Center(
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: List.generate(milestones.length, (index) {
|
||
|
double milestoneValue = milestones[index]['value'];
|
||
|
String milestoneEmoji = milestones[index]['emoji'];
|
||
|
String milestoneText = milestones[index]['text'];
|
||
|
bool milestoneReached = totalInterest >= milestoneValue; // Überprüfen, ob Meilenstein erreicht wurde
|
||
|
return Column(
|
||
|
children: [
|
||
|
if (index > 0)
|
||
|
Container(
|
||
|
height: 25,
|
||
|
width: 2,
|
||
|
color: milestoneReached ? CupertinoColors.systemGreen : CupertinoColors.black, // Linie zwischen Meilensteinen
|
||
|
),
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Text(
|
||
|
milestoneEmoji,
|
||
|
style: const TextStyle(fontSize: 20), // Emoji für Meilenstein
|
||
|
),
|
||
|
const SizedBox(height: 5),
|
||
|
Text(
|
||
|
milestoneText,
|
||
|
textAlign: TextAlign.center,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Padding(
|
||
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||
|
child: Icon(
|
||
|
milestoneReached ? CupertinoIcons.check_mark_circled_solid : CupertinoIcons.circle_fill,
|
||
|
size: 20,
|
||
|
color: milestoneReached ? CupertinoColors.systemGreen : CupertinoColors.black, // Icon, das den Status des Meilensteins anzeigt
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
}),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|