Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Widget>[
- Container(
- child: TextFormField(
- controller: username,
- decoration:
- InputDecoration(labelText: 'Username'),
- validator: (value) {
- if (value.isEmpty) {
- return 'Username cannot be empty';
- }
- },
- ),
- ),
- Container(
- margin: const EdgeInsets.only(top: 12),
- child: TextFormField(
- controller: password,
- obscureText: true,
- decoration:
- InputDecoration(labelText: 'Password'),
- validator: (value) {
- if (value.isEmpty) {
- return 'Password cannot be empty';
- }
- },
- ),
- ),
- Container(
- margin: const EdgeInsets.only(top: 12),
- child: TextFormField(
- controller: email,
- decoration: InputDecoration(labelText: 'Email'),
- validator: (value) {
- RegExp emailValidator = new RegExp(
- r'^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$');
- if (!emailValidator.hasMatch(value)) {
- return 'Email is invalid';
- }
- },
- ),
- ),
- Container(
- margin: const EdgeInsets.only(top: 12),
- child: TextFormField(
- controller: address,
- decoration:
- InputDecoration(labelText: 'Address'),
- validator: (value) {
- if (value.isEmpty) {
- return 'Address cannot be empty';
- }
- }),
- ),
- Container(
- margin: const EdgeInsets.only(top: 12),
- child: TextFormField(
- controller: nationalID,
- decoration:
- InputDecoration(labelText: 'National ID'),
- keyboardType: TextInputType.number,
- validator: validateNationalID),
- ),
- Container(
- margin: const EdgeInsets.only(top: 12),
- child: new DropdownButton<String>(
- items: constants.AvailableProvince.map(
- (String value) {
- return new DropdownMenuItem<String>(
- value: value,
- child: new Text(value),
- );
- }).toList(),
- onChanged: (value) {
- setState(() {
- province = value;
- });
- },
- hint: Text("Province"),
- value: province,
- isExpanded: true,
- ),
- ),
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement