register.dart 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import 'package:flutter/material.dart';
  2. class RegisterPage extends StatefulWidget {
  3. const RegisterPage({Key? key}) : super(key: key);
  4. @override
  5. State<StatefulWidget> createState() => _RegisterPageState();
  6. }
  7. class _RegisterPageState extends State<RegisterPage> {
  8. bool showPassword = false;
  9. @override
  10. Widget build(BuildContext context) {
  11. return Scaffold(
  12. appBar: AppBar(
  13. title: const Text("注册"),
  14. ),
  15. // child: PageContent(name: "登录"),
  16. body: SingleChildScrollView(
  17. child: Padding(
  18. padding: const EdgeInsets.all(20),
  19. child: Column(
  20. children: [
  21. const TextField(
  22. decoration: InputDecoration(
  23. labelText: "账号",
  24. hintText: "请输入账号",
  25. prefixIcon: Icon(Icons.person),
  26. ),
  27. ),
  28. const SizedBox(
  29. height: 16,
  30. ),
  31. TextField(
  32. obscureText: !showPassword,
  33. decoration: const InputDecoration(
  34. labelText: "密码",
  35. hintText: "请输入密码",
  36. prefixIcon: Icon(Icons.lock),
  37. ),
  38. ),
  39. const SizedBox(
  40. height: 16,
  41. ),
  42. TextField(
  43. obscureText: !showPassword,
  44. decoration: const InputDecoration(
  45. labelText: "确认密码",
  46. hintText: "请再次输入密码",
  47. prefixIcon: Icon(Icons.lock),
  48. ),
  49. ),
  50. const SizedBox(
  51. height: 24,
  52. ),
  53. SizedBox(
  54. width: double.infinity,
  55. child: ElevatedButton(
  56. child: const Text("注册"),
  57. onPressed: () {
  58. debugPrint("register");
  59. },
  60. ),
  61. ),
  62. const SizedBox(
  63. height: 16,
  64. ),
  65. Row(
  66. mainAxisAlignment: MainAxisAlignment.center,
  67. children: [
  68. const Text('已有账号,'),
  69. TextButton(
  70. child: const Text(
  71. '去登录~',
  72. style: TextStyle(color: Colors.teal),
  73. ),
  74. onPressed: () {
  75. Navigator.pushReplacementNamed(context, 'login');
  76. },
  77. )
  78. ],
  79. ),
  80. ],
  81. ),
  82. ),
  83. ),
  84. );
  85. }
  86. }