edit profile picture updated to dispaly picture
This commit is contained in:
parent
ff8dd55d18
commit
c2df5ec80e
@ -143,10 +143,6 @@ class _ProfilePageState extends State<EditProfilePage> {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
Navigator.pushReplacementNamed(context, '/register');
|
Navigator.pushReplacementNamed(context, '/register');
|
||||||
} else {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
const SnackBar(content: Text('Something went wrong! Please contact an admin.')),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -188,16 +184,46 @@ class _ProfilePageState extends State<EditProfilePage> {
|
|||||||
controller: confirmPasswordInput,
|
controller: confirmPasswordInput,
|
||||||
decoration: InputDecoration(labelText: 'Repeat new password'),
|
decoration: InputDecoration(labelText: 'Repeat new password'),
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('ProfilePicture',
|
||||||
|
style: TextStyle(fontSize: 17)),
|
||||||
|
if (_selectedImage != null)
|
||||||
|
ClipOval(
|
||||||
|
child: Image(
|
||||||
|
image: FileImage(_selectedImage!),
|
||||||
|
height: 100,
|
||||||
|
width: 100,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
ClipOval(
|
||||||
|
child: Image(
|
||||||
|
image: NetworkImage(user!.profilePicture),
|
||||||
|
height: 100,
|
||||||
|
width: 100,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (_selectedImage != null)
|
||||||
|
Text(_selectedImage!.path.toString()),
|
||||||
|
//until here
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(onPressed: _pickImageFromGallery, child: Text('Gallery')),
|
Text('Change using'),
|
||||||
ElevatedButton(onPressed: _pickImageFromCamera, child: Text('Camera'))
|
TextButton(onPressed: _pickImageFromGallery, child: Text('Gallery')),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Text('or'),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
TextButton(onPressed: _pickImageFromCamera, child: Text('Camera'))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
],
|
||||||
Text('ProfilePicture:'),
|
),
|
||||||
if(_selectedImage != null)
|
SizedBox(height: 40),
|
||||||
Text(_selectedImage!.path.toString()),
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
@ -74,12 +74,19 @@ class _ProfilePageState extends State<ProfilePage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
userData?.profilePicture != null ?
|
userData?.profilePicture != null ?
|
||||||
const Icon(
|
ClipOval(
|
||||||
|
child: Image(
|
||||||
|
image: NetworkImage(userData!.profilePicture),
|
||||||
|
height: 100,
|
||||||
|
width: 100, // Ensure width matches the height to make it fully round
|
||||||
|
fit: BoxFit.cover, // This makes sure the image fits inside the circle properly
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const Icon(
|
||||||
Icons.account_circle,
|
Icons.account_circle,
|
||||||
size: 100,
|
size: 100,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
)
|
),
|
||||||
: Image(image: NetworkImage('https://pub-bf709b641048489ca70f693673e3e04c.r2.dev/h4picturebucket/PPb83569bef3b9470782d7b42bc4e552ff.png'), height: 100),
|
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
userData!.username,
|
userData!.username,
|
||||||
|
Loading…
Reference in New Issue
Block a user