You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

2 years ago
  1. import 'package:flutter/material.dart';
  2. import 'package:my_flutter_puzzle/widgets/login_widgets/name_field.dart';
  3. class LoginScreenName extends StatefulWidget {
  4. const LoginScreenName({Key? key}) : super(key: key);
  5. @override
  6. State<LoginScreenName> createState() => _LoginScreenNameState();
  7. }
  8. class _LoginScreenNameState extends State<LoginScreenName> {
  9. late final TextEditingController _nameTextController;
  10. late final FocusNode _nameFocusNode;
  11. String _nameString = '';
  12. @override
  13. void initState() {
  14. super.initState();
  15. _nameTextController = TextEditingController();
  16. _nameFocusNode = FocusNode();
  17. }
  18. @override
  19. Widget build(BuildContext context) {
  20. var screenSize = MediaQuery.of(context).size;
  21. return GestureDetector(
  22. onTap: () => _nameFocusNode.unfocus(),
  23. child: Scaffold(
  24. backgroundColor: Colors.white,
  25. body: Center(
  26. child: SizedBox(
  27. width: screenSize.width * 0.5,
  28. child: Column(
  29. mainAxisAlignment: MainAxisAlignment.center,
  30. children: [
  31. NameField(
  32. focusNode: _nameFocusNode,
  33. onChange: (value) => setState(
  34. () => _nameString = value,
  35. ),
  36. ),
  37. const SizedBox(height: 24),
  38. // StartGameWidget(
  39. // nameString: _nameString,
  40. // ),
  41. ],
  42. ),
  43. ),
  44. ),
  45. ),
  46. );
  47. }
  48. }