Skip to content

Commit 8834251

Browse files
Removed unnecessary widgets
1 parent 5ed3f84 commit 8834251

File tree

1 file changed

+109
-126
lines changed

1 file changed

+109
-126
lines changed

client/lib/forms/login_form.dart

+109-126
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,7 @@ class LoginForm extends StatefulWidget {
1212
class _LoginFormState extends State<LoginForm> {
1313
String userInput = "";
1414
String passInput = "";
15-
int stackIndex = 0;
1615
final _formKey = GlobalKey<FormState>();
17-
18-
_LoginFormState({this.userInput = "",this.passInput=""});
19-
20-
@override
21-
void initState() {
22-
super.initState();
23-
//left this here because idk if there's anything that needs to be added here
24-
}
2516

2617

2718
@override
@@ -30,135 +21,127 @@ class _LoginFormState extends State<LoginForm> {
3021
padding: const EdgeInsets.all(3.5),
3122
width: 400,
3223
height: 400,
33-
child: IndexedStack(
34-
index: stackIndex,
35-
key: ValueKey<int>(stackIndex),
24+
child: Form(
25+
key:_formKey,
26+
child: Column(
27+
mainAxisAlignment: MainAxisAlignment.center,
28+
children: [
29+
Text(
30+
"Log in",
31+
style: GoogleFonts.ubuntu(
32+
fontSize: 25.0,
33+
fontWeight: FontWeight.w500
34+
),
35+
),
3636

37-
children: [
38-
Form(
39-
key:_formKey,
40-
child: Column(
41-
mainAxisAlignment: MainAxisAlignment.center,
42-
children: [
43-
Text(
44-
"Log in",
45-
style: GoogleFonts.ubuntu(
46-
fontSize: 25.0,
47-
fontWeight: FontWeight.w500
48-
),
37+
TextFormField(
38+
enableSuggestions: false,
39+
autocorrect: false,
40+
validator: (value) {
41+
if (value == null || value.isEmpty) {
42+
return "Please enter a valid username";
43+
}
44+
45+
if (value.isNotEmpty) {
46+
setState(() {
47+
userInput = value;
48+
});
49+
}
50+
51+
return "Please enter a valid username";
52+
},
53+
textAlign: TextAlign.center,
54+
decoration: InputDecoration(
55+
labelText: "Username",
56+
labelStyle: GoogleFonts.ubuntu(),
57+
focusedBorder: const UnderlineInputBorder(
58+
borderSide: BorderSide(color: Colors.deepPurpleAccent)
4959
),
60+
floatingLabelStyle: GoogleFonts.ubuntu(
61+
color: Colors.deepPurpleAccent
62+
),
63+
),
5064

51-
TextFormField(
52-
enableSuggestions: false,
53-
autocorrect: false,
54-
validator: (value) {
55-
if (value == null || value.isEmpty) {
56-
return "Please enter a valid username";
57-
}
58-
59-
if (value.isNotEmpty) {
60-
setState(() {
61-
userInput = value;
62-
});
63-
}
64-
65-
return "Please enter a valid username";
66-
},
67-
textAlign: TextAlign.center,
68-
decoration: InputDecoration(
69-
labelText: "Username",
70-
labelStyle: GoogleFonts.ubuntu(),
71-
focusedBorder: const UnderlineInputBorder(
72-
borderSide: BorderSide(color: Colors.deepPurpleAccent)
73-
),
74-
floatingLabelStyle: GoogleFonts.ubuntu(
75-
color: Colors.deepPurpleAccent
76-
),
77-
),
65+
),
66+
Text(
67+
"",
68+
style: GoogleFonts.ubuntu(
69+
fontSize: 11.0,
70+
fontWeight: FontWeight.w500
71+
)
72+
),
7873

74+
TextFormField(
75+
enableSuggestions: false,
76+
autocorrect: false,
77+
obscureText: true,
78+
validator: (value) {
79+
if (value == null || value.isEmpty) {
80+
return "Please enter a valid password";
81+
}
82+
83+
if (value.isNotEmpty) {
84+
setState(() {
85+
passInput = value;
86+
});
87+
}
88+
89+
return "Please enter a valid password";
90+
},
91+
92+
textAlign: TextAlign.center,
93+
decoration: InputDecoration(
94+
labelText: "Password",
95+
labelStyle: GoogleFonts.ubuntu(),
96+
focusedBorder: const UnderlineInputBorder(
97+
borderSide: BorderSide(color: Colors.deepPurpleAccent)
7998
),
80-
Text(
81-
"",
82-
style: GoogleFonts.ubuntu(
83-
fontSize: 11.0,
84-
fontWeight: FontWeight.w500
85-
)
99+
floatingLabelStyle: GoogleFonts.ubuntu(
100+
color: Colors.deepPurpleAccent
86101
),
87-
88-
TextFormField(
89-
enableSuggestions: false,
90-
autocorrect: false,
91-
obscureText: true,
92-
validator: (value) {
93-
if (value == null || value.isEmpty) {
94-
return "Please enter a valid password";
95-
}
96-
97-
if (value.isNotEmpty) {
98-
setState(() {
99-
passInput = value;
100-
});
101-
}
102-
103-
return "Please enter a valid password";
104-
},
105-
106-
textAlign: TextAlign.center,
107-
decoration: InputDecoration(
108-
labelText: "Password",
109-
labelStyle: GoogleFonts.ubuntu(),
110-
focusedBorder: const UnderlineInputBorder(
111-
borderSide: BorderSide(color: Colors.deepPurpleAccent)
112-
),
113-
floatingLabelStyle: GoogleFonts.ubuntu(
114-
color: Colors.deepPurpleAccent
102+
),
103+
),
104+
Row(
105+
mainAxisAlignment: MainAxisAlignment.end,
106+
children: [
107+
GestureDetector(
108+
child: Container(
109+
margin: const EdgeInsets.all(15.0),
110+
child: Text(
111+
"Forgot password?",
112+
style: GoogleFonts.ubuntu(
113+
color: Colors.deepPurpleAccent,
114+
),
115115
),
116-
),
116+
)
117117
),
118-
Row(
119-
mainAxisAlignment: MainAxisAlignment.end,
120-
children: [
121-
GestureDetector(
122-
child: Container(
123-
margin: const EdgeInsets.all(15.0),
124-
child: Text(
125-
"Forgot password?",
126-
style: GoogleFonts.ubuntu(
127-
color: Colors.deepPurpleAccent,
128-
),
118+
],
119+
),
120+
Row(
121+
mainAxisAlignment: MainAxisAlignment.end,
122+
children: [
123+
Padding(
124+
padding: const EdgeInsets.fromLTRB(15.0, 8.0, 15.0, 0.0),
125+
child: ElevatedButton(
126+
onPressed: () => _formKey.currentState!.validate(),
127+
child: Padding(
128+
padding: const EdgeInsets.all(12.0),
129+
child: Text(
130+
"Log in",
131+
style: GoogleFonts.ubuntu(
132+
color: Colors.white,
129133
),
130-
)
134+
),
131135
),
132-
],
133-
),
134-
Row(
135-
mainAxisAlignment: MainAxisAlignment.end,
136-
children: [
137-
Padding(
138-
padding: const EdgeInsets.fromLTRB(15.0, 8.0, 15.0, 0.0),
139-
child: ElevatedButton(
140-
onPressed: () => _formKey.currentState!.validate(),
141-
child: Padding(
142-
padding: const EdgeInsets.all(12.0),
143-
child: Text(
144-
"Log in",
145-
style: GoogleFonts.ubuntu(
146-
color: Colors.white,
147-
),
148-
),
149-
),
150-
style: ElevatedButton.styleFrom(
151-
primary: Colors.deepPurpleAccent,
152-
),
153-
)
136+
style: ElevatedButton.styleFrom(
137+
primary: Colors.deepPurpleAccent,
154138
),
155-
],
156-
)
139+
)
140+
),
157141
],
158-
),
159-
),
160-
161-
],
142+
)
143+
],
144+
),
162145
),
163146
);
164147
}

0 commit comments

Comments
 (0)