You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
3.7 KiB
122 lines
3.7 KiB
import 'package:dating_touchme_app/extension/ex_widget.dart';
|
|
import 'package:dating_touchme_app/pages/mine/real_name_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../components/page_appbar.dart';
|
|
import '../../controller/mine/auth_controller.dart';
|
|
import '../../extension/router_service.dart';
|
|
import '../../generated/assets.dart';
|
|
import 'edit_info_page.dart';
|
|
import 'phone_page.dart';
|
|
|
|
class AuthCenterPage extends StatelessWidget {
|
|
AuthCenterPage({super.key});
|
|
final AuthController controller = Get.put(AuthController());
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Color(0xffF5F5F5),
|
|
appBar: PageAppbar(title: "认证中心"),
|
|
body: Obx(() {
|
|
if (controller.isLoading.value) {
|
|
return const Center(child: CupertinoActivityIndicator(radius: 12,));
|
|
}
|
|
return ListView.builder(
|
|
padding: const EdgeInsets.only(top: 16, right: 16, left: 16),
|
|
itemCount: controller.dataList.length,
|
|
itemBuilder: (context, index) {
|
|
final record = controller.dataList[index];
|
|
return _buildListItem(record);
|
|
},
|
|
);
|
|
})
|
|
);
|
|
}
|
|
|
|
// 构建列表项
|
|
Widget _buildListItem(AuthCard item) {
|
|
return Container(
|
|
margin: EdgeInsets.only(bottom: 12),
|
|
padding: EdgeInsets.only(left: 16, top: 24, bottom: 24, right: 12),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
// 左侧图片
|
|
Container(
|
|
width: 72,
|
|
height: 72,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(72),
|
|
color: Color(0xFFF7F7F7),
|
|
),
|
|
child: Center(
|
|
child: Image.asset(
|
|
item.authed ? item.activeIcon : item.defaultIcon,
|
|
width: item.width,
|
|
height: item.height,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 12),
|
|
// 右侧内容
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
item.title,
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.grey[800],
|
|
),
|
|
),
|
|
SizedBox(height: 2),
|
|
Text(
|
|
item.desc,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.grey[600],
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
item.authed ? '已认证' : '去认证',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: item.authed ? Color(0xFF7562F9) : Colors.grey[500]
|
|
)
|
|
),
|
|
Icon(Icons.navigate_next, color: Colors.grey[400]),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
).onTap(() async{
|
|
if(item.index == 1) {
|
|
await Get.to(() => PhonePage());
|
|
} else if(item.index == 2){
|
|
await Get.to(() => EditInfoPage());
|
|
} else if(item.index == 3){
|
|
if(item.authed){
|
|
return;
|
|
}
|
|
await Get.to(() => RealNamePage());
|
|
}
|
|
controller.loadInitialData();
|
|
});
|
|
}
|
|
|
|
}
|