flutter_application_1/lib/pages/milestone_page.dart

57 lines
2.0 KiB
Dart
Raw Permalink Normal View History

2024-06-12 12:48:30 +02:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
2024-06-12 12:48:30 +02:00
import 'package:flutter_application_1/widgets/milestone_timeline_widget.dart';
// Widget für die Seite, die die Meilenstein-Timeline anzeigt
class MilestonePage extends StatelessWidget {
final String compoundInterest; // Gesamte zusammengesetzte Zinsen
final String investedMoney; // Gesamte investierte Geldmenge
final List<Map<String, dynamic>> milestoneList; // Liste von Meilensteinen
const MilestonePage({
super.key,
required this.compoundInterest,
required this.investedMoney,
required this.milestoneList,
});
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: Container(
padding: EdgeInsets.only(left: 10, right: 10, top: MediaQuery.of(context).padding.top + 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
icon: const Icon(CupertinoIcons.chevron_left, size: 15),
onPressed: () {
Navigator.pop(context); // Zurück zur vorherigen Seite
},
),
Text(
AppLocalizations.of(context)!.milestones,
style: const TextStyle(fontWeight: FontWeight.bold),
2024-06-12 12:48:30 +02:00
),
const SizedBox(width: 40),
],
),
),
),
// Anzeige der Meilenstein-Timeline
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: MilestoneTimeline(milestones: milestoneList, totalInterest: (double.parse(compoundInterest) - double.parse(investedMoney)).round()),
2024-06-12 12:48:30 +02:00
),
),
],
),
);
}
}