import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:intl/intl.dart'; import 'main.dart'; import 'studierendenausweis.dart'; class ShowSemester extends StatefulWidget { final bool isWinter; final DateTime now; const ShowSemester(this.isWinter, this.now, {super.key}); @override State createState() => _ShowSemester(); } class _ShowSemester extends State with TickerProviderStateMixin { late final controller = AnimationController( duration: const Duration(seconds: 6), vsync: this, )..repeat(reverse: true); @override Widget build(BuildContext context) { bool isWinter = widget.isWinter; final now = widget.now; final format = DateFormat("dd.MM.yyyy", 'de_DE'); final beginning = isWinter ? now.month > 6 ? '01.10.${now.year}' : '01.10.${now.year - 1}' : '01.04.${now.year}'; final validFrom = isWinter ? now.month != DateTime.september ? format.format(now) : '01.10.${now.year}' : now.month != DateTime.march ? format.format(now) : '01.04.${now.year}'; final ending = isWinter ? now.month > 6 ? '31.03.${now.year + 1}' : '31.03.${now.year}' : '30.09.${now.year}'; return Scaffold( appBar: AppBar( title: const Text('Ihre Karte'), ), body: ListView( padding: const EdgeInsets.only(top: 8, bottom: 8, left: 16, right: 16), children: [ Row( crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: TextBaseline.ideographic, children: [ SvgPicture.asset('assets/RMV_logo.svg', height: 16, fit: BoxFit.fitHeight), Text( ' 01 - ${Ticket().matrikel} - 001', style: TextStyle(height: 0), ) ], ), Text('$validFrom / 00:00'), Padding( padding: const EdgeInsets.all(8.0), child: Image.asset(Ticket().picture), ), Text('${Ticket().vorname} ${Ticket().nachname}'), const Text( 'Ausweis: digitaler Studierendenausweis', style: TextStyle(fontSize: 12), ), const SizedBox(height: 12), const Text('RMV-HandyTicket'), const Text( 'SemesterTicket JGU Mainz', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700), ), const SizedBox(height: 16), Row( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: const [ Text('Gültig von: '), Text('Gültig bis: '), Text('Semester: '), Text('Ticket-ID: '), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(validFrom), Text(ending), Text(isWinter ? 'WiSe ${now.month > 6 ? now.year : now.year - 1}' : 'SoSe ${now.year}'), Text('01 - ${Ticket().matrikel} - 001'), ], ) ], ), const SizedBox(height: 8), const Text( 'Gültig auf allen Linien im gesamten RMV Verbundnetz und den VRN-Übergangstarifgebieten. Gültig auf allen Linien im Verbundnetz des RNN inkl. ÜB AzWo. KBS 471 (Nahverkehr bis Koblenz). Es gelten die gemeinsamen Beförderungsbedingungen und Tarifbestimmungen.', style: TextStyle(fontSize: 10), ), const SizedBox(height: 4), Padding( padding: const EdgeInsets.only(right: 114 + 16), child: SlideTransition( position: Tween( begin: const Offset(0.0, 0.0), end: const Offset(1.0, 0.0), ).animate(CurvedAnimation( parent: controller, curve: Curves.linear, )), child: Row( children: [ SvgPicture.asset( 'assets/RNN_logo.svg', height: 20, fit: BoxFit.fitHeight, ), const SizedBox(width: 4), SvgPicture.asset( 'assets/RMV_logo.svg', height: 16, fit: BoxFit.fitHeight, ), ], )), ), const SizedBox(height: 8), SizedBox( height: 28, child: Center( child: TextButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => ShowAusweis(isWinter, now))); }, child: const Text( ' Studierendenausweis ', style: TextStyle( color: Colors.white, height: 1.0, fontWeight: FontWeight.w400), )), ), ), Text('Gesamtlaufzeit: $beginning bis $ending', style: const TextStyle(fontSize: 12)) ])); } @override void dispose() { controller.dispose(); super.dispose(); } }