|
| 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