5 changed files with 100 additions and 7 deletions
@ -0,0 +1,10 @@ |
|||
import 'package:get/get.dart'; |
|||
import '../../../data/models/user_Info.dart'; |
|||
|
|||
class AiChatStatsController extends GetxController { |
|||
final isLoading = false.obs; |
|||
|
|||
int get currentIntegral => User.instance.aichatintegral; |
|||
int get totalIntegral => User.instance.aichattotalintegral; |
|||
} |
|||
|
|||
@ -0,0 +1,74 @@ |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|||
import 'package:get/get.dart'; |
|||
import '../../../core/theme/app_colors.dart'; |
|||
import '../controllers/aichat_stats_controller.dart'; |
|||
import '../../../data/models/user_Info.dart'; |
|||
|
|||
class AiChatStatsView extends GetView<AiChatStatsController> { |
|||
const AiChatStatsView({Key? key}) : super(key: key); |
|||
|
|||
@override |
|||
Widget build(BuildContext context) { |
|||
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|||
|
|||
return Scaffold( |
|||
backgroundColor: isDarkMode ? AppColors.darkBackground : Colors.grey[50], |
|||
appBar: _buildAppBar(isDarkMode), |
|||
body: _buildBody(isDarkMode), |
|||
); |
|||
} |
|||
|
|||
PreferredSizeWidget _buildAppBar(bool isDarkMode) { |
|||
return AppBar( |
|||
leading: IconButton( |
|||
icon: Icon(Icons.arrow_back_ios, color: isDarkMode ? Colors.white : Colors.black, size: 20.sp), |
|||
onPressed: () => Get.back(), |
|||
), |
|||
backgroundColor: isDarkMode ? AppColors.darkBackground : Colors.white, |
|||
elevation: 0.5, |
|||
title: Text( |
|||
'AI聊天', |
|||
style: TextStyle(fontSize: 17.sp, fontWeight: FontWeight.w600, color: isDarkMode ? Colors.white : Colors.black), |
|||
), |
|||
centerTitle: true, |
|||
); |
|||
} |
|||
|
|||
Widget _buildBody(bool isDarkMode) { |
|||
return Obx(() { |
|||
final _ = User.refreshTick.value; |
|||
final u = User.instance; |
|||
return Padding( |
|||
padding: EdgeInsets.all(16.w), |
|||
child: Container( |
|||
padding: EdgeInsets.all(16.w), |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? AppColors.cardBackground : Colors.white, |
|||
borderRadius: BorderRadius.circular(12.r), |
|||
boxShadow: [ |
|||
BoxShadow(color: Colors.black.withValues(alpha: 0.05), blurRadius: 10, offset: const Offset(0, 2)), |
|||
], |
|||
), |
|||
child: Row( |
|||
children: [ |
|||
Icon(Icons.chat_bubble_outline, color: AppColors.primary, size: 20.sp), |
|||
SizedBox(width: 8.w), |
|||
Expanded( |
|||
child: Text( |
|||
'AI聊天积分', |
|||
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600, color: isDarkMode ? Colors.white : Colors.black), |
|||
), |
|||
), |
|||
Text( |
|||
'${u.aichatintegral}/${u.aichattotalintegral}', |
|||
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600, color: isDarkMode ? Colors.white : Colors.black), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue