Skip to content

Commit a76eb22

Browse files
Hossam mohamed create profile summary widget layout (#145)
Co-authored-by: Ziad <62536773+ZiadMontaser@users.noreply.github.com> Co-authored-by: ZiadMontaser <ziadmontaser2005@gmail.com>
1 parent 97c8682 commit a76eb22

31 files changed

Lines changed: 1613 additions & 191 deletions

lam7a/.metadata

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "ac4e799d237041cf905519190471f657b657155a"
7+
revision: "9f455d2486bcb28cad87b062475f42edc959f636"
88
channel: "stable"
99

1010
project_type: app
@@ -13,26 +13,11 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: ac4e799d237041cf905519190471f657b657155a
17-
base_revision: ac4e799d237041cf905519190471f657b657155a
18-
- platform: android
19-
create_revision: ac4e799d237041cf905519190471f657b657155a
20-
base_revision: ac4e799d237041cf905519190471f657b657155a
21-
- platform: ios
22-
create_revision: ac4e799d237041cf905519190471f657b657155a
23-
base_revision: ac4e799d237041cf905519190471f657b657155a
24-
- platform: linux
25-
create_revision: ac4e799d237041cf905519190471f657b657155a
26-
base_revision: ac4e799d237041cf905519190471f657b657155a
27-
- platform: macos
28-
create_revision: ac4e799d237041cf905519190471f657b657155a
29-
base_revision: ac4e799d237041cf905519190471f657b657155a
16+
create_revision: 9f455d2486bcb28cad87b062475f42edc959f636
17+
base_revision: 9f455d2486bcb28cad87b062475f42edc959f636
3018
- platform: web
31-
create_revision: ac4e799d237041cf905519190471f657b657155a
32-
base_revision: ac4e799d237041cf905519190471f657b657155a
33-
- platform: windows
34-
create_revision: ac4e799d237041cf905519190471f657b657155a
35-
base_revision: ac4e799d237041cf905519190471f657b657155a
19+
create_revision: 9f455d2486bcb28cad87b062475f42edc959f636
20+
base_revision: 9f455d2486bcb28cad87b062475f42edc959f636
3621

3722
# User provided section
3823

lam7a/lib/core/widgets/app_outlined_button.dart

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,42 @@ class AppOutlinedButton extends StatelessWidget {
88
final Color textColor;
99
final double borderRadius;
1010
final EdgeInsetsGeometry padding;
11+
final double fontSize;
12+
final FontWeight fontWeight;
1113

1214
const AppOutlinedButton({
1315
super.key,
1416
required this.text,
1517
required this.onPressed,
1618
this.backgroundColor = Colors.white,
17-
this.borderColor = const Color.fromRGBO(197, 200, 202, 1),
19+
this.borderColor = const Color.fromRGBO(207, 217, 222, 1),
1820
this.textColor = Colors.black,
1921
this.borderRadius = 20,
2022
this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
23+
this.fontSize = 14,
24+
this.fontWeight = FontWeight.w600,
2125
});
2226

2327
@override
2428
Widget build(BuildContext context) {
25-
return ElevatedButton(
29+
return OutlinedButton(
2630
onPressed: onPressed,
27-
style: ElevatedButton.styleFrom(
31+
style: OutlinedButton.styleFrom(
2832
backgroundColor: backgroundColor,
29-
foregroundColor: textColor,
30-
elevation: 0,
31-
padding: padding,
33+
side: BorderSide(color: borderColor, width: 1),
3234
shape: RoundedRectangleBorder(
3335
borderRadius: BorderRadius.circular(borderRadius),
34-
side: BorderSide(color: borderColor, width: 1),
36+
),
37+
padding: padding,
38+
),
39+
child: Text(
40+
text,
41+
style: TextStyle(
42+
color: textColor,
43+
fontSize: fontSize,
44+
fontWeight: fontWeight,
3545
),
3646
),
37-
child: Text(text, style: TextStyle(color: textColor)),
3847
);
3948
}
4049
}

lam7a/lib/features/navigation/ui/view/navigation_home_screen.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'package:lam7a/features/navigation/utils/models/user_main_data.dart';
1414
import 'package:lam7a/features/notifications/ui/views/notifications_screen.dart';
1515
import 'package:lam7a/features/settings/ui/view/main_settings_page.dart';
1616
import 'package:lam7a/features/tweet/ui/view/pages/tweet_home_screen.dart';
17+
import 'package:lam7a/features/profile_features/profile/ui/widgets/profile_header_widget.dart';
1718
class NavigationHomeScreen extends StatefulWidget {
1819
static const String routeName = "navigation";
1920

@@ -40,7 +41,17 @@ class _NavigationHomeScreenState extends State<NavigationHomeScreen> {
4041
Center(child: ConversationsScreen()),
4142
];
4243
List<Widget> drawerItems = [
43-
ListMember("Profile", () {}, iconPath: AppAssets.ProfileIcon),
44+
ListMember("Profile",
45+
() {
46+
Navigator.push(
47+
context,
48+
MaterialPageRoute(
49+
builder: (context) => ProfileHeaderWidget(
50+
userId: 'hossam_dev',
51+
),
52+
),
53+
);
54+
}, iconPath: AppAssets.ProfileIcon),
4455
ListMember("Chat", () {}, iconPath: AppAssets.chatIcon),
4556
ListMember(
4657
"Logout",

lam7a/lib/features/notifications/models/notification_model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:lam7a/features/common/models/tweet_model.dart';
2-
import 'package:lam7a/features/profile_summary/model/profile_model.dart';
2+
import 'package:lam7a/features/profile_features/profile/model2/profile_model.dart';
33

44
enum NotificationType { like, repost, follow, mention, reply }
55

lam7a/lib/features/notifications/services/notifications_service_mock.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:lam7a/features/common/models/tweet_model.dart';
22
import 'package:lam7a/features/notifications/models/notification_model.dart';
33
import 'package:lam7a/features/notifications/services/notifications_service.dart';
4-
import 'package:lam7a/features/profile_summary/model/profile_model.dart';
4+
import 'package:lam7a/features/profile_features/profile/model2/profile_model.dart';
55

66
class NotificationsAPIServiceMock implements NotificationsAPIService {
77

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'package:freezed_annotation/freezed_annotation.dart';
2+
3+
part 'profile_model.freezed.dart';
4+
part 'profile_model.g.dart';
5+
6+
@freezed
7+
abstract class ProfileHeaderModel with _$ProfileHeaderModel {
8+
const factory ProfileHeaderModel({
9+
required String displayName,
10+
required String handle,
11+
required String bio,
12+
required String avatarImage,
13+
required String bannerImage,
14+
@Default(false) bool isVerified,
15+
required String location,
16+
required String birthday,
17+
required String joinedDate,
18+
required int followersCount,
19+
required int followingCount,
20+
}) = _ProfileHeaderModel;
21+
22+
factory ProfileHeaderModel.fromJson(Map<String, dynamic> json) =>
23+
_$ProfileHeaderModelFromJson(json);
24+
}

lam7a/lib/features/profile_summary/model/profile_model.dart renamed to lam7a/lib/features/profile_features/profile/model2/profile_model.dart

File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_riverpod/flutter_riverpod.dart';
3+
import 'ui/widgets/profile_header_widget.dart';
4+
5+
/// Entry point widget to test the profile header UI
6+
class ProfileHeaderMain extends StatelessWidget {
7+
const ProfileHeaderMain({super.key});
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return Scaffold(
12+
appBar: AppBar(
13+
title: Text('Profile Header Demo'),
14+
centerTitle: true,
15+
),
16+
// Just render the ProfileHeaderWidget and pass the user ID
17+
body: ProfileHeaderWidget(userId: 'hossam_dev'),
18+
);
19+
}
20+
}
21+
22+
/// App entry point
23+
void main() {
24+
runApp(
25+
const ProviderScope(
26+
child: MaterialApp(
27+
debugShowCheckedModeBanner: false,
28+
home: ProfileHeaderMain(),
29+
),
30+
),
31+
);
32+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import '../model/profile_model.dart';
2+
import '../../services/mock_profile_api_service.dart';
3+
4+
class EditProfileRepository {
5+
final MockProfileAPIService mockService;
6+
7+
EditProfileRepository({required this.mockService});
8+
9+
Future<ProfileHeaderModel> getProfile(String username) async {
10+
return await mockService.fetchProfile(username);
11+
}
12+
13+
Future<ProfileHeaderModel> updateProfile(ProfileHeaderModel profile) async {
14+
return await mockService.updateProfile(profile);
15+
}
16+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import '../model/profile_model.dart';
2+
import '../../services/mock_profile_api_service.dart';
3+
4+
class ProfileRepository {
5+
final MockProfileAPIService? mockService;
6+
final bool useMock;
7+
8+
ProfileRepository({
9+
this.mockService,
10+
this.useMock = true,
11+
});
12+
13+
Future<ProfileHeaderModel> getProfile(String username) async {
14+
if (useMock) {
15+
if (mockService == null) {
16+
throw StateError('MockProfileAPIService is not provided.');
17+
}
18+
return await mockService!.fetchProfile(username);
19+
} else {
20+
// TODO: Replace with real API call
21+
throw UnimplementedError('Real API service not implemented yet.');
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)