-
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.
- Loading branch information
1 parent
fbd6450
commit b7c953f
Showing
7 changed files
with
200 additions
and
13 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,19 @@ | ||
class User { | ||
String? uid; | ||
String name; | ||
String email; | ||
|
||
User( | ||
this.uid, | ||
this.name, | ||
this.email, | ||
); | ||
|
||
toJson() { | ||
return { | ||
'name': name, | ||
'email': email, | ||
'userId': uid | ||
}; | ||
} | ||
} |
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
85 changes: 85 additions & 0 deletions
85
lib/src/features/profile/screen/profile/profile_screen.dart
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,85 @@ | ||
import 'package:courses_app/src/constants/images.dart'; | ||
import 'package:courses_app/src/widgets/common/FilledCard.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'widgets/profile_network_image.dart'; | ||
|
||
class ProfileScreen extends StatelessWidget { | ||
const ProfileScreen({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Profile'), | ||
), | ||
body: SingleChildScrollView( | ||
child: Container( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Column( | ||
children: [ | ||
ProfileNetworkImage( | ||
onTap: () {}, | ||
profileImageUrl: | ||
'https://avatars.githubusercontent.com/u/74584143?v=4', | ||
), | ||
const SizedBox( | ||
height: 16.0, | ||
), | ||
Column( | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
Text( | ||
'Ravindra Nag', | ||
style: Theme.of(context).textTheme.headlineMedium, | ||
), | ||
const Text('[email protected]'), | ||
const SizedBox( | ||
height: 16.0, | ||
), | ||
FilledButton( | ||
onPressed: () {}, | ||
child: Row( | ||
mainAxisSize: MainAxisSize.min, | ||
children: const [ | ||
Icon(Icons.edit), | ||
SizedBox( | ||
width: 8.0, | ||
), | ||
Text('Edit profile'), | ||
], | ||
), | ||
) | ||
], | ||
), | ||
const Padding( | ||
padding: EdgeInsets.symmetric(vertical: 20.0), | ||
child: Divider(), | ||
), | ||
FilledButton.tonal( | ||
onPressed: () {}, | ||
style: FilledButton.styleFrom( | ||
padding: const EdgeInsets.symmetric( | ||
vertical: 16.0, | ||
horizontal: 20.0, | ||
), | ||
backgroundColor: Theme.of(context).colorScheme.errorContainer, | ||
foregroundColor: Theme.of(context).colorScheme.error, | ||
), | ||
child: Row( | ||
children: const [ | ||
Icon(Icons.logout), | ||
SizedBox( | ||
width: 10.0, | ||
), | ||
Text('Logout') | ||
], | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
lib/src/features/profile/screen/profile/widgets/profile_network_image.dart
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,44 @@ | ||
import 'package:courses_app/src/constants/images.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ProfileNetworkImage extends StatelessWidget { | ||
const ProfileNetworkImage({ | ||
super.key, | ||
required this.profileImageUrl, | ||
this.onTap | ||
}); | ||
|
||
final String profileImageUrl; | ||
final VoidCallback? onTap; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
padding: const EdgeInsets.all(8.0), | ||
decoration: BoxDecoration( | ||
border: Border.all( | ||
color: Theme.of(context).colorScheme.outline, | ||
width: 2, | ||
), | ||
borderRadius: BorderRadius.circular(100), | ||
), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(100), | ||
child: InkResponse( | ||
radius: 60, | ||
onTap: onTap, | ||
child: FadeInImage( | ||
image: NetworkImage(profileImageUrl), | ||
placeholder: const AssetImage(appLogo), | ||
fit: BoxFit.cover, | ||
width: 100, | ||
height: 100, | ||
imageErrorBuilder: (_, __, ___) { | ||
return Image.asset(appLogo); | ||
}, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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
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
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