Compare commits
2 Commits
d3e45dc899
...
c950d33a71
Author | SHA1 | Date |
---|---|---|
shihern | c950d33a71 | |
shihern | 6efed84683 |
|
@ -90,12 +90,11 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
_errorText = "";
|
_errorText = "";
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await widget.loginManager.initAuthentication("+65${controller.text}");
|
if (BYPASS_AUTH) {
|
||||||
// if (false) {
|
await widget.loginManager.initAuthenticationBypass("+65${controller.text}");
|
||||||
// await widget.loginManager.initAuthenticationBypass("+65${controller.text}");
|
} else {
|
||||||
// } else {
|
await widget.loginManager.initAuthentication("+65${controller.text}");
|
||||||
// await widget.loginManager.initAuthentication("+65${controller.text}");
|
}
|
||||||
// }
|
|
||||||
Navigator.pushNamed(context, 'welcome/otp');
|
Navigator.pushNamed(context, 'welcome/otp');
|
||||||
} on HttpException catch (e) {
|
} on HttpException catch (e) {
|
||||||
print(e.toString());
|
print(e.toString());
|
||||||
|
|
|
@ -27,14 +27,13 @@ class _HomeViewState extends State<HomeView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
|
||||||
|
|
||||||
// Getting current user name and bio
|
// Getting current user name and bio
|
||||||
loginManager.getUser().then((User user) {
|
loginManager.getUser().then((User user) {
|
||||||
setState(() {
|
setState(() {
|
||||||
currentUser = user;
|
currentUser = user;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -49,201 +48,207 @@ class _HomeViewState extends State<HomeView> {
|
||||||
.textTheme
|
.textTheme
|
||||||
.title
|
.title
|
||||||
.copyWith(color: Theme.of(context).accentColor);
|
.copyWith(color: Theme.of(context).accentColor);
|
||||||
return Column(
|
|
||||||
children: <Widget>[
|
if (currentUser == null) {
|
||||||
TopBar(
|
return Center(child: CircularProgressIndicator());
|
||||||
title: "Settings",
|
} else {
|
||||||
children: <Widget>[
|
return Column(
|
||||||
Visibility(
|
children: <Widget>[
|
||||||
child: BackButton(),
|
TopBar(
|
||||||
maintainSize: true,
|
title: "Settings",
|
||||||
maintainAnimation: true,
|
children: <Widget>[
|
||||||
maintainState: true,
|
Visibility(
|
||||||
visible: false,
|
child: BackButton(),
|
||||||
),
|
maintainSize: true,
|
||||||
Spacer(),
|
maintainAnimation: true,
|
||||||
],
|
maintainState: true,
|
||||||
),
|
visible: false,
|
||||||
Row(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Spacer(),
|
||||||
children: <Widget>[
|
],
|
||||||
Stack(
|
),
|
||||||
children: <Widget>[
|
Row(
|
||||||
Positioned(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: ImageAvatar(
|
children: <Widget>[
|
||||||
padding: EdgeInsets.all(20.0),
|
Stack(
|
||||||
info: ImageAvatarInfo.fromUser(currentUser),
|
children: <Widget>[
|
||||||
radius: 70.0,
|
Positioned(
|
||||||
showStatus: false),
|
child: ImageAvatar(
|
||||||
),
|
padding: EdgeInsets.all(20.0),
|
||||||
Positioned(
|
info: ImageAvatarInfo.fromUser(currentUser),
|
||||||
top: 115.0,
|
radius: 70.0,
|
||||||
left: 115.0,
|
showStatus: false),
|
||||||
child: FloatingActionButton(
|
),
|
||||||
backgroundColor: Theme.of(context).primaryColorDark,
|
Positioned(
|
||||||
onPressed: () => {},
|
top: 115.0,
|
||||||
mini: true,
|
left: 115.0,
|
||||||
child: Icon(
|
child: FloatingActionButton(
|
||||||
Icons.edit,
|
backgroundColor: Theme.of(context).primaryColorDark,
|
||||||
color: Colors.white,
|
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({
|
_displayTextFieldDialog({
|
||||||
|
|
Loading…
Reference in New Issue