import 'package:ernaehrung/pages/nav_pages/subpages/progress_page/sub_components/charts/sub_components/tabs/timespan_tabs.dart';
import 'package:flutter/material.dart';

import '../../../../../../../../services/statistics.dart';

class TimespanTabsTextComponent extends StatelessWidget {
  late final String timeSpan;
  late final TimeSpan timespan;
  Function(int i) onPressed;
  int index;
  Color textColor;
  late DataService statisticsService;

  TimespanTabsTextComponent({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,
          ),
        ));
  }
}
