import 'package:auto_route/auto_route.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mnemo_cards/di/locator.dart';

import '../widgets/packs_menu_widget.dart';

@RoutePage()
class ExplorePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context).textTheme;
    return Column(
      children: [
        Container(
          alignment: Alignment.center,
          padding: const EdgeInsets.all(12.0),
          child: Text(
            'Blah - blah',
            style: theme.headlineSmall,
          ),
        ),
        Expanded(
          child: PacksMenuWidget(
            locator.repository,
            locator.packManager,
          ),
        ),
        TextButton(
          onPressed: () async {
            await locator.packManager.clearCache();
            locator.testManager.clearStates();
            await locator.packUpdater.updateAvailablePacks();
          },
          child: Text('Clear cache'),
        ),
        TextButton(
          onPressed: () async {
            locator.userManager.login();
          },
          child: Text('Login'),
        ),
      ],
    );
  }

  const ExplorePage();
}
