Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import '../../../shared/ui/colors.dart';
import '../../../shared/utils/string_utils.dart';
import '../../../shared/widget/loaders.dart';
import '../../../shared/widget/typing_indicator.dart';
import '../../group_info/view/group_info_page.dart';
import '../bloc/ai_message/ai_message_bloc.dart';
import '../bloc/conversation_bloc.dart';
import '../bloc/delete_messages/delete_messages_bloc.dart';
Expand Down Expand Up @@ -290,10 +291,17 @@ Future<void> _infoAction(BuildContext context) async {
if (state.conversation.type == 'u') {
context.push(userInfoPath, extra: state.conversation.opponent);
} else {
bool conversationUpdated =
await context.push(groupInfoPath, extra: state.conversation) as bool;
if (conversationUpdated && context.mounted) {
context.read<ConversationBloc>().add(const ParticipantsReceived());
}
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GroupInfoPage.route(state.conversation,
onResult: (conversationUpdated) {
if (conversationUpdated && context.mounted) {
context
.read<ConversationBloc>()
.add(const ParticipantsReceived());
}
})),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@ import '../../../shared/ui/colors.dart';
import '../bloc/group_info_bloc.dart';
import 'group_info_form.dart';

typedef GroupInfoPageCallback = void Function(bool result);

class GroupInfoPage extends StatelessWidget {
final ConversationModel conversation;
final GroupInfoPageCallback? onResult;

const GroupInfoPage({required this.conversation, super.key});
const GroupInfoPage({required this.conversation, this.onResult, super.key});

static BlocProvider route(Object? extra) {
static BlocProvider route(Object? extra, {GroupInfoPageCallback? onResult}) {
ConversationModel conversation = extra as ConversationModel;

return BlocProvider<GroupInfoBloc>(
create: (context) => GroupInfoBloc(
RepositoryProvider.of<ConversationRepository>(context),
RepositoryProvider.of<UserRepository>(context),
conversation: conversation),
child: GroupInfoPage(conversation: conversation),
child: GroupInfoPage(conversation: conversation, onResult: onResult),
);
}

Expand All @@ -32,15 +35,17 @@ class GroupInfoPage extends StatelessWidget {
return BlocBuilder<GroupInfoBloc, GroupInfoState>(
builder: (context, state) {
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) {
onResult?.call(state.status.isSuccess);
},
child: Scaffold(
backgroundColor: black,
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: black,
leading: IconButton(
icon: const Icon(Icons.arrow_back_outlined, color: white),
onPressed: () => context.pop(state.status.isSuccess),
onPressed: () => context.pop(),
),
title: Text(
state.name.value,
Expand Down