838 lines
36 KiB
Dart
838 lines
36 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:aslan/app_localizations.dart';
|
|
import 'package:aslan/chatvibe_ui/theme/chatvibe_theme.dart';
|
|
import 'package:aslan/chatvibe_core/utilities/at_loading_manager.dart';
|
|
import 'package:aslan/chatvibe_data/sources/local/user_manager.dart';
|
|
import 'package:aslan/chatvibe_data/sources/repositories/user_repository_impl.dart';
|
|
import 'package:aslan/chatvibe_managers/user_profile_manager.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:aslan/chatvibe_ui/components/appbar/chatvibe_appbar.dart';
|
|
import 'package:aslan/chatvibe_ui/components/custom_cached_image.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_compontent.dart';
|
|
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_tts.dart';
|
|
import 'package:aslan/chatvibe_core/constants/at_screen.dart';
|
|
import 'package:aslan/chatvibe_core/routes/at_routes.dart';
|
|
import 'package:aslan/chatvibe_core/routes/at_fluro_navigator.dart';
|
|
import 'package:aslan/chatvibe_core/utilities/at_lk_dialog_util.dart';
|
|
import 'package:aslan/chatvibe_core/utilities/at_pick_utils.dart';
|
|
import 'package:aslan/chatvibe_domain/models/res/login_res.dart';
|
|
import 'package:aslan/chatvibe_managers/app_general_manager.dart';
|
|
import 'package:aslan/chatvibe_managers/rtc_manager.dart';
|
|
import 'package:aslan/chatvibe_ui/widgets/person/draggable_image_grid.dart';
|
|
import 'package:aslan/chatvibe_ui/widgets/person/draggable_image_person_photo_grid.dart';
|
|
import 'package:aslan/chatvibe_features/country/country_route.dart';
|
|
|
|
import '../../../chatvibe_domain/usecases/at_custom_filtering_textinput_formatter.dart';
|
|
|
|
class EditUserInfoPage extends StatefulWidget {
|
|
const EditUserInfoPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_EditUserInfoPageState createState() => _EditUserInfoPageState();
|
|
}
|
|
|
|
class _EditUserInfoPageState extends State<EditUserInfoPage>
|
|
with SingleTickerProviderStateMixin {
|
|
String? userCover;
|
|
bool isEdit = false;
|
|
final TextEditingController _nickNameController = TextEditingController();
|
|
final TextEditingController _bioController = TextEditingController();
|
|
final TextEditingController _hobbyController = TextEditingController();
|
|
String? bornMonth;
|
|
String? bornDay;
|
|
String? bornYear;
|
|
DateTime? birthdayDate;
|
|
num? sex;
|
|
num? age;
|
|
List<PersonPhoto> _uploadPhotoImages = [];
|
|
|
|
List<ImageItem> _backgoundImages = [
|
|
ImageItem('', 0, 0),
|
|
ImageItem('', 1, 0),
|
|
ImageItem('', 2, 0),
|
|
ImageItem('', 3, 0),
|
|
ImageItem('', 4, 0),
|
|
];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
userCover = AccountStorage().getCurrentUser()?.userProfile?.userAvatar ?? "";
|
|
_nickNameController.text =
|
|
AccountStorage().getCurrentUser()?.userProfile?.userNickname ?? "";
|
|
_bioController.text =
|
|
AccountStorage().getCurrentUser()?.userProfile?.autograph ?? "";
|
|
_hobbyController.text =
|
|
AccountStorage().getCurrentUser()?.userProfile?.hobby ?? "";
|
|
AccountStorage().getCurrentUser()?.userProfile?.bornMonth;
|
|
num m = AccountStorage().getCurrentUser()?.userProfile?.bornMonth ?? 0;
|
|
if (m < 10) {
|
|
bornMonth = "0$m";
|
|
} else {
|
|
bornMonth = "$m";
|
|
}
|
|
num d = AccountStorage().getCurrentUser()?.userProfile?.bornDay ?? 0;
|
|
if (d < 10) {
|
|
bornDay = "0$d";
|
|
} else {
|
|
bornDay = "$d";
|
|
}
|
|
bornYear = "${AccountStorage().getCurrentUser()?.userProfile?.bornYear}";
|
|
age =
|
|
DateTime.now().year -
|
|
(AccountStorage().getCurrentUser()?.userProfile?.bornYear ?? 0);
|
|
_nickNameController.addListener(() {
|
|
isEdit = true;
|
|
});
|
|
sex = AccountStorage().getCurrentUser()?.userProfile?.userSex;
|
|
List<PersonPhoto> photoBackgoundImages =
|
|
(AccountStorage().getCurrentUser()?.userProfile?.backgroundPhotos ?? [])
|
|
.where((t) => t.status != 2)
|
|
.toList();
|
|
for (int i = 0; i < photoBackgoundImages.length; i++) {
|
|
var element = photoBackgoundImages[i];
|
|
_backgoundImages[i] = ImageItem(
|
|
element.url ?? "",
|
|
i,
|
|
element.status ?? 0,
|
|
);
|
|
}
|
|
_uploadPhotoImages =
|
|
(AccountStorage().getCurrentUser()?.userProfile?.personalPhotos ?? [])
|
|
.where((t) => t.status != 2)
|
|
.toList();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
Image.asset(
|
|
"atu_images/room/at_icon_room_settig_bg.png",
|
|
width: ScreenUtil().screenWidth,
|
|
height: ScreenUtil().screenHeight,
|
|
fit: BoxFit.fill,
|
|
),
|
|
Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
resizeToAvoidBottomInset: true,
|
|
appBar: ChatVibeStandardAppBar(
|
|
title: ATAppLocalizations.of(context)!.editProfile,
|
|
actions: [
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 5.w),
|
|
margin: EdgeInsets.only(right: 8.w),
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.save,
|
|
textColor: Colors.black45,
|
|
fontSize: 15.sp,
|
|
),
|
|
),
|
|
onTap: () {
|
|
submit(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
body: LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
return SingleChildScrollView(
|
|
padding: EdgeInsets.only(
|
|
bottom: MediaQuery.of(context).viewInsets.bottom + 20.w,
|
|
),
|
|
child: Consumer<ChatVibeUserProfileManager>(
|
|
builder: (context, ref, child) {
|
|
return Container(
|
|
margin: EdgeInsets.symmetric(
|
|
horizontal: 15.w,
|
|
vertical: 25.w,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: 12.w,
|
|
width: 3.w,
|
|
decoration: BoxDecoration(
|
|
color: ChatVibeTheme.primaryColor,
|
|
borderRadius: BorderRadius.circular(2.w),
|
|
),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
text(
|
|
"${ATAppLocalizations.of(context)!.spaceBackground}:",
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 15.sp,
|
|
textColor: Colors.black,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 5.w),
|
|
DraggableImageGrid((List<ImageItem> images) {
|
|
_backgoundImages = images;
|
|
isEdit = true;
|
|
}),
|
|
SizedBox(height: 10.w),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: 12.w,
|
|
width: 3.w,
|
|
decoration: BoxDecoration(
|
|
color: ChatVibeTheme.primaryColor,
|
|
borderRadius: BorderRadius.circular(2.w),
|
|
),
|
|
),
|
|
SizedBox(width: 5.w),
|
|
text(
|
|
"${ATAppLocalizations.of(context)!.information}:",
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 15.sp,
|
|
textColor: Colors.black,
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
GestureDetector(
|
|
child: Stack(
|
|
alignment: AlignmentDirectional.bottomEnd,
|
|
children: [
|
|
head(
|
|
url: userCover ?? "",
|
|
width: 100.w,
|
|
borderRadius: BorderRadius.circular(12.w),
|
|
),
|
|
PositionedDirectional(
|
|
end: 15.w,
|
|
bottom: 12.w,
|
|
child: Image.asset(
|
|
"atu_images/general/at_icon_edit_head_camera_alt.png",
|
|
width: 20.w,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
onTap: () {
|
|
ATPickUtils.pickImageProcess(context, (
|
|
bool success,
|
|
String url,
|
|
) {
|
|
if (success) {
|
|
setState(() {
|
|
userCover = url;
|
|
isEdit = true;
|
|
});
|
|
}
|
|
});
|
|
},
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 10.w),
|
|
text(
|
|
"${ATAppLocalizations.of(context)!.myPhoto}:",
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 15.sp,
|
|
textColor: Colors.black,
|
|
),
|
|
SizedBox(height: 10.w),
|
|
DraggableImagePersonPhotoGrid(
|
|
callback: (List<PersonPhoto> images) {
|
|
_uploadPhotoImages = images;
|
|
isEdit = true;
|
|
},
|
|
),
|
|
SizedBox(height: 15.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.nickName,
|
|
textColor: Colors.black38,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14.sp,
|
|
),
|
|
TextField(
|
|
controller: _nickNameController,
|
|
onChanged: (text) {
|
|
isEdit = true;
|
|
},
|
|
inputFormatters: [
|
|
ATCustomFilteringTextInputFormatter(),
|
|
],
|
|
maxLength: 38,
|
|
decoration: InputDecoration(
|
|
hintStyle: TextStyle(
|
|
color: Colors.black45,
|
|
fontSize: 14.sp,
|
|
),
|
|
contentPadding: EdgeInsets.only(top: 0.w),
|
|
counterText: '',
|
|
isDense: true,
|
|
filled: false,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
border: InputBorder.none,
|
|
enabledBorder: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
disabledBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedErrorBorder: InputBorder.none,
|
|
// enabledBorder: UnderlineInputBorder(
|
|
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
|
|
// focusedBorder: UnderlineInputBorder(
|
|
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
|
|
// prefixIcon: Padding(padding: EdgeInsets.all(8.w), child: Image.asset("images/login/at_icon_phone.png",width: 20.w, height: 20.w,fit: BoxFit.fill,),),
|
|
fillColor: Colors.black45,
|
|
),
|
|
style: TextStyle(
|
|
fontSize: sp(15),
|
|
color: Colors.black,
|
|
textBaseline: TextBaseline.alphabetic,
|
|
),
|
|
),
|
|
Divider(
|
|
color: Colors.black12,
|
|
thickness: 0.5,
|
|
height: 28.w,
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
_showSexDialog();
|
|
},
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
text(
|
|
ATAppLocalizations.of(context)!.gender,
|
|
textColor: Colors.black38,
|
|
fontSize: 14.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
Spacer(),
|
|
],
|
|
),
|
|
SizedBox(height: 5.w),
|
|
xb(sex, color: Colors.black54),
|
|
],
|
|
),
|
|
),
|
|
Divider(
|
|
color: Colors.black12,
|
|
thickness: 0.5,
|
|
height: 28.w,
|
|
),
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () {
|
|
_selectDate();
|
|
},
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
text(
|
|
ATAppLocalizations.of(context)!.dateOfBirth,
|
|
textColor: Colors.black38,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14.sp,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 5.w),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
text(
|
|
"$bornMonth-$bornDay-$bornYear",
|
|
textColor: Colors.black,
|
|
fontSize: 14.sp,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Divider(
|
|
color: Colors.black12,
|
|
thickness: 0.5,
|
|
height: 28.w,
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
CountryRoute.country,
|
|
replace: false,
|
|
);
|
|
},
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Row(
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
text(
|
|
ATAppLocalizations.of(context)!.country,
|
|
textColor: Colors.black38,
|
|
fontSize: 14.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
Consumer<AppGeneralManager>(
|
|
builder: (_, provider, __) {
|
|
return Container(
|
|
padding: EdgeInsets.only(
|
|
right: width(12),
|
|
),
|
|
height: 43.w,
|
|
width: 245.w,
|
|
decoration: BoxDecoration(
|
|
color: Colors.transparent,
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(height(32)),
|
|
),
|
|
),
|
|
child:
|
|
provider.selectCountryInfo != null
|
|
? Row(
|
|
mainAxisSize:
|
|
MainAxisSize.min,
|
|
children: [
|
|
CustomCachedImage(
|
|
imageUrl:
|
|
provider
|
|
.selectCountryInfo!
|
|
.nationalFlag ??
|
|
"",
|
|
width: 26.w,
|
|
height: 16.w,
|
|
),
|
|
SizedBox(width: 5.w),
|
|
text(
|
|
provider
|
|
.selectCountryInfo!
|
|
.aliasName ??
|
|
"",
|
|
textColor: Colors.black,
|
|
fontSize: 14.sp,
|
|
),
|
|
],
|
|
)
|
|
: Row(
|
|
mainAxisSize:
|
|
MainAxisSize.min,
|
|
children: [
|
|
netImage(
|
|
url:
|
|
provider
|
|
.getCountryByName(
|
|
AccountStorage()
|
|
.getCurrentUser()
|
|
?.userProfile
|
|
?.countryName ??
|
|
"",
|
|
)
|
|
?.nationalFlag ??
|
|
"",
|
|
width: 26.w,
|
|
height: 16.w,
|
|
),
|
|
SizedBox(width: 5.w),
|
|
text(
|
|
AccountStorage()
|
|
.getCurrentUser()
|
|
?.userProfile
|
|
?.countryName ??
|
|
"",
|
|
textColor: Colors.black,
|
|
fontSize: 14.sp,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
Icon(
|
|
Icons.arrow_forward_ios,
|
|
size: 14.w,
|
|
color: Colors.grey,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
text(
|
|
ATAppLocalizations.of(context)!.bio,
|
|
textColor: Colors.black38,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14.sp,
|
|
),
|
|
TextField(
|
|
controller: _bioController,
|
|
onChanged: (text) {
|
|
isEdit = true;
|
|
},
|
|
maxLength: 50,
|
|
decoration: InputDecoration(
|
|
hintStyle: TextStyle(
|
|
color: Colors.black45,
|
|
fontSize: 14.sp,
|
|
),
|
|
contentPadding: EdgeInsets.only(top: 0.w),
|
|
counterText: '',
|
|
isDense: true,
|
|
filled: false,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
border: InputBorder.none,
|
|
enabledBorder: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
disabledBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedErrorBorder: InputBorder.none,
|
|
// enabledBorder: UnderlineInputBorder(
|
|
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
|
|
// focusedBorder: UnderlineInputBorder(
|
|
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
|
|
// prefixIcon: Padding(padding: EdgeInsets.all(8.w), child: Image.asset("images/login/at_icon_phone.png",width: 20.w, height: 20.w,fit: BoxFit.fill,),),
|
|
fillColor: Colors.black45,
|
|
),
|
|
style: TextStyle(
|
|
fontSize: sp(15),
|
|
color: Colors.black,
|
|
textBaseline: TextBaseline.alphabetic,
|
|
),
|
|
),
|
|
Divider(
|
|
color: Colors.black12,
|
|
thickness: 0.5,
|
|
height: 28.w,
|
|
),
|
|
|
|
text(
|
|
ATAppLocalizations.of(context)!.hobby,
|
|
textColor: Colors.black38,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14.sp,
|
|
),
|
|
TextField(
|
|
controller: _hobbyController,
|
|
onChanged: (text) {
|
|
isEdit = true;
|
|
},
|
|
maxLength: 50,
|
|
decoration: InputDecoration(
|
|
hintStyle: TextStyle(
|
|
color: Colors.black45,
|
|
fontSize: 14.sp,
|
|
),
|
|
contentPadding: EdgeInsets.only(top: 0.w),
|
|
counterText: '',
|
|
isDense: true,
|
|
filled: false,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
border: InputBorder.none,
|
|
enabledBorder: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
disabledBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedErrorBorder: InputBorder.none,
|
|
// enabledBorder: UnderlineInputBorder(
|
|
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
|
|
// focusedBorder: UnderlineInputBorder(
|
|
// borderSide: BorderSide(width: 0.5,color: Colors.white,style: BorderStyle.solid),),
|
|
// prefixIcon: Padding(padding: EdgeInsets.all(8.w), child: Image.asset("images/login/at_icon_phone.png",width: 20.w, height: 20.w,fit: BoxFit.fill,),),
|
|
fillColor: Colors.black45,
|
|
),
|
|
style: TextStyle(
|
|
fontSize: sp(15),
|
|
color: Colors.black,
|
|
textBaseline: TextBaseline.alphabetic,
|
|
),
|
|
),
|
|
Divider(
|
|
color: Colors.black12,
|
|
thickness: 0.5,
|
|
height: 28.w,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Future<void> _selectDate() async {
|
|
showCupertinoModalPopup(
|
|
context: context,
|
|
builder:
|
|
(context) => SafeArea(
|
|
top: false,
|
|
child: Container(
|
|
height: 240.w,
|
|
padding: EdgeInsets.only(top: 6),
|
|
color: CupertinoColors.systemBackground,
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: 10.w),
|
|
Row(
|
|
children: [
|
|
SizedBox(width: 10.w),
|
|
GestureDetector(
|
|
child: Container(
|
|
alignment: Alignment.topCenter,
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.cancel,
|
|
textColor: Colors.black87,
|
|
fontSize: 15.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
onTap: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.topCenter,
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.birthday,
|
|
textColor: Colors.black87,
|
|
fontSize: 15.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
child: Container(
|
|
alignment: Alignment.topCenter,
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.confirm,
|
|
textColor: Color(0xff7726FF),
|
|
fontSize: 15.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
onTap: () {
|
|
num m = birthdayDate!.month;
|
|
if (m < 10) {
|
|
bornMonth = "0$m";
|
|
} else {
|
|
bornMonth = "$m";
|
|
}
|
|
num d = birthdayDate!.day;
|
|
if (d < 10) {
|
|
bornDay = "0$d";
|
|
} else {
|
|
bornDay = "$d";
|
|
}
|
|
bornYear = "${birthdayDate?.year}";
|
|
setState(() {});
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
SizedBox(width: 10.w),
|
|
],
|
|
),
|
|
Expanded(
|
|
child: CupertinoDatePicker(
|
|
mode: CupertinoDatePickerMode.date,
|
|
initialDateTime: _getBefor18(),
|
|
maximumDate: _getBefor18(),
|
|
onDateTimeChanged: (date) {
|
|
isEdit = true;
|
|
birthdayDate = date;
|
|
age = DateTime.now().year - date.year;
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
DateTime _getBefor18() {
|
|
DateTime currentDate = DateTime.now();
|
|
DateTime eighteenYearsAgo = DateTime(
|
|
currentDate.year - 18,
|
|
currentDate.month,
|
|
currentDate.day,
|
|
currentDate.hour,
|
|
currentDate.minute,
|
|
currentDate.second,
|
|
currentDate.millisecond,
|
|
currentDate.microsecond,
|
|
);
|
|
return eighteenYearsAgo;
|
|
}
|
|
|
|
int sTime = 0;
|
|
|
|
void submit(BuildContext context) async {
|
|
if (_nickNameController.text.isEmpty) {
|
|
ATTts.show(ATAppLocalizations.of(context)!.pleaseEnterNickname);
|
|
return;
|
|
}
|
|
if (Provider.of<AppGeneralManager>(
|
|
context,
|
|
listen: false,
|
|
).selectCountryInfo !=
|
|
null) {
|
|
isEdit = true;
|
|
}
|
|
List<String> backgroundPhotos = [];
|
|
for (var value in _backgoundImages) {
|
|
if (value.path.isNotEmpty) {
|
|
backgroundPhotos.add(value.path);
|
|
}
|
|
}
|
|
List<String> personPhotos = [];
|
|
for (var value in _uploadPhotoImages) {
|
|
if ((value.url?.isNotEmpty ?? false)) {
|
|
personPhotos.add(value.url ?? "");
|
|
}
|
|
}
|
|
int bTime = DateTime.now().millisecondsSinceEpoch;
|
|
if (bTime - sTime > 5000) {
|
|
sTime = bTime;
|
|
if (isEdit) {
|
|
ATLoadingManager.exhibitOperation();
|
|
try {
|
|
await AccountRepository().updateUserInfo(
|
|
userAvatar: userCover,
|
|
userSex: sex,
|
|
userNickname: _nickNameController.text,
|
|
age: age,
|
|
bornDay: birthdayDate?.day,
|
|
bornMonth: birthdayDate?.month,
|
|
bornYear: birthdayDate?.year,
|
|
hobby: _hobbyController.text,
|
|
autograph: _bioController.text,
|
|
countryId:
|
|
Provider.of<AppGeneralManager>(
|
|
context,
|
|
listen: false,
|
|
).selectCountryInfo?.id,
|
|
backgroundPhotos: backgroundPhotos,
|
|
personalPhotos: personPhotos,
|
|
);
|
|
Provider.of<RtcProvider>(context, listen: false).needUpDataUserInfo =
|
|
true;
|
|
} catch (e) {
|
|
debugPrint(e.toString());
|
|
ATLoadingManager.veilRoutine();
|
|
}
|
|
Provider.of<ChatVibeUserProfileManager>(context, listen: false).getMyUserInfo();
|
|
ATLoadingManager.veilRoutine();
|
|
}
|
|
ATNavigatorUtils.popUntil(context, ModalRoute.withName(ATRoutes.home));
|
|
}
|
|
}
|
|
|
|
void _showSexDialog() {
|
|
showCenterDialog(
|
|
context,
|
|
Container(
|
|
height: 150.w,
|
|
width: ScreenUtil().screenWidth * 0.7,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SizedBox(height: 15.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.pleaseSelectYourGender,
|
|
fontSize: 15.sp,
|
|
textColor: Colors.black,
|
|
),
|
|
SizedBox(height: 5.w),
|
|
Divider(color: Colors.black12, thickness: 0.5, height: 14.w),
|
|
SizedBox(height: 8.w),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (sex != 1) {
|
|
isEdit = true;
|
|
}
|
|
sex = 1;
|
|
setState(() {});
|
|
ATNavigatorUtils.goBack(context);
|
|
},
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
xb(1, color: Colors.black54, height: 18.w),
|
|
SizedBox(width: 5.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.man,
|
|
textColor: Colors.black,
|
|
fontSize: 15.sp,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 8.w),
|
|
Divider(color: Colors.black12, thickness: 0.5, height: 14.w),
|
|
SizedBox(height: 8.w),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (sex != 0) {
|
|
isEdit = true;
|
|
}
|
|
sex = 0;
|
|
setState(() {});
|
|
ATNavigatorUtils.goBack(context);
|
|
},
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
xb(0, color: Colors.black54, height: 18.w),
|
|
SizedBox(width: 5.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.woman,
|
|
textColor: Colors.black,
|
|
fontSize: 15.sp,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|