home_view.dart 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import 'dart:io';
  2. import 'package:flutter/foundation.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:get/get.dart';
  5. import 'package:window_manager/window_manager.dart';
  6. import '../controllers/home_controller.dart';
  7. class HomeView extends GetView<HomeController> {
  8. const HomeView({Key? key}) : super(key: key);
  9. @override
  10. Widget build(BuildContext context) {
  11. final _usernameController = TextEditingController();
  12. final _passwordController = TextEditingController();
  13. return Container(
  14. decoration: const BoxDecoration(
  15. image: DecorationImage(
  16. image: AssetImage("images/login/login.png"),
  17. fit: BoxFit.fill,
  18. ),
  19. ),
  20. child: Scaffold(
  21. backgroundColor: Colors.transparent,
  22. appBar: PreferredSize(
  23. preferredSize: const Size.fromHeight(64),
  24. child: GestureDetector(
  25. behavior: HitTestBehavior.translucent,
  26. onPanStart: (details) {
  27. if (Platform.isWindows || Platform.isMacOS) windowManager.startDragging();
  28. },
  29. onDoubleTap: () {}, //双击不实现任何
  30. child: AppBar(
  31. elevation: 0.0,
  32. backgroundColor: Colors.transparent,
  33. title: const Text(""),
  34. centerTitle: false,
  35. ),
  36. ),
  37. ),
  38. body:
  39. ListView(
  40. children: [
  41. Container(
  42. color: Colors.transparent, // 这里设置背景颜色
  43. child: const SizedBox(
  44. width: 375,
  45. height: 200.0,
  46. child: Center(
  47. child: Text(""),
  48. ),
  49. ),
  50. ),
  51. Padding(
  52. padding: const EdgeInsets.fromLTRB(55, 0, 20, 0),
  53. child: TextField(
  54. controller: _usernameController,
  55. decoration: const InputDecoration(
  56. labelText: '用户名',
  57. hintText: '请输入用户名',
  58. border: InputBorder.none,
  59. ),
  60. ),
  61. ),
  62. const SizedBox(height: 6.5), // 添加一些间距
  63. Padding(
  64. padding: const EdgeInsets.fromLTRB(55, 0, 20, 0),
  65. child: TextField(
  66. controller: _passwordController,
  67. decoration: const InputDecoration(
  68. labelText: '密码',
  69. hintText: '请输入密码',
  70. border: InputBorder.none,
  71. ),
  72. obscureText: true,
  73. ),
  74. ),
  75. const SizedBox(height: 20,),
  76. Padding(
  77. padding: const EdgeInsets.fromLTRB(55, 0, 55, 0),
  78. child: SizedBox(
  79. width: 150,
  80. height: 40,
  81. child: ElevatedButton(onPressed: (){
  82. if (kDebugMode) {
  83. print(_usernameController.text);
  84. }
  85. if (kDebugMode) {
  86. print(_passwordController.text);
  87. }
  88. //Modular.to.navigate("/home/main");
  89. }, child: const Text("登录"))
  90. ),
  91. )
  92. ],
  93. ),
  94. ),
  95. );
  96. }
  97. }