Skip to content

Commit

Permalink
Improve registration UI
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyjavier committed Nov 3, 2019
1 parent 32afbb5 commit 2f171c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 43 deletions.
8 changes: 0 additions & 8 deletions lib/screens/register_one.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ class _RegisterOneState extends State<RegisterOne> {
_password_c = new TextEditingController();
_confirm_password_c = new TextEditingController();
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) => onMount());
}

void onMount() {
_email_c.text = storage.getItem("register_data")["email"] != null ? storage.getItem("register_data")["email"] : "";
_mobile_number_c.text = storage.getItem("register_data")["mobile_number"] != null ? storage.getItem("register_data")["mobile_number"] : "";
_password_c.text = storage.getItem("register_data")["password"] != null ? storage.getItem("register_data")["password"] : "";
_confirm_password_c.text = storage.getItem("register_data")["password"] != null ? storage.getItem("register_data")["password"] : "";
}

Future<bool> _onBack() {
Expand Down
55 changes: 20 additions & 35 deletions lib/screens/register_two.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ class _RegisterTwoState extends State<RegisterTwo> {
_lastname_c = new TextEditingController();
_birthday_c = new TextEditingController();
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) => onMount());
}

void onMount() {
_username_c.text = storage.getItem("register_data")["username"] != null ? storage.getItem("register_data")["username"] : "";
_firstname_c.text = storage.getItem("register_data")["firstname"] != null ? storage.getItem("register_data")["firstname"] : "";
_lastname_c.text = storage.getItem("register_data")["lastname"] != null ? storage.getItem("register_data")["lastname"] : "";
_birthday_c.text = storage.getItem("register_data")["birthday"] != null ? storage.getItem("register_data")["birthday"] : "";
}

@override
Expand Down Expand Up @@ -141,34 +133,31 @@ class _RegisterTwoState extends State<RegisterTwo> {
padding: EdgeInsets.symmetric(vertical: 0.0, horizontal: 30.0),
child: TextFormField(
controller: _birthday_c,
onTap: () {
DatePicker.showDatePicker(context,
locale: LocaleType.en,
currentTime: DateTime.now(),
maxTime: DateTime.now(),
showTitleActions: true,
theme: DatePickerTheme(
backgroundColor: Colors.black,
itemStyle: TextStyle( color: Colors.white, fontWeight: FontWeight.bold),
doneStyle: TextStyle(color: Colors.white, fontSize: 16),
cancelStyle: TextStyle(color: Colors.white, fontSize: 16),
),
onConfirm: (date) {
setState(() {
_birthday = formatDate(date, [yyyy, "-", mm, "-", dd]);
_birthday_c.text = formatDate(date, [yyyy, "-", mm, "-", dd]);
});
},
);
},
maxLines: 1,
readOnly: true,
decoration: InputDecoration(
hintText: "Enter your birthday",
labelText: "Birthday",
suffixIcon: TextFieldIconButton(
icon: Icons.calendar_today,
onPressed: () {
DatePicker.showDatePicker(context,
locale: LocaleType.en,
currentTime: DateTime.now(),
maxTime: DateTime.now(),
showTitleActions: true,
theme: DatePickerTheme(
backgroundColor: Colors.black,
itemStyle: TextStyle( color: Colors.white, fontWeight: FontWeight.bold),
doneStyle: TextStyle(color: Colors.white, fontSize: 16),
),
onChanged: (date) { print(formatDate(date, [yyyy, "-", mm, "-", dd])); },
onConfirm: (date) {
setState(() {
_birthday = formatDate(date, [yyyy, "-", mm, "-", dd]);
_birthday_c.text = formatDate(date, [yyyy, "-", mm, "-", dd]);
});
},
);
},
),
),
validator: (input) {
if (input.isEmpty)
Expand Down Expand Up @@ -266,10 +255,6 @@ class _RegisterTwoState extends State<RegisterTwo> {
)
);
}
setState(() {
_signing_up = false;
_username_matched = false;
});
}
}
}

0 comments on commit 2f171c7

Please sign in to comment.