123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456 |
- import 'package:flutter/material.dart';
- import 'driverMain.dart';
- import 'driverResisterSuccess.dart';
- class driverRegister extends StatefulWidget {
- @override
- State<driverRegister> createState() => _userRegisterState();
- }
- class _userRegisterState extends State<driverRegister> {
- // text field state
- String name = '';
- String email = '';
- String phoneNumber = '';
- String icNumber = '';
- String password = '';
- String passwordCheck = '';
- // text about car information
- String carID = '';
- String carBrand = '';
- String carColor = '';
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- appBar: AppBar(
- leading: IconButton(
- icon: const Icon(
- Icons.chevron_left,
- size: 36,
- ),
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => driverMain()),
- );
- },
- ),
- ),
- body:
- SingleChildScrollView(
- child: Column(
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start, // Align at the top
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const Align(
- alignment: Alignment.centerLeft,
- child: Text(
- "Register as a Driver..",
- style: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 30,
- fontWeight: FontWeight.bold,
- color: Colors.black,
- ),
- ),
- ),
- // Input name
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "Name",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) => val!.length < 4 ? 'Enter a name more than 3 chars' : null,
- onChanged: (val) {
- setState(() => name = val);
- },
- ),
- ),
- ),
- // Input UPM email
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "UPM email",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) =>
- val!.isEmpty ? 'Enter your UPM email' : null,
- obscureText: false,
- onChanged: (val) {
- setState(() => email= val);
- },
- ),
- ),
- ),
- // Input Phone Number
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "Phone Number (11-, not 011-)",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) =>
- val!.length != 10 ? 'Enter a valid phone number' : null,
- obscureText: false,
- onChanged: (val) {
- setState(() => phoneNumber = val);
- },
- ),
- ),
- ),
- // Input IC number
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "IC Number / Passort Number",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) =>
- val!.length != 12 || val.length != 9 ? 'Enter a valid IC/Passport Number' : null,
- obscureText: false,
- onChanged: (val) {
- setState(() => icNumber = val);
- },
- ),
- ),
- ),
- // Input CarID
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "Car ID (Plate Number)",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) => val!.length < 4 ? 'Enter a valid Car ID' : null,
- onChanged: (val) {
- setState(() => carID = val);
- },
- ),
- ),
- ),
- // Input Car Brand
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "Car Brand",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) => val!.length < 3 ? 'Enter a valid Car Brand' : null,
- onChanged: (val) {
- setState(() => carBrand = val);
- },
- ),
- ),
- ),
- // Input Car Color
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "Car Color",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) => val!.length < 2 ? 'Enter a valid Car Color' : null,
- onChanged: (val) {
- setState(() => carColor = val);
- },
- ),
- ),
- ),
- // Input Password
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "Password",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) =>
- val!.length < 6 ? 'Enter a password > 6 chars long' : null,
- obscureText: true,
- onChanged: (val) {
- setState(() => password = val);
- },
- ),
- ),
- ),
- // Check Password
- const SizedBox(height: 10),
- Container(
- width: 334,
- height: 52,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.white,
- border: Border.all(
- color: const Color.fromRGBO(165, 165, 165, 1),
- width: 1,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10.0),
- child: TextFormField(
- decoration: const InputDecoration(
- hintText: "Password again",
- hintStyle: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Color.fromRGBO(165, 165, 165, 1),
- ),
- border: InputBorder.none,
- ),
- style: const TextStyle(
- fontFamily: 'Poppins',
- fontSize: 20,
- color: Colors.black, // input text color
- ),
- validator: (val) =>
- val! != password ? 'Passwords are different' : null,
- obscureText: true,
- ),
- ),
- ),
- // Continue Button
- const SizedBox(height: 20),
- Container(
- width: 334,
- height: 65,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10),
- color: const Color.fromRGBO(119, 97, 255, 1.0),
- ),
- child: TextButton(
- onPressed: () {
- // Handle Next button press
- Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => driverRegisterSuccess()),
- );
- },
- child: const Text(
- 'Continue',
- style: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 17,
- fontWeight: FontWeight.bold,
- color: Colors.white,
- ),
- ),
- ),
- ),
- const SizedBox(height: 10),
- ],
- ),
- ),
- ],
- ),
- )
- );
- }
- }
|