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.
130 lines
3.9 KiB
130 lines
3.9 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 '../../controller/mine/auth_controller.dart';
|
|
import '../../extension/router_service.dart';
|
|
import 'edit_info_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: AppBar(
|
|
title: Text('认证中心', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
|
centerTitle: true,
|
|
leading: IconButton(
|
|
icon: Icon(Icons.arrow_back_ios, size: 24, color: Colors.grey,),
|
|
onPressed: () {
|
|
Get.back();
|
|
},
|
|
),
|
|
),
|
|
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.all(24),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
// 左侧图片
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(8),
|
|
color: Colors.blue[100],
|
|
image: DecorationImage(
|
|
image: NetworkImage('https://picsum.photos/40/40?random=$item.index'),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
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(0xff26C77C) : Colors.grey[500]
|
|
)
|
|
),
|
|
SizedBox(width: 4),
|
|
item.authed ? SizedBox(width: 24) : Icon(
|
|
Icons.navigate_next, // Material Icons
|
|
// size: 128.0, // 设置图标大小#26C77C
|
|
color: Colors.grey[500]
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
).onTap(() async{
|
|
if(!item.authed){
|
|
if(item.index == 2){
|
|
Get.to(() => EditInfoPage());
|
|
// Get.to(widget.path);
|
|
} else if(item.index == 3){
|
|
final result = await Get.to(() => RealNamePage());
|
|
if(result > 0){
|
|
controller.changeAuth(result);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|