chore: add feedback response dialog (#4992)
This commit is contained in:
parent
a537976703
commit
1ac9afe141
3 changed files with 31 additions and 29 deletions
|
|
@ -10,12 +10,12 @@ import 'package:fluffychat/pangea/activity_feedback/activity_feedback_repo.dart'
|
|||
import 'package:fluffychat/pangea/activity_feedback/activity_feedback_request.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_role_model.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_session_start/activity_feedback_response_dialog.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_session_start/activity_session_start_page.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_summary_widget.dart';
|
||||
import 'package:fluffychat/pangea/chat_settings/utils/room_summary_extension.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/error_indicator.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/feedback_dialog.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/feedback_response_dialog.dart';
|
||||
import 'package:fluffychat/pangea/course_chats/open_roles_indicator.dart';
|
||||
import 'package:fluffychat/pangea/course_plans/course_activities/activity_summaries_provider.dart';
|
||||
import 'package:fluffychat/pangea/course_plans/course_activities/course_activity_repo.dart';
|
||||
|
|
@ -126,8 +126,10 @@ class ActivitySessionStartView extends StatelessWidget {
|
|||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return ActivityFeedbackResponseDialog(
|
||||
return FeedbackResponseDialog(
|
||||
title: L10n.of(context).feedbackTitle,
|
||||
feedback: resp.result!.userFriendlyResponse,
|
||||
description: L10n.of(context).feedbackRespDesc,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,12 +2,19 @@ import 'dart:ui';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/pangea/bot/widgets/bot_face_svg.dart';
|
||||
|
||||
class ActivityFeedbackResponseDialog extends StatelessWidget {
|
||||
class FeedbackResponseDialog extends StatelessWidget {
|
||||
final String title;
|
||||
final String feedback;
|
||||
const ActivityFeedbackResponseDialog({super.key, required this.feedback});
|
||||
final String? description;
|
||||
|
||||
const FeedbackResponseDialog({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.feedback,
|
||||
this.description,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -34,7 +41,7 @@ class ActivityFeedbackResponseDialog extends StatelessWidget {
|
|||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
L10n.of(context).feedbackTitle,
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
|
@ -65,10 +72,11 @@ class ActivityFeedbackResponseDialog extends StatelessWidget {
|
|||
feedback,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
L10n.of(context).feedbackRespDesc,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (description != null)
|
||||
Text(
|
||||
description!,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/common/utils/overlay.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/feedback_response_dialog.dart';
|
||||
import 'package:fluffychat/pangea/events/event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/token_info_feedback/token_info_feedback_dialog.dart';
|
||||
import 'package:fluffychat/pangea/token_info_feedback/token_info_feedback_notification.dart';
|
||||
import 'package:fluffychat/pangea/token_info_feedback/token_info_feedback_request.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
class TokenFeedbackUtil {
|
||||
static Future<void> showTokenFeedbackDialog(
|
||||
|
|
@ -23,21 +22,14 @@ class TokenFeedbackUtil {
|
|||
),
|
||||
);
|
||||
|
||||
if (resp != null && resp is String) {
|
||||
OverlayUtil.showOverlay(
|
||||
overlayKey: "token_feedback_snackbar",
|
||||
context: context,
|
||||
child: TokenFeedbackNotification(message: resp),
|
||||
transformTargetId: '',
|
||||
position: OverlayPositionEnum.top,
|
||||
backDropToDismiss: false,
|
||||
closePrevOverlay: false,
|
||||
canPop: false,
|
||||
);
|
||||
|
||||
Future.delayed(const Duration(seconds: 10), () {
|
||||
MatrixState.pAnyState.closeOverlay("token_feedback_snackbar");
|
||||
});
|
||||
}
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return FeedbackResponseDialog(
|
||||
title: L10n.of(context).tokenInfoFeedbackDialogTitle,
|
||||
feedback: resp,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue