import 'package:flutter/material.dart';
import 'package:habitrack_app/pages/timer_graph_widget.dart';

class SubpageTimerButton extends StatelessWidget {
  const SubpageTimerButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 300,
      margin: const EdgeInsets.only(top: 7.5, bottom: 7.5),
      child: ElevatedButton(
        style: ElevatedButton.styleFrom(
          backgroundColor: Theme.of(context).colorScheme.primary,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(10),
          ),
          minimumSize: const Size(10, 70),
        ),
        onPressed: () => {
          Navigator.push(
            context,
            MaterialPageRoute<dynamic>(
              builder: (context) => const DashboardTimerSubpage(),
            ),
          ),
        },
        child: Row(
          children: [
            Icon(
              Icons.timer,
              color: Theme.of(context).colorScheme.onPrimary,
            ),
            Text(
              ' Timer Widgets',
              style: Theme.of(context).textTheme.bodyMedium!.copyWith(
                    color: Theme.of(context).colorScheme.onPrimary,
                  ),
            ),
          ],
        ),
      ),
    );
  }
}

class DashboardTimerSubpage extends StatefulWidget {
  const DashboardTimerSubpage({super.key});

  @override
  State<StatefulWidget> createState() => _DashboardTimerSubpageState();
}

class _DashboardTimerSubpageState extends State<DashboardTimerSubpage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Theme.of(context).colorScheme.primaryContainer,
      appBar: AppBar(
        iconTheme: IconThemeData(
          color: Theme.of(context).colorScheme.onPrimary,
        ),
        backgroundColor: Theme.of(context).colorScheme.secondary,
        foregroundColor: Theme.of(context).colorScheme.primary,
        title: Text(
          'Statistics: Timer Widgets',
          textScaler: const TextScaler.linear(1.2),
          style: Theme.of(context).textTheme.bodyMedium!.copyWith(
                color: Theme.of(context).colorScheme.onPrimary,
              ),
        ),
      ),
      body: TimerGraphWidget(),
    );
  }
}
