完成集成新的登录接口的更换使用 完成集成用户的场站列表接口 完成开发设计选择场站项为全局属性 完成我的页面的个人信息的集成和详情页面的开发 完成设备页面的中无人机机场的列表接口对接入和个项页面的布局的优化 完成设备页面的中无人机机场的详情接口的对接和使用和页面的更新布局
118 lines
3.0 KiB
Dart
118 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:maibu_satabot_v2/features/v2/my/presentation/constants/my_constants.dart';
|
||
|
||
/// 用户信息卡片组件(100% 还原设计稿)
|
||
class UserProfileCard extends StatelessWidget {
|
||
const UserProfileCard({
|
||
super.key,
|
||
required this.name,
|
||
required this.role,
|
||
this.avatar,
|
||
this.onTap,
|
||
});
|
||
|
||
final String name;
|
||
final String role;
|
||
final String? avatar;
|
||
final VoidCallback? onTap;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return InkWell(
|
||
onTap: onTap,
|
||
child: Container(
|
||
width: double.infinity,
|
||
padding: const EdgeInsets.fromLTRB(20, 70, 20, 50),
|
||
decoration: const BoxDecoration(
|
||
gradient: LinearGradient(
|
||
begin: Alignment.topLeft,
|
||
end: Alignment.bottomRight,
|
||
colors: [
|
||
Color(0xFF165DFF),
|
||
Color(0xFF0E42CC),
|
||
],
|
||
),
|
||
),
|
||
child: Row(
|
||
children: [
|
||
// 头像
|
||
Container(
|
||
width: 56,
|
||
height: 56,
|
||
decoration: BoxDecoration(
|
||
shape: BoxShape.circle,
|
||
border: Border.all(
|
||
color: Colors.white,
|
||
width: 2,
|
||
),
|
||
),
|
||
child: ClipOval(
|
||
child: _buildAvatar(),
|
||
),
|
||
),
|
||
const SizedBox(width: 14),
|
||
// 用户信息
|
||
Expanded(
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text(
|
||
name,
|
||
style: const TextStyle(
|
||
fontSize: 18,
|
||
fontWeight: FontWeight.bold,
|
||
color: Colors.white,
|
||
letterSpacing: 0.5,
|
||
),
|
||
),
|
||
const SizedBox(height: 6),
|
||
Text(
|
||
role,
|
||
style: TextStyle(
|
||
fontSize: 13,
|
||
color: Colors.white.withOpacity(0.85),
|
||
letterSpacing: 0.3,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
// 箭头
|
||
Icon(
|
||
Icons.chevron_right,
|
||
color: Colors.white.withOpacity(0.9),
|
||
size: 24,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
Widget _buildAvatar() {
|
||
// 如果有头像 URL,显示网络图片
|
||
if (avatar != null && avatar!.isNotEmpty) {
|
||
return Image.network(
|
||
avatar!,
|
||
fit: BoxFit.cover,
|
||
errorBuilder: (context, error, stackTrace) {
|
||
return _buildDefaultAvatar();
|
||
},
|
||
);
|
||
}
|
||
// 否则显示默认头像
|
||
return _buildDefaultAvatar();
|
||
}
|
||
|
||
Widget _buildDefaultAvatar() {
|
||
return Container(
|
||
color: Colors.white,
|
||
child: Icon(
|
||
Icons.person,
|
||
size: 32,
|
||
color: const Color(0xFF165DFF),
|
||
),
|
||
);
|
||
}
|
||
}
|