liuyuqi-dellpc 2 years ago
parent
commit
59deb865f8

+ 1 - 1
lib/pages/background.dart

@@ -16,7 +16,7 @@ class Background extends StatelessWidget {
   Widget build(BuildContext context) {
     return Scaffold(
       resizeToAvoidBottomInset: false,
-      body: Container(
+      body: SizedBox(
         // color: Colors.green,
         width: double.infinity,
         height: MediaQuery.of(context).size.height,

+ 14 - 14
lib/pages/login_page.dart

@@ -31,11 +31,11 @@ class _LoginPageState extends State<LoginPage> {
   Widget buildLoginDesktop() {
     return Row(
       children: [
-        Expanded(child: LoginTop()),
+        const Expanded(child: LoginTop()),
         Expanded(
             child: Row(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: [
+          children: const [
             SizedBox(
               width: 450,
               child: LoginForm(),
@@ -50,13 +50,13 @@ class _LoginPageState extends State<LoginPage> {
     return Column(
       mainAxisAlignment: MainAxisAlignment.center,
       children: [
-        LoginTop(),
+        const LoginTop(),
         Row(
-          children: [
+          children: const [
             Spacer(),
             Expanded(
-              child: LoginForm(),
               flex: 8,
+              child: LoginForm(),
             ),
             Spacer()
           ],
@@ -79,10 +79,10 @@ class LoginForm extends StatelessWidget {
             textInputAction: TextInputAction.next,
             cursorColor: kPrimaryColor,
             onSaved: (email) {},
-            decoration: InputDecoration(
+            decoration: const InputDecoration(
               hintText: "Your email",
               prefixIcon: Padding(
-                padding: const EdgeInsets.all(defaultPadding),
+                padding: EdgeInsets.all(defaultPadding),
                 child: Icon(Icons.person),
               ),
             ),
@@ -93,10 +93,10 @@ class LoginForm extends StatelessWidget {
               textInputAction: TextInputAction.done,
               obscureText: true,
               cursorColor: kPrimaryColor,
-              decoration: InputDecoration(
+              decoration: const InputDecoration(
                 hintText: "Your password",
                 prefixIcon: Padding(
-                  padding: const EdgeInsets.all(defaultPadding),
+                  padding: EdgeInsets.all(defaultPadding),
                   child: Icon(Icons.lock),
                 ),
               ),
@@ -119,7 +119,7 @@ class LoginForm extends StatelessWidget {
                 context,
                 MaterialPageRoute(
                   builder: (context) {
-                    return RegisterPage();
+                    return const RegisterPage();
                   },
                 ),
               );
@@ -138,11 +138,11 @@ class LoginTop extends StatelessWidget {
   Widget build(BuildContext context) {
     return Column(
       children: [
-        Text(
-          "LOGIN",
+        const Text(
+          "登录",
           style: TextStyle(fontWeight: FontWeight.bold),
         ),
-        SizedBox(height: defaultPadding * 2),
+        const SizedBox(height: defaultPadding * 2),
         Row(
           children: [
             const Spacer(),
@@ -153,7 +153,7 @@ class LoginTop extends StatelessWidget {
             const Spacer(),
           ],
         ),
-        SizedBox(height: defaultPadding * 2),
+        const SizedBox(height: defaultPadding * 2),
       ],
     );
   }

+ 19 - 19
lib/pages/register/register_page.dart

@@ -31,11 +31,11 @@ class _RegisterPageState extends State<RegisterPage> {
   Widget buildRegisterDesktop() {
     return Row(
       children: [
-        Expanded(child: RegisterTop()),
+        const Expanded(child: RegisterTop()),
         Expanded(
             child: Column(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: [
+          children: const [
             SizedBox(
               width: 450,
               child: RegisterForm(),
@@ -54,13 +54,13 @@ class _RegisterPageState extends State<RegisterPage> {
     return Column(
       mainAxisAlignment: MainAxisAlignment.center,
       children: [
-        RegisterTop(),
+        const RegisterTop(),
         Row(
-          children: [
+          children: const [
             Spacer(),
             Expanded(
-              child: RegisterForm(),
               flex: 8,
+              child: RegisterForm(),
             ),
             Spacer()
           ],
@@ -77,28 +77,28 @@ class RegisterTop extends StatelessWidget {
   Widget build(BuildContext context) {
     return Column(
       children: [
-        Text(
+        const Text(
           "Register",
           style: TextStyle(fontWeight: FontWeight.bold),
         ),
-        SizedBox(
+        const SizedBox(
           height: defaultPadding,
         ),
         Row(
           children: [
-            Spacer(),
+            const Spacer(),
             Expanded(
               flex: 8,
               child: SvgPicture.asset("assets/icons/signup.svg"),
             ),
-            Spacer()
+            const Spacer()
           ],
         ),
         // Text(
         //   "Register with your email and password \nor continue with social media",
         //   textAlign: TextAlign.center,
         // ),
-        SizedBox(
+        const SizedBox(
           height: defaultPadding,
         ),
         // SocalSigUp()
@@ -120,38 +120,38 @@ class RegisterForm extends StatelessWidget {
           textInputAction: TextInputAction.next,
           cursorColor: kPrimaryColor,
           onSaved: (value) {},
-          decoration: InputDecoration(
+          decoration: const InputDecoration(
               hintText: "邮箱账户",
               prefixIcon: Padding(
-                child: Icon(Icons.person),
                 padding: EdgeInsets.all(defaultPadding),
+                child: Icon(Icons.person),
               )),
         ),
         Padding(
-          padding: EdgeInsets.symmetric(vertical: defaultPadding),
+          padding: const EdgeInsets.symmetric(vertical: defaultPadding),
           child: TextFormField(
             textInputAction: TextInputAction.done,
             obscureText: true,
             cursorColor: kPrimaryColor,
-            decoration: InputDecoration(
+            decoration: const InputDecoration(
                 hintText: "密码",
                 prefixIcon: Padding(
-                  child: Icon(Icons.lock),
                   padding: EdgeInsets.all(defaultPadding),
+                  child: Icon(Icons.lock),
                 )),
           ),
         ),
-        SizedBox(
+        const SizedBox(
           height: defaultPadding / 2,
         ),
-        ElevatedButton(onPressed: () {}, child: Text("注册")),
-        SizedBox(
+        ElevatedButton(onPressed: () {}, child: const Text("注册")),
+        const SizedBox(
           height: defaultPadding,
         ),
         AlreadyHaveAnAccountCheck(
           press: () {
             Navigator.push(context, MaterialPageRoute(builder: (context) {
-              return LoginPage();
+              return const LoginPage();
             }));
           },
           login: false,

+ 0 - 2
lib/views/already_have_an_account_check.dart

@@ -1,6 +1,4 @@
 import 'package:flutter/material.dart';
-import 'package:flutter/src/widgets/framework.dart';
-import 'package:flutter/src/widgets/placeholder.dart';
 import 'package:flutter_auth/models/config.dart';
 
 class AlreadyHaveAnAccountCheck extends StatelessWidget {