import 'package:flutter/material.dart';
import 'package:skillcourt/pages/random_game_mode.dart';

class RandomGameModeByHits extends StatefulWidget {
  static const routeName = 'RandomGameModeByHits';

  const RandomGameModeByHits({Key? key}) : super(key: key);
  @override
  _RandomGameModeByHits createState() => _RandomGameModeByHits();
}

class _RandomGameModeByHits extends State<RandomGameModeByHits> {
  bool isSwitched = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Create Game'),
      ),
      body: timer(),
      resizeToAvoidBottomInset: false,
    );
  }

  Widget timer() {
    return Container(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Expanded(
            flex: 1,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: const <Widget>[
                Padding(
                  padding: EdgeInsets.only(
                    top: 0.0,
                  ),
                  child: Text(
                    'By Hits',
                    style: TextStyle(
                      fontSize: 18.0,
                      fontWeight: FontWeight.w700,
                    ),
                  ),
                ),
              ],
            ),
          ),
          Expanded(
            flex: 1,
            child: Switch(
              value: isSwitched,
              onChanged: (value) {
                setState(() {
                  isSwitched = value;
                });
                Navigator.pushReplacementNamed(
                    context, RandomGameMode.routeName);
              },
              activeTrackColor: Colors.lightGreenAccent,
              activeColor: Colors.green,
            ),
          ),
          Expanded(
            flex: 3,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: const <Widget>[
                Padding(
                  padding: EdgeInsets.only(
                    top: 20.0,
                    bottom: 20.0,
                  ),
                  child: TextField(
                    decoration: InputDecoration(
                        hintText: 'Please type a number',
                        labelText: 'Hit Amount',
                        labelStyle: TextStyle(
                          fontSize: 12.0,
                          color: Colors.green,
                        )),
                    keyboardType: TextInputType.number,
                  ),
                ),
              ],
            ),
          ),
          const Expanded(
              flex: 1,
              child: TextField(
                decoration: InputDecoration(
                    hintText: 'Please type a number',
                    labelText: 'Pad Light Up',
                    labelStyle: TextStyle(
                      fontSize: 12.0,
                      color: Colors.green,
                    )),
                keyboardType: TextInputType.number,
              )),
          const Expanded(
              flex: 1,
              child: TextField(
                decoration: InputDecoration(
                    hintText: 'Please type a number',
                    labelText: 'Pad Light Delay',
                    labelStyle: TextStyle(
                      fontSize: 12.0,
                      color: Colors.green,
                    )),
                keyboardType: TextInputType.number,
              )),
          Expanded(
              flex: 1,
              child: ElevatedButton(
                onPressed: () {},
                child: const Text('PLAY GAME'),
              )),
        ],
      ),
    );
  }
}
