Skip to content

Commit 55ff844

Browse files
authored
Merge pull request #10 from lamb1engcode/feat/edit-profile-screen
Feat/edit profile screen
2 parents 2f3ddb4 + 3744be7 commit 55ff844

20 files changed

+546
-180
lines changed

lib/core/app/colors/app_color.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Color mCM = Colors.grey.shade200;
2929
Color mCU = Colors.grey.shade300;
3030
Color mCH = Colors.grey.shade400;
3131
Color mGB = Colors.grey.shade500;
32+
Color mGM = Colors.grey.shade700;
3233
Color mGD = Colors.grey.shade900;
3334
Color mCD = Colors.black.withOpacity(0.075);
3435
Color mCC = Colors.green.withOpacity(0.65);

lib/core/util/custom_image/place_holder_image.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:streamskit_mobile/core/app/colors/app_color.dart';
23
import 'package:streamskit_mobile/core/util/shimmer/fade_shimmer.dart';
34
import 'package:streamskit_mobile/core/util/themes/app_color.dart';
45

lib/core/util/styles/profile_style.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:streamskit_mobile/core/app/colors/app_color.dart';
23
import 'package:streamskit_mobile/core/util/sizer_custom/sizer.dart';
34
import 'package:streamskit_mobile/core/util/themes/app_color.dart';
45

@@ -34,6 +35,20 @@ TextStyle text11cB1 = TextStyle(
3435
overflow: TextOverflow.ellipsis,
3536
);
3637

