我的界面 修改昵称完成
This commit is contained in:
@@ -3,6 +3,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/core/di/injection.dart';
|
||||
import 'package:maibu_satabot_v2/features/my/presentation/bloc/my_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/features/my/repository/my_repository.dart';
|
||||
import 'package:maibu_satabot_v2/features/my/usecases/updatename_usecase.dart';
|
||||
import '../../../../core/router/route_paths.dart';
|
||||
import '../../../../core/storage/user_storage.dart';
|
||||
import '../../../auth/presentation/bloc/auth_cubit.dart';
|
||||
@@ -24,7 +28,7 @@ class MyPage extends StatelessWidget {
|
||||
|
||||
if (authState is AuthAuthenticated) {
|
||||
final user = authState.user;
|
||||
userName = user.username ?? '未知用户';
|
||||
userName = user.nickname ?? '未知用户';
|
||||
userId = user.userId ?? '未知ID';
|
||||
}
|
||||
|
||||
@@ -36,7 +40,10 @@ class MyPage extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 顶部用户信息
|
||||
UserInfoCard(userName: userName, userId: userId),
|
||||
BlocProvider(
|
||||
create: (context) => MyCubit(sl<MyRepository>(), sl<UpdateNameUsecase>()),
|
||||
child: UserInfoCard(userName: userName, userId: userId),
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
@@ -63,24 +70,14 @@ class MyPage extends StatelessWidget {
|
||||
// 添加 context 参数
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WebViewPage(url: 'https://www.satabot.com/'),
|
||||
),
|
||||
);
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => WebViewPage(url: 'https://www.satabot.com/')));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 160,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
'https://c.53326.com/d/file/lan20221010/fyhj0ibovbp.jpg',
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
image: DecorationImage(image: NetworkImage('https://c.53326.com/d/file/lan20221010/fyhj0ibovbp.jpg'), fit: BoxFit.cover),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
@@ -89,23 +86,14 @@ class MyPage extends StatelessWidget {
|
||||
right: 12,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
'了解我们',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14),
|
||||
),
|
||||
decoration: BoxDecoration(color: Colors.black.withOpacity(0.5), borderRadius: BorderRadius.circular(4)),
|
||||
child: Text('了解我们', style: TextStyle(color: Colors.white, fontSize: 14)),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 12,
|
||||
bottom: 12,
|
||||
child: Text(
|
||||
'AI赋能农业',
|
||||
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||
),
|
||||
child: Text('AI赋能农业', style: TextStyle(color: Colors.white, fontSize: 16)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -115,35 +103,17 @@ class MyPage extends StatelessWidget {
|
||||
|
||||
Widget _buildFunctionList(BuildContext context) {
|
||||
final items = [
|
||||
{
|
||||
'icon': Icons.play_arrow,
|
||||
'title': '操作视频',
|
||||
'url': 'https://www.satabot.com/Support/index.html',
|
||||
},
|
||||
{
|
||||
'icon': Icons.car_rental,
|
||||
'title': '租赁服务',
|
||||
'url': 'https://www.satabot.com/Leasing.html',
|
||||
},
|
||||
{
|
||||
'icon': Icons.help_outline,
|
||||
'title': '帮助与支持',
|
||||
'url': 'https://www.satabot.com/support/index.html',
|
||||
},
|
||||
{
|
||||
'icon': Icons.policy,
|
||||
'title': '售后政策',
|
||||
'url': 'https://www.satabot.com/Aftersales-Service.html',
|
||||
},
|
||||
{'icon': Icons.play_arrow, 'title': '操作视频', 'url': 'https://www.satabot.com/Support/index.html'},
|
||||
{'icon': Icons.car_rental, 'title': '租赁服务', 'url': 'https://www.satabot.com/Leasing.html'},
|
||||
{'icon': Icons.help_outline, 'title': '帮助与支持', 'url': 'https://www.satabot.com/support/index.html'},
|
||||
{'icon': Icons.policy, 'title': '售后政策', 'url': 'https://www.satabot.com/Aftersales-Service.html'},
|
||||
];
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(color: Colors.grey.withOpacity(0.1), blurRadius: 4),
|
||||
],
|
||||
boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.1), blurRadius: 4)],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -159,13 +129,7 @@ class MyPage extends StatelessWidget {
|
||||
title: Text(item['title'] as String),
|
||||
trailing: Icon(Icons.arrow_forward),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
WebViewPage(url: item['url'] as String),
|
||||
),
|
||||
);
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => WebViewPage(url: item['url'] as String)));
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user