update 251128
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:whi_flutter/const.dart';
|
||||
|
||||
@@ -9,7 +10,7 @@ class SignupPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SignupPageState extends State<SignupPage> {
|
||||
final _formKey = GlobalKey();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _usernameController = TextEditingController();
|
||||
final _ageController = TextEditingController();
|
||||
final _passwordController = TextEditingController();
|
||||
@@ -27,6 +28,15 @@ class _SignupPageState extends State<SignupPage> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _signup(){
|
||||
if(_formKey.currentState!.validate()){
|
||||
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text("Creating accout...")));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -37,7 +47,40 @@ class _SignupPageState extends State<SignupPage> {
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [],
|
||||
children: [
|
||||
_buildTextField(
|
||||
isDarkMode: isDarkMode,
|
||||
controller:_usernameController,
|
||||
hintText:'username',
|
||||
prefixIcon: Icons.account_circle_outlined,
|
||||
validator: (value){
|
||||
if (value == null || value.isEmpty){
|
||||
return 'please enter a username';
|
||||
}
|
||||
}
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: _signup,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primaryColor,
|
||||
padding: const EdgeInsets. symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)
|
||||
),
|
||||
elevation: 5,
|
||||
shadowColor: primaryColor.withValues(alpha: 0.4)
|
||||
),
|
||||
child: const Text(
|
||||
'Sign Up',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
fontFamily: 'poppins',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -95,3 +138,5 @@ Widget _buildTextField({
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user