view.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import 'package:electronic_assistant/base/base_page.dart';
  2. import 'package:flutter/material.dart';
  3. import 'controller.dart';
  4. class LoginPage extends BasePage<LoginController> {
  5. const LoginPage({super.key});
  6. @override
  7. Widget buildBody(BuildContext context) {
  8. return Scaffold(
  9. body: Column(
  10. children: <Widget>[
  11. TextField(
  12. onChanged: (text) {
  13. controller.setPhone(text);
  14. },
  15. decoration: const InputDecoration(
  16. labelText: "手机号",
  17. hintText: "您的手机号",
  18. prefixIcon: Icon(Icons.person)),
  19. ),
  20. TextField(
  21. onChanged: (text) {
  22. controller.setCode(text);
  23. },
  24. decoration: const InputDecoration(
  25. labelText: "验证码",
  26. hintText: "您的验证码",
  27. prefixIcon: Icon(Icons.lock)),
  28. ),
  29. ElevatedButton(
  30. child: const Text("获取验证码"),
  31. onPressed: () {
  32. controller.getUserCode();
  33. },
  34. ),
  35. ElevatedButton(
  36. child: const Text("登录"),
  37. onPressed: () {
  38. controller.login();
  39. },
  40. )
  41. ],
  42. ),
  43. );
  44. }
  45. }