2024-03-18 13:23:58 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
|
|
|
import 'package:sk_base_mobile/widgets/my_avatar.dart';
|
|
|
|
|
|
|
|
import 'userinfo.controller.dart';
|
|
|
|
|
|
|
|
class UserInfoPage extends StatelessWidget {
|
|
|
|
final _controller = Get.put<UserInfoController>(UserInfoController());
|
|
|
|
UserInfoPage({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SafeArea(
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
appBar: AppBar(
|
|
|
|
elevation: 0,
|
|
|
|
actions: [
|
|
|
|
TextButton(
|
|
|
|
onPressed: () {
|
|
|
|
_controller.saveUserInfo();
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
'Save',
|
|
|
|
style: TextStyle(
|
|
|
|
color: const Color(0xFFB0F320),
|
2024-03-28 17:18:46 +08:00
|
|
|
fontSize: ScreenAdaper.height(18)),
|
2024-03-18 13:23:58 +08:00
|
|
|
)),
|
|
|
|
SizedBox(
|
|
|
|
width: ScreenAdaper.width(5),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
backgroundColor: Colors.transparent),
|
|
|
|
body: _buildBody(),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _buildBody() {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
height: ScreenAdaper.height(50),
|
|
|
|
),
|
|
|
|
Center(
|
|
|
|
child: MyAvatarWidget(),
|
|
|
|
),
|
|
|
|
TextFormField(
|
|
|
|
controller: _controller.nickNameController,
|
|
|
|
cursorColor: const Color.fromARGB(255, 87, 86, 86),
|
2024-03-28 17:18:46 +08:00
|
|
|
style:
|
|
|
|
TextStyle(fontSize: ScreenAdaper.height(18), color: Colors.black),
|
2024-03-18 13:23:58 +08:00
|
|
|
decoration: InputDecoration(
|
|
|
|
contentPadding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenAdaper.width(12), 0, ScreenAdaper.width(12), 0),
|
|
|
|
labelText: "Nick Name",
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: const Color.fromARGB(255, 136, 136, 136),
|
2024-03-28 17:18:46 +08:00
|
|
|
fontSize: ScreenAdaper.height(18)),
|
2024-03-18 13:23:58 +08:00
|
|
|
enabledBorder: const UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Color.fromARGB(153, 191, 190, 190),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
focusedBorder: const UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Color.fromARGB(153, 191, 190, 190),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: ScreenAdaper.height(15),
|
|
|
|
),
|
2024-03-19 08:59:08 +08:00
|
|
|
// TextFormField(
|
|
|
|
// controller: _controller.birthdayController,
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
// contentPadding: EdgeInsets.fromLTRB(
|
|
|
|
// ScreenAdaper.width(12), 0, ScreenAdaper.width(12), 0),
|
|
|
|
// labelText: "Date of birth",
|
|
|
|
// labelStyle: TextStyle(
|
|
|
|
// color: const Color.fromARGB(255, 136, 136, 136),
|
2024-03-28 17:18:46 +08:00
|
|
|
// fontSize: ScreenAdaper.height(18)),
|
2024-03-19 08:59:08 +08:00
|
|
|
// enabledBorder: const UnderlineInputBorder(
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// color: Color.fromARGB(153, 191, 190, 190),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// focusedBorder: const UnderlineInputBorder(
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// color: Color.fromARGB(153, 191, 190, 190),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// onTap: () async {
|
|
|
|
// await showCupertinoModalPopup(
|
|
|
|
// context: Get.context!,
|
|
|
|
// builder: (context) => Container(
|
|
|
|
// color: Colors.white,
|
|
|
|
// height: 300,
|
|
|
|
// child: CupertinoDatePicker(
|
|
|
|
// initialDateTime: DateTime.parse(
|
|
|
|
// _controller.birthdayController.text),
|
|
|
|
// minimumDate: DateTime(1900),
|
|
|
|
// maximumDate: DateTime.now()
|
|
|
|
// .subtract(const Duration(days: 18 * 365)),
|
|
|
|
// minimumYear: DateTime(1900).year,
|
|
|
|
// maximumYear: DateTime.now()
|
|
|
|
// .subtract(const Duration(days: 18 * 365))
|
|
|
|
// .year,
|
|
|
|
// mode: CupertinoDatePickerMode.date,
|
|
|
|
// onDateTimeChanged: (pickeddate) {
|
|
|
|
// _controller.birthdayController.text =
|
|
|
|
// formatDate(pickeddate, [
|
|
|
|
// yyyy,
|
|
|
|
// '-',
|
|
|
|
// mm,
|
|
|
|
// '-',
|
|
|
|
// dd,
|
|
|
|
// ]);
|
|
|
|
// }),
|
|
|
|
// ));
|
|
|
|
// },
|
|
|
|
// style:
|
2024-03-28 17:18:46 +08:00
|
|
|
// TextStyle(fontSize: ScreenAdaper.height(18), color: Colors.black),
|
2024-03-19 08:59:08 +08:00
|
|
|
// cursorColor: const Color.fromARGB(255, 87, 86, 86)),
|
2024-03-18 13:23:58 +08:00
|
|
|
SizedBox(
|
|
|
|
height: ScreenAdaper.height(15),
|
|
|
|
),
|
2024-03-19 08:59:08 +08:00
|
|
|
// TextFormField(
|
|
|
|
// controller: _controller.countryController,
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
// contentPadding: EdgeInsets.fromLTRB(
|
|
|
|
// ScreenAdaper.width(12), 0, ScreenAdaper.width(12), 0),
|
|
|
|
// labelText: "Country",
|
|
|
|
// labelStyle: TextStyle(
|
|
|
|
// color: const Color.fromARGB(255, 136, 136, 136),
|
2024-03-28 17:18:46 +08:00
|
|
|
// fontSize: ScreenAdaper.height(18)),
|
2024-03-19 08:59:08 +08:00
|
|
|
// enabledBorder: const UnderlineInputBorder(
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// color: Color.fromARGB(153, 191, 190, 190),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// focusedBorder: const UnderlineInputBorder(
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// color: Color.fromARGB(153, 191, 190, 190),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// onTap: () async {
|
|
|
|
// await showCupertinoModalPopup(
|
|
|
|
// context: Get.context!,
|
|
|
|
// builder: (context) => Container(
|
|
|
|
// color: Colors.white,
|
|
|
|
// height: 300,
|
|
|
|
// child: CupertinoPicker(
|
|
|
|
// itemExtent: 50,
|
|
|
|
// onSelectedItemChanged: (index) {
|
|
|
|
// _controller.countryController.text =
|
|
|
|
// Data.countryCodes[index];
|
|
|
|
// },
|
|
|
|
// children: Data.countryCodes
|
|
|
|
// .map((e) => Container(
|
|
|
|
// height: ScreenAdaper.height(50),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// child: Text(
|
|
|
|
// e,
|
|
|
|
// style: TextStyle(
|
2024-03-28 17:18:46 +08:00
|
|
|
// fontSize: ScreenAdaper.height(30)),
|
2024-03-19 08:59:08 +08:00
|
|
|
// ),
|
|
|
|
// ))
|
|
|
|
// .toList(),
|
|
|
|
// )));
|
|
|
|
// },
|
|
|
|
// style:
|
2024-03-28 17:18:46 +08:00
|
|
|
// TextStyle(fontSize: ScreenAdaper.height(18), color: Colors.black),
|
2024-03-19 08:59:08 +08:00
|
|
|
// cursorColor: const Color.fromARGB(255, 87, 86, 86))
|
2024-03-18 13:23:58 +08:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|