import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:together_mobile/database/box_type.dart'; import 'package:together_mobile/models/contact_model.dart'; import 'package:together_mobile/models/init_get_it.dart'; class GroupChatTile extends StatelessWidget { const GroupChatTile({ super.key, required this.groupChatId, }); final String groupChatId; @override Widget build(BuildContext context) { return InkWell( onTap: () async { await Hive.openBox('message_$groupChatId'); // ignore: use_build_context_synchronously context.goNamed( 'Message', queryParameters: {'groupChatId': groupChatId, 'type': '1'}, ); }, child: Padding( padding: const EdgeInsets.symmetric(vertical: 10.0), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ const SizedBox( width: 10.0, ), const CircleAvatar( backgroundImage: AssetImage('assets/images/user_3.png'), ), const SizedBox( width: 10.0, ), Text( getIt.get().groupChats[groupChatId]!.nameRemark.isEmpty ? getIt().groupChats[groupChatId]!.name : getIt.get().groupChats[groupChatId]!.nameRemark, overflow: TextOverflow.ellipsis, style: const TextStyle(fontSize: 17), ), const SizedBox( width: 10.0, ), ], ), ), ); } }