diff --git a/Mobile/lib/editprofile.dart b/Mobile/lib/editprofile.dart index e79d74a..24ac03b 100644 --- a/Mobile/lib/editprofile.dart +++ b/Mobile/lib/editprofile.dart @@ -143,10 +143,6 @@ class _ProfilePageState extends State { Navigator.of(context).pop(); 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 { controller: confirmPasswordInput, decoration: InputDecoration(labelText: 'Repeat new password'), ), - Row( + SizedBox(height: 20), + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - ElevatedButton(onPressed: _pickImageFromGallery, child: Text('Gallery')), - ElevatedButton(onPressed: _pickImageFromCamera, child: Text('Camera')) + 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( + children: [ + Text('Change using'), + 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) - Text(_selectedImage!.path.toString()), + SizedBox(height: 40), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/Mobile/lib/profile.dart b/Mobile/lib/profile.dart index f522529..173e6be 100644 --- a/Mobile/lib/profile.dart +++ b/Mobile/lib/profile.dart @@ -74,12 +74,19 @@ class _ProfilePageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ 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, size: 100, color: Colors.grey, - ) - : Image(image: NetworkImage('https://pub-bf709b641048489ca70f693673e3e04c.r2.dev/h4picturebucket/PPb83569bef3b9470782d7b42bc4e552ff.png'), height: 100), + ), const SizedBox(height: 20), Text( userData!.username,