-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from SCCapstone/profile-nghia
Profile nghia
- Loading branch information
Showing
3 changed files
with
152 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class User { | ||
String name; | ||
String about; | ||
String imagePath; | ||
//final List<StepState> progress; | ||
|
||
//save user data | ||
//get user data | ||
|
||
User({required this.name, required this.about, required this.imagePath}); | ||
|
||
void saveData() {} | ||
void loadData() {} | ||
} | ||
|
||
class UserPreferences { | ||
static User myUser = User( | ||
name: "Lorem Ipsum", | ||
about: "BIO: This is where the profile would be. " | ||
"This is would hold the users information as well as the settings area of the app. " | ||
"This would keep statistics such as your streaks and could even show proficiencies", | ||
imagePath: | ||
"https://static.vecteezy.com/system/resources/thumbnails/003/337/584/small/default-avatar-photo-placeholder-profile-icon-vector.jpg"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:pohnpeian_language_app/models/userModel.dart'; | ||
import 'package:pohnpeian_language_app/theme/style.dart' as style; | ||
|
||
class EditProfilePage extends StatefulWidget { | ||
@override | ||
_EditProfilePageState createState() => _EditProfilePageState(); | ||
} | ||
|
||
class _EditProfilePageState extends State<EditProfilePage> { | ||
TextEditingController nameController = TextEditingController(); | ||
TextEditingController aboutController = TextEditingController(); | ||
User user = UserPreferences.myUser; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text("Profile"), | ||
backgroundColor: const Color.fromARGB(255, 117, 178, 221), | ||
), | ||
body: ListView( | ||
children: [ | ||
Container( | ||
margin: const EdgeInsets.all(30), | ||
child: TextFormField( | ||
controller: nameController, | ||
decoration: const InputDecoration( | ||
border: OutlineInputBorder(), | ||
labelText: 'User Name', | ||
labelStyle: TextStyle(color: Colors.black), | ||
))), | ||
Container( | ||
margin: const EdgeInsets.fromLTRB(30, 0, 30, 30), | ||
child: TextFormField( | ||
keyboardType: TextInputType.multiline, | ||
maxLines: 7, | ||
controller: aboutController, | ||
decoration: const InputDecoration( | ||
alignLabelWithHint: true, | ||
border: OutlineInputBorder(), | ||
labelText: 'About Me', | ||
labelStyle: TextStyle( | ||
color: Colors.black, | ||
), | ||
))), | ||
Container( | ||
margin: const EdgeInsets.fromLTRB(30, 0, 30, 0), | ||
child: ElevatedButton( | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: style.secondary, | ||
), | ||
child: const Text('Submit Changes'), | ||
onPressed: () { | ||
// state conditions for changing name | ||
if (nameController.text != "") { | ||
UserPreferences.myUser.name = nameController.text; | ||
} | ||
UserPreferences.myUser.about = aboutController.text; | ||
UserPreferences.myUser.saveData(); | ||
Navigator.pop(context); | ||
}, | ||
)) | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters