import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:window_manager/window_manager.dart'; import '../controllers/home_controller.dart'; class HomeView extends GetView { const HomeView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { final _usernameController = TextEditingController(); final _passwordController = TextEditingController(); return Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("images/login/login.png"), fit: BoxFit.fill, ), ), child: Scaffold( backgroundColor: Colors.transparent, appBar: PreferredSize( preferredSize: const Size.fromHeight(64), child: GestureDetector( behavior: HitTestBehavior.translucent, onPanStart: (details) { if (Platform.isWindows || Platform.isMacOS) windowManager.startDragging(); }, onDoubleTap: () {}, //双击不实现任何 child: AppBar( elevation: 0.0, backgroundColor: Colors.transparent, title: const Text(""), centerTitle: false, ), ), ), body: ListView( children: [ Container( color: Colors.transparent, // 这里设置背景颜色 child: const SizedBox( width: 375, height: 200.0, child: Center( child: Text(""), ), ), ), Padding( padding: const EdgeInsets.fromLTRB(55, 0, 20, 0), child: TextField( controller: _usernameController, decoration: const InputDecoration( labelText: '用户名', hintText: '请输入用户名', border: InputBorder.none, ), ), ), const SizedBox(height: 6.5), // 添加一些间距 Padding( padding: const EdgeInsets.fromLTRB(55, 0, 20, 0), child: TextField( controller: _passwordController, decoration: const InputDecoration( labelText: '密码', hintText: '请输入密码', border: InputBorder.none, ), obscureText: true, ), ), const SizedBox(height: 20,), Padding( padding: const EdgeInsets.fromLTRB(55, 0, 55, 0), child: SizedBox( width: 150, height: 40, child: ElevatedButton(onPressed: (){ if (kDebugMode) { print(_usernameController.text); } if (kDebugMode) { print(_passwordController.text); } //Modular.to.navigate("/home/main"); }, child: const Text("登录")) ), ) ], ), ), ); } }