import 'package:flutter/material.dart';
import 'package:vid_player_demo/pages/both_player/page.dart';
import 'package:vid_player_demo/pages/image_test/page.dart';
import 'package:vid_player_demo/pages/scene_player/page.dart';
import 'package:vid_player_demo/pages/single_image.dart/view.dart';
import 'package:vid_player_demo/widgets/image_cache.dart';

import 'pages/canvas_player/page.dart';
import 'pages/image_player/page.dart';
import 'pages/multi_canvas_player/page.dart';
import 'pages/multi_image_player/page.dart';
import 'pages/color_filter/page.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      routes: <String, WidgetBuilder>{
        '/': (BuildContext context) =>
            const MyHomePage(title: 'Vid Player Demo Home Page'),
        '/single_image': (BuildContext context) => const SingleImageView(),
        '/image_player': (BuildContext context) => const ImagePlayerPage(),
        '/canvas_player': (BuildContext context) => const CanvasPlayerPage(),
        '/both_player': (BuildContext context) => BothPlayerPage(),
        '/multi_image_player': (BuildContext context) =>
            const MultiImagePlayerPage(),
        '/multi_canvas_player': (BuildContext context) =>
            const MultiCanvasPlayerPage(),
        '/scene_player': (BuildContext context) => ScenePlayerPage(),
        '/image_test': (BuildContext context) => const ImageTestPage(),
        '/color_filter': (BuildContext context) => const ColorFilterPage(),
      },
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            const ShowImageCache(),
            const SizedBox(height: 24),
            ElevatedButton(
              child: const Text('Single Image'),
              onPressed: () => Navigator.pushNamed(context, '/single_image'),
            ),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () => Navigator.pushNamed(context, '/image_player'),
                child: const Text('Image Player')),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () => Navigator.pushNamed(context, '/canvas_player'),
                child: const Text('Canvas Player')),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () => Navigator.pushNamed(context, '/both_player'),
                child: const Text('Both Player')),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () =>
                    Navigator.pushNamed(context, '/multi_image_player'),
                child: const Text('Multi Image Player')),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () =>
                    Navigator.pushNamed(context, '/multi_canvas_player'),
                child: const Text('Multi Canvas Player')),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () => Navigator.pushNamed(context, '/scene_player'),
                child: const Text('Scene Player')),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () => Navigator.pushNamed(context, '/image_test'),
                child: const Text('Image Test')),
            const SizedBox(height: 8),
            ElevatedButton(
                onPressed: () => Navigator.pushNamed(context, '/color_filter'),
                child: const Text('Color Filter')),
            const SizedBox(height: 24),
          ],
        ),
      ),
    );
  }
}
