初始化

This commit is contained in:
谢宇宁
2026-09-15 15:44:13 +07:00
commit a23ba685e9
1065 changed files with 101122 additions and 0 deletions
@@ -0,0 +1,147 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgdj/tools_base/toast.dart';
import 'package:hgdj/hj_utils/screen.dart';
import 'package:hgdj/tools_base/debug_log.dart';
import 'package:hgdj/tools_base/global_store/store.dart';
import 'package:hgdj/tools_base/loading/loading_alert_widget.dart';
import '../../../../alert/mine/vip_level_dialog.dart';
import '../../../../assets_tool/app_colors.dart';
import '../../../../hj_utils/api_service/group_service.dart';
import '../../../../tools_base/widget/header_widget.dart';
import '../alert/group_buy_bottom_sheet.dart';
import '../detail/soul_group_detail_page.dart';
import '../model/im_group_list_model.dart';
import 'package:hgdj/extension/extensions.dart';
class ChatGroupCell extends StatefulWidget {
final IMGroupItemModel model;
ChatGroupCell(this.model, {super.key});
@override
State<StatefulWidget> createState() {
return _ChatGroupCellState();
}
}
class _ChatGroupCellState extends State<ChatGroupCell> {
IMGroupItemModel get model => widget.model;
void _addGroupEvent() async {
if (!globalStore.isVIPTopLevel) {
showVipLevelDialog('本内容需要开通至尊VIP会员\n\n开通会员 即可畅享高级群聊特权');
return;
}
try {
LoadingAlertWidget.show();
final retResp = await GroupService.getHasJoin(model.groupId);
LoadingAlertWidget.cancel();
if (retResp.isSuccess) {
int status = retResp.data['status']; // 0-已被禁言 1-可发言 2-未加入
if (status == 0) {
showToast("您已被禁言");
} else if (status == 1) {
Get.to(GroupChatDetailPage(model));
} else if (status == 2) {
var ret = await Get.bottomSheet(
GroupBuyBottomSheet(groupModel: widget.model));
if (ret == true) {
Get.to(GroupChatDetailPage(model));
}
} else {
showToast("群未知状态");
}
}
} catch (e) {
LoadingAlertWidget.cancel();
showToast("网络数据异常");
debugLog(e);
}
}
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 16, right: 16, bottom: 12),
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: .05),
borderRadius: BorderRadius.circular(6),
),
child: InkWell(
enableFeedback: false,
onTap: _addGroupEvent,
child: Row(
children: [
HeaderWidget(
headPath: model.cover ?? '',
level: 1,
headWidth: 64,
headHeight: 64,
isCircle: false,
radius: 32,
),
12.sizeBoxW,
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
model.name ?? '',
style: TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w500),
),
2.sizeBoxH,
Text(
model.summary ?? '',
maxLines: 1,
style: TextStyle(
color: Colors.white.withValues(alpha: 0.55),
fontSize: 12,
),
),
6.sizeBoxH,
Row(
children: [
Text(
'ID: ${model.groupId ?? 0} ${model.fakeMemberNum.countStr}人在玩',
style: TextStyle(
color: Colors.white.withValues(alpha: 0.55),
fontSize: 12,
),
),
Spacer(),
GestureDetector(
onTap: _addGroupEvent,
child: Container(
width: 52,
height: 24,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: AppColors.actionRed),
child: Text(
'加入群聊',
style: TextStyle(
color: Colors.white,
fontSize: 10,
),
),
),
),
],
),
],
),
),
],
),
),
);
}
}