38+
///Text size: 11 color : mGB
39+
TextStyle text11mGB = TextStyle(
40+
color: mGB,
41+
fontSize: 11.sp,
42+
overflow: TextOverflow.ellipsis,
43+
);
44+
45+
///Text size: 11 color : mGM
46+
TextStyle text11mGM = TextStyle(
47+
color: mGM,
48+
fontSize: 11.sp,
49+
overflow: TextOverflow.ellipsis,
50+
);
51+
3752
///Text size: 9 color: mCL
3853
TextStyle text9mCL = TextStyle(
3954
color: mCL,

lib/core/util/themes/app_color.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,3 @@ var colorBlue = const Color(0xFF1d51fe);
99
var colorPurple = const Color(0xFF7d60e5);
1010
var colorHintText = const Color(0xFFa0a0a0);
1111

12-
Color mC = Colors.grey.shade100;
13-
Color mCL = Colors.white;
14-
Color mCM = Colors.grey.shade200;
15-
Color mCH = Colors.grey.shade400;
16-
Color mCD = Colors.black.withOpacity(0.075);
17-
Color mCC = Colors.green.withOpacity(0.65);
18-
Color fCD = Colors.grey.shade700;
19-
Color fCL = Colors.grey;

lib/features/home.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:ui';
22
import 'package:flutter/material.dart';
33
import 'package:phosphor_flutter/phosphor_flutter.dart';
4+
import 'package:streamskit_mobile/core/app/colors/app_color.dart';
45
import 'package:streamskit_mobile/core/util/common/touchable_opacity.dart';
56
import 'package:streamskit_mobile/core/util/sizer_custom/sizer.dart';
67
import 'package:streamskit_mobile/core/util/themes/app_color.dart';

lib/features/home/data/model/user_model.dart

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ class UserModel {
88
final String fullName;
99
final String urlToImage;
1010
String? description;
11+
String? phoneNumber;
12+
bool gender;
13+
DateTime? birthday;
1114
int? posts;
1215
int? followings;
1316
int? followers;
1417
List<String>? listFields;
15-
final bool isLiveStream;
18+
bool isLiveStream;
1619
UserModel({
1720
this.id,
1821
required this.fullName,
1922
required this.urlToImage,
2023
this.description,
24+
this.phoneNumber,
25+
this.gender = false,
26+
this.birthday,
2127
this.posts,
2228
this.followings,
2329
this.followers,
@@ -30,6 +36,9 @@ class UserModel {
3036
String? fullName,
3137
String? urlToImage,
3238
String? description,
39+
String? phoneNumber,
40+
bool? gender,
41+
DateTime? birthday,
3342
int? posts,
3443
int? followings,
3544
int? followers,
@@ -41,6 +50,9 @@ class UserModel {
4150
fullName: fullName ?? this.fullName,
4251
urlToImage: urlToImage ?? this.urlToImage,
4352
description: description ?? this.description,
53+
phoneNumber: phoneNumber ?? this.phoneNumber,
54+
gender: gender ?? this.gender,
55+
birthday: birthday ?? this.birthday,
4456
posts: posts ?? this.posts,
4557
followings: followings ?? this.followings,
4658
followers: followers ?? this.followers,
@@ -55,6 +67,9 @@ class UserModel {
5567
'fullName': fullName,
5668
'urlToImage': urlToImage,
5769
'description': description,
70+
'phoneNumber': phoneNumber,
71+
'gender': gender,
72+
'birthday': birthday?.millisecondsSinceEpoch,
5873
'posts': posts,
5974
'followings': followings,
6075
'followers': followers,
@@ -69,6 +84,11 @@ class UserModel {
6984
fullName: map['fullName'] ?? '',
7085
urlToImage: map['urlToImage'] ?? '',
7186
description: map['description'],
87+
phoneNumber: map['phoneNumber'],
88+
gender: map['gender'] ?? false,
89+
birthday: map['birthday'] != null
90+
? DateTime.fromMillisecondsSinceEpoch(map['birthday'])
91+
: null,
7292
posts: map['posts']?.toInt(),
7393
followings: map['followings']?.toInt(),
7494
followers: map['followers']?.toInt(),
@@ -84,7 +104,7 @@ class UserModel {
84104

85105
@override
86106
String toString() {
87-
return 'UserModel(id: $id, fullName: $fullName, urlToImage: $urlToImage, description: $description, posts: $posts, followings: $followings, followers: $followers, listFields: $listFields, isLiveStream: $isLiveStream)';
107+
return 'UserModel(id: $id, fullName: $fullName, urlToImage: $urlToImage, description: $description, phoneNumber: $phoneNumber, gender: $gender, birthday: $birthday, posts: $posts, followings: $followings, followers: $followers, listFields: $listFields, isLiveStream: $isLiveStream)';
88108
}
89109

90110
@override
@@ -96,6 +116,9 @@ class UserModel {
96116
other.fullName == fullName &&
97117
other.urlToImage == urlToImage &&
98118
other.description == description &&
119+
other.phoneNumber == phoneNumber &&
120+
other.gender == gender &&
121+
other.birthday == birthday &&
99122
other.posts == posts &&
100123
other.followings == followings &&
101124
other.followers == followers &&
@@ -109,6 +132,9 @@ class UserModel {
109132
fullName.hashCode ^
110133
urlToImage.hashCode ^
111134
description.hashCode ^
135+
phoneNumber.hashCode ^
136+
gender.hashCode ^
137+
birthday.hashCode ^
112138
posts.hashCode ^
113139
followings.hashCode ^
114140
followers.hashCode ^

lib/features/home/presentation/widgets/button_circle.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import 'package:flutter/material.dart';
22
import 'package:phosphor_flutter/phosphor_flutter.dart';
3+
import 'package:streamskit_mobile/core/app/colors/app_color.dart';
34
import 'package:streamskit_mobile/core/util/common/touchable_opacity.dart';
45
import 'package:streamskit_mobile/core/util/sizer_custom/sizer.dart';
5-
import 'package:streamskit_mobile/core/util/themes/app_color.dart';
66

77
class ButtonCircle extends StatelessWidget {
88
final IconData? icon;

lib/features/home/presentation/widgets/category_card.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:streamskit_mobile/core/app/colors/app_color.dart';
23
import 'package:streamskit_mobile/core/util/common/touchable_opacity.dart';
34
import 'package:streamskit_mobile/core/util/sizer_custom/sizer.dart';
45
import 'package:streamskit_mobile/core/util/themes/app_color.dart';

lib/features/home/presentation/widgets/user_widget.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:streamskit_mobile/core/app/colors/app_color.dart';
23
import 'package:streamskit_mobile/core/util/custom_image/custom_netword_image.dart';
34
import 'package:streamskit_mobile/core/util/sizer_custom/sizer.dart';
45
import 'package:streamskit_mobile/core/util/themes/app_color.dart';
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_phosphor_icons/flutter_phosphor_icons.dart';
3+
import 'package:streamskit_mobile/core/app/colors/app_color.dart';
4+
import 'package:streamskit_mobile/core/util/common/touchable_opacity.dart';
5+
import 'package:streamskit_mobile/core/util/custom_image/custom_netword_image.dart';
6+
import 'package:streamskit_mobile/core/util/sizer_custom/sizer.dart';
7+
import 'package:streamskit_mobile/core/util/styles/profile_style.dart';
8+
import 'package:streamskit_mobile/features/home/data/model/user_model.dart';
9+
import 'package:streamskit_mobile/features/profile/presentation/widgets/bottom_sheet_gender.dart';
10+
import 'package:streamskit_mobile/features/profile/presentation/widgets/edit_profile_widget.dart';
11+
12+
class EditProfileScreen extends StatefulWidget {
13+
const EditProfileScreen({Key? key}) : super(key: key);
14+
15+
@override
16+
State<EditProfileScreen> createState() => _EditProfileScreenState();
17+
}
18+
19+
class _EditProfileScreenState extends State<EditProfileScreen> {
20+
final UserModel user = UserModel(
21+
id: "",
22+
urlToImage:
23+
"https://donoithatdanang.com/wp-content/uploads/2021/11/mang-hinh-khoa-cute-08.jpg",
24+
fullName: "Tony Tony Chopper",
25+
description:
26+
"Hành trình leo thách đấu mùa 12 cùng top lane!\nhttps://www.facebook.com/chopper189 \n11PM-12PM",
27+
posts: 1000,
28+
followers: 9400,
29+
followings: 8543337121,
30+
listFields: null);
31+
@override
32+
Widget build(BuildContext context) {
33+
return Scaffold(
34+
backgroundColor: Theme.of(context).backgroundColor,
35+
appBar: AppBar(
36+
elevation: 0,
37+
leadingWidth: 64.sp,
38+
centerTitle: true,
39+
backgroundColor: Colors.transparent,
40+
title: Text(
41+
"Edit profile",
42+
style: text13w700mCL,
43+
),
44+
leading: Padding(
45+
padding: EdgeInsets.symmetric(horizontal: 16.sp),
46+
child: TouchableOpacity(
47+
onTap: () {
48+
Navigator.pop(context);
49+
},
50+
child: Icon(
51+
PhosphorIcons.arrow_left,
52+
color: mCL,
53+
),
54+
),
55+
),
56+
),
57+
body: Column(
58+
crossAxisAlignment: CrossAxisAlignment.start,
59+
children: [
60+
TouchableOpacity(
61+
onTap: () {},
62+
child: Container(
63+
padding: EdgeInsets.symmetric(horizontal: 8.sp, vertical: 8.sp),
64+
decoration: BoxDecoration(
65+
color: Colors.grey.shade900,
66+
),
67+
child: Row(
68+
children: [
69+
Padding(
70+
padding: EdgeInsets.only(left: 8.sp),
71+
child: Text(
72+
"Ảnh đại diện",
73+
style: text11mGB,
74+
),
75+
),
76+
const Spacer(),
77+
CustomNetworkImage(
78+
urlToImage: user.urlToImage,
79+
height: 36.sp,
80+
width: 36.sp,
81+
),
82+
SizedBox(
83+
width: 1.sp,
84+
),
85+
Icon(
86+
Icons.navigate_next,
87+
size: 18.sp,
88+
color: mGB,
89+
)
90+
],
91+
),
92+
),
93+
),
94+
SizedBox(height: 12.sp),
95+
ProfileEditWidget(
96+
onTap: () {},
97+
title: "Nickname/Tên hiển thị",
98+
value: "Tony Tony Chopper",
99+
),
100+
SizedBox(height: 4.sp),
101+
ProfileEditWidget(
102+
onTap: () {},
103+
title: "ID",
104+
value: "58965874",
105+
style: text11mGB,
106+
),
107+
SizedBox(height: 12.sp),
108+
ProfileEditWidget(
109+
onTap: () {},
110+
title: "Giới thiệu cá nhân",
111+
value:
112+
"Hành trình leo thách đấu mùa 12 cùng top lane!\nhttps://www.facebook.com/chopper189 \n11PM-12PM",
113+
),
114+
SizedBox(height: 12.sp),
115+
Padding(
116+
padding: EdgeInsets.symmetric(horizontal: 16.0.sp),
117+
child: Text(
118+
"Personal Information",
119+
style: TextStyle(
120+
color: Colors.grey.shade700,
121+
fontSize: 9.sp,
122+
),
123+
),
124+
),
125+
SizedBox(height: 12.sp),
126+
ProfileEditWidget(
127+
onTap: () {},
128+
title: "Số điện thoại",
129+
value: user.phoneNumber ?? "Số điện thoại",
130+
style: user.phoneNumber == null ? text11mGM : null,
131+
),
132+
SizedBox(height: 2.sp),
133+
ProfileEditWidget(
134+
onTap: () {
135+
showModalBottomSheet(
136+
context: context,
137+
backgroundColor: Colors.transparent,
138+
builder: (context) => BottomSheetGender(
139+
handleSelectGender: (value) {
140+
if (value != null) {
141+
setState(() {
142+
user.gender = value == "Nam" ? true : false;
143+
});
144+
}
145+
},
146+
),
147+
);
148+
},
149+
title: "Giới tính",
150+
value: user.gender ? "Nam" : "Nữ",
151+
),
152+
SizedBox(height: 2.sp),
153+
ProfileEditWidget(
154+
onTap: () {},
155+
title: "Ngày sinh",
156+
value: (user.birthday ?? "").toString(),
157+
),
158+
],
159+
),
160+
);
161+
}
162+
}

0 commit comments

Comments
 (0)