Compare commits
2 Commits
d3e45dc899
...
c950d33a71
Author | SHA1 | Date |
---|---|---|
shihern | c950d33a71 | |
shihern | 6efed84683 |
|
@ -90,12 +90,11 @@ class _LoginPageState extends State<LoginPage> {
|
|||
_errorText = "";
|
||||
});
|
||||
try {
|
||||
await widget.loginManager.initAuthentication("+65${controller.text}");
|
||||
// if (false) {
|
||||
// await widget.loginManager.initAuthenticationBypass("+65${controller.text}");
|
||||
// } else {
|
||||
// await widget.loginManager.initAuthentication("+65${controller.text}");
|
||||
// }
|
||||
if (BYPASS_AUTH) {
|
||||
await widget.loginManager.initAuthenticationBypass("+65${controller.text}");
|
||||
} else {
|
||||
await widget.loginManager.initAuthentication("+65${controller.text}");
|
||||
}
|
||||
Navigator.pushNamed(context, 'welcome/otp');
|
||||
} on HttpException catch (e) {
|
||||
print(e.toString());
|
||||
|
|
|
@ -27,14 +27,13 @@ class _HomeViewState extends State<HomeView> {
|
|||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
|
||||
// Getting current user name and bio
|
||||
loginManager.getUser().then((User user) {
|
||||
setState(() {
|
||||
currentUser = user;
|
||||
});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -49,201 +48,207 @@ class _HomeViewState extends State<HomeView> {
|
|||
.textTheme
|
||||
.title
|
||||
.copyWith(color: Theme.of(context).accentColor);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
TopBar(
|
||||
title: "Settings",
|
||||
children: <Widget>[
|
||||
Visibility(
|
||||
child: BackButton(),
|
||||
maintainSize: true,
|
||||
maintainAnimation: true,
|
||||
maintainState: true,
|
||||
visible: false,
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
child: ImageAvatar(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
info: ImageAvatarInfo.fromUser(currentUser),
|
||||
radius: 70.0,
|
||||
showStatus: false),
|
||||
),
|
||||
Positioned(
|
||||
top: 115.0,
|
||||
left: 115.0,
|
||||
child: FloatingActionButton(
|
||||
backgroundColor: Theme.of(context).primaryColorDark,
|
||||
onPressed: () => {},
|
||||
mini: true,
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
color: Colors.white,
|
||||
|
||||
if (currentUser == null) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
} else {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
TopBar(
|
||||
title: "Settings",
|
||||
children: <Widget>[
|
||||
Visibility(
|
||||
child: BackButton(),
|
||||
maintainSize: true,
|
||||
maintainAnimation: true,
|
||||
maintainState: true,
|
||||
visible: false,
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
child: ImageAvatar(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
info: ImageAvatarInfo.fromUser(currentUser),
|
||||
radius: 70.0,
|
||||
showStatus: false),
|
||||
),
|
||||
Positioned(
|
||||
top: 115.0,
|
||||
left: 115.0,
|
||||
child: FloatingActionButton(
|
||||
backgroundColor: Theme.of(context).primaryColorDark,
|
||||
onPressed: () => {},
|
||||
mini: true,
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.only(top: 0.0),
|
||||
children: <Widget>[
|
||||
ListButton(
|
||||
icon: Icons.person,
|
||||
text: currentUser.firstName ?? "",
|
||||
subtitle: 'First name',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit first name',
|
||||
existingText:
|
||||
currentUser.firstName + " " + currentUser.lastName,
|
||||
hintText: 'First name',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(firstName: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.person,
|
||||
text: currentUser.lastName ?? "",
|
||||
subtitle: 'Last name',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit last name',
|
||||
existingText:
|
||||
currentUser.firstName + " " + currentUser.lastName,
|
||||
hintText: 'Last name',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(lastName: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.person,
|
||||
text: currentUser.username ?? "",
|
||||
subtitle: 'Username',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit username',
|
||||
existingText:
|
||||
currentUser.firstName + " " + currentUser.lastName,
|
||||
hintText: 'Username',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(username: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.info,
|
||||
text: currentUser.bio,
|
||||
subtitle: 'Bio',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit Bio',
|
||||
existingText: currentUser.bio,
|
||||
hintText: 'Bio',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(bio: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
Divider(),
|
||||
ListButton(
|
||||
icon: Icons.color_lens,
|
||||
text: 'Interface',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context).pushNamed("settings/interface");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.notifications,
|
||||
text: 'Notifications',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context).pushNamed("settings/notifications");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.security,
|
||||
text: 'Privacy and Security',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context).pushNamed("settings/privacy_security");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.data_usage,
|
||||
text: 'Data Usage',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context).pushNamed("settings/data_usage");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
Divider(),
|
||||
ListButton(
|
||||
icon: Icons.exit_to_app,
|
||||
text: 'Sign Out',
|
||||
onClickCallback: () async {
|
||||
await loginManager.logout();
|
||||
widget.toWelcomePage();
|
||||
},
|
||||
textStyle: Theme.of(context)
|
||||
.textTheme
|
||||
.title
|
||||
.copyWith(color: Colors.redAccent),
|
||||
iconColor: Colors.redAccent,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.only(top: 0.0),
|
||||
children: <Widget>[
|
||||
ListButton(
|
||||
icon: Icons.person,
|
||||
text: currentUser.firstName ?? "",
|
||||
subtitle: 'First name',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit first name',
|
||||
existingText:
|
||||
currentUser.firstName + " " + currentUser.lastName,
|
||||
hintText: 'First name',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(firstName: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.person,
|
||||
text: currentUser.lastName ?? "",
|
||||
subtitle: 'Last name',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit last name',
|
||||
existingText:
|
||||
currentUser.firstName + " " + currentUser.lastName,
|
||||
hintText: 'Last name',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(lastName: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.person,
|
||||
text: currentUser.username ?? "",
|
||||
subtitle: 'Username',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit username',
|
||||
existingText:
|
||||
currentUser.firstName + " " + currentUser.lastName,
|
||||
hintText: 'Username',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(username: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.info,
|
||||
text: currentUser.bio,
|
||||
subtitle: 'Bio',
|
||||
onClickCallback: () {
|
||||
_displayTextFieldDialog(
|
||||
context: context,
|
||||
title: 'Edit Bio',
|
||||
existingText: currentUser.bio,
|
||||
hintText: 'Bio',
|
||||
).then((text) {
|
||||
if (text != null) {
|
||||
setState(() {
|
||||
userApiProvider.updateUser(bio: text);
|
||||
print(text);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
Divider(),
|
||||
ListButton(
|
||||
icon: Icons.color_lens,
|
||||
text: 'Interface',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context).pushNamed("settings/interface");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.notifications,
|
||||
text: 'Notifications',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context).pushNamed("settings/notifications");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.security,
|
||||
text: 'Privacy and Security',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context)
|
||||
.pushNamed("settings/privacy_security");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
ListButton(
|
||||
icon: Icons.data_usage,
|
||||
text: 'Data Usage',
|
||||
onClickCallback: () {
|
||||
Navigator.of(context).pushNamed("settings/data_usage");
|
||||
},
|
||||
textStyle: _titleTheme,
|
||||
iconColor: Theme.of(context).primaryColorDark,
|
||||
),
|
||||
Divider(),
|
||||
ListButton(
|
||||
icon: Icons.exit_to_app,
|
||||
text: 'Sign Out',
|
||||
onClickCallback: () async {
|
||||
await loginManager.logout();
|
||||
widget.toWelcomePage();
|
||||
},
|
||||
textStyle: Theme.of(context)
|
||||
.textTheme
|
||||
.title
|
||||
.copyWith(color: Colors.redAccent),
|
||||
iconColor: Colors.redAccent,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
_displayTextFieldDialog({
|
||||
|
|
Loading…
Reference in New Issue