import 'package:ernaehrung/android/components/meal_page_text/days_component.dart'; import 'package:ernaehrung/android/config/statistics.dart'; import 'package:flutter/material.dart'; class DaysTextComponent extends StatelessWidget { late final String timeSpan; late final TimeSpan timespan; Function(int i) onPressed; int index; Color textColor; late StatisticsService statisticsService; DaysTextComponent({super.key, required TimeSpan timeSpan, required this.textColor, required this.onPressed, required this.index}){ timespan = timeSpan; switch(timeSpan){ case TimeSpan.day: this.timeSpan = 'Tag'; break; case TimeSpan.week: this.timeSpan = 'Woche'; break; case TimeSpan.month: this.timeSpan = 'Monat'; break; } } @override Widget build(BuildContext context) { return TextButton( onPressed: () { onPressed(index); }, child: Text( timeSpan, style: TextStyle( color: textColor, fontSize: 14, ), )); } }