Skip to content

Instantly share code, notes, and snippets.

@umutyerebakmaz
Created June 15, 2023 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umutyerebakmaz/eafd718af9dc3b65659d58124ab135a1 to your computer and use it in GitHub Desktop.
Save umutyerebakmaz/eafd718af9dc3b65659d58124ab135a1 to your computer and use it in GitHub Desktop.
import 'package:biocidalmobile/components/bio_text_form_field.dart';
import 'package:flutter/material.dart';
class BioLoginForm extends StatefulWidget {
const BioLoginForm({super.key});
@override
BioLoginFormState createState() {
return BioLoginFormState();
}
}
class BioLoginFormState extends State<BioLoginForm> {
// Create a global key that uniquely identifies the Form widget
final _formKey = GlobalKey<FormState>();
final emailController = TextEditingController();
final passwordController = TextEditingController();
@override
Widget build(BuildContext context) {
// Build a Form widget using the _formKey created above.
return Form(
key: _formKey,
child: Column(
children: <Widget>[
SafeArea(
child: Center(
child: Column(
children: [
const SizedBox(
height: 30,
),
const Icon(Icons.lock, size: 100),
const SizedBox(
height: 30,
),
const Text(
'Hesabınızla giriş yapın',
style: TextStyle(
color: Colors.black54,
fontSize: 24,
fontWeight: FontWeight.w900,
),
),
const SizedBox(
height: 30,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: BioTextFormField(
controller: emailController,
hintText: 'Email',
obscureText: false,
),
),
const SizedBox(
height: 30,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: BioTextFormField(
controller: passwordController,
hintText: 'Password',
obscureText: true,
),
),
const SizedBox(
height: 30,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: SizedBox(
height: 50,
width: double.infinity,
child: ElevatedButton(
onPressed: () {
// Validate returns true if the form is valid, or false otherwise.
if (_formKey.currentState!.validate()) {
debugPrint(emailController.toString());
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Processing Data')),
);
}
},
child: const Text('Submit'),
),
),
),
const SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
child: const Text(
'Şifrenizi mi unuttunuz ?',
style: TextStyle(
color: Colors.indigo,
fontSize: 12,
),
),
onTap: () {
debugPrint('forget password');
},
),
],
),
),
],
),
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment