fix: show request regen button in overlay message (#4996)
This commit is contained in:
parent
f6c0800d97
commit
f6d40866da
4 changed files with 77 additions and 57 deletions
|
|
@ -14,6 +14,7 @@ import 'package:fluffychat/pangea/activity_sessions/activity_room_extension.dart
|
|||
import 'package:fluffychat/pangea/activity_sessions/activity_session_chat/activity_roles_event_widget.dart';
|
||||
import 'package:fluffychat/pangea/activity_sessions/activity_summary_widget.dart';
|
||||
import 'package:fluffychat/pangea/chat/extensions/custom_room_display_extension.dart';
|
||||
import 'package:fluffychat/pangea/chat/widgets/request_regeneration_button.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/pressable_button.dart';
|
||||
import 'package:fluffychat/pangea/events/constants/pangea_event_types.dart';
|
||||
import 'package:fluffychat/pangea/events/event_wrappers/pangea_message_event.dart';
|
||||
|
|
@ -801,63 +802,14 @@ class Message extends StatelessWidget {
|
|||
)
|
||||
// #Pangea
|
||||
else if (canRefresh)
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets
|
||||
.only(
|
||||
bottom: 8.0,
|
||||
left: 16.0,
|
||||
right: 16.0,
|
||||
),
|
||||
child:
|
||||
TextButton(
|
||||
style: TextButton
|
||||
.styleFrom(
|
||||
padding:
|
||||
EdgeInsets
|
||||
.zero,
|
||||
minimumSize:
|
||||
const Size(
|
||||
0,
|
||||
0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize
|
||||
.min,
|
||||
spacing:
|
||||
4.0,
|
||||
children: [
|
||||
Icon(
|
||||
Icons
|
||||
.refresh,
|
||||
color:
|
||||
textColor.withAlpha(
|
||||
164,
|
||||
),
|
||||
size:
|
||||
14,
|
||||
),
|
||||
Text(
|
||||
L10n.of(
|
||||
context,
|
||||
).requestRegeneration,
|
||||
style:
|
||||
TextStyle(
|
||||
color:
|
||||
textColor.withAlpha(
|
||||
164,
|
||||
),
|
||||
fontSize:
|
||||
11,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () =>
|
||||
controller
|
||||
.requestRegeneration(event.eventId),
|
||||
RequestRegenerationButton(
|
||||
textColor:
|
||||
textColor,
|
||||
onPressed: () =>
|
||||
controller
|
||||
.requestRegeneration(
|
||||
event
|
||||
.eventId,
|
||||
),
|
||||
),
|
||||
// Pangea#
|
||||
|
|
|
|||
59
lib/pangea/chat/widgets/request_regeneration_button.dart
Normal file
59
lib/pangea/chat/widgets/request_regeneration_button.dart
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
|
||||
class RequestRegenerationButton extends StatelessWidget {
|
||||
final Color textColor;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const RequestRegenerationButton({
|
||||
super.key,
|
||||
required this.textColor,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: 8.0,
|
||||
left: 16.0,
|
||||
right: 16.0,
|
||||
),
|
||||
child: TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size(
|
||||
0,
|
||||
0,
|
||||
),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 4.0,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.refresh,
|
||||
color: textColor.withAlpha(
|
||||
164,
|
||||
),
|
||||
size: 14,
|
||||
),
|
||||
Text(
|
||||
L10n.of(
|
||||
context,
|
||||
).requestRegeneration,
|
||||
style: TextStyle(
|
||||
color: textColor.withAlpha(
|
||||
164,
|
||||
),
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -83,6 +83,7 @@ class OverlayCenterContent extends StatelessWidget {
|
|||
messageHeight: messageHeight,
|
||||
isTransitionAnimation: isTransitionAnimation,
|
||||
readingAssistanceMode: readingAssistanceMode,
|
||||
canRefresh: event.eventId == chatController.refreshEventID,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
|||
import 'package:fluffychat/pages/chat/chat.dart';
|
||||
import 'package:fluffychat/pages/chat/events/message_content.dart';
|
||||
import 'package:fluffychat/pages/chat/events/reply_content.dart';
|
||||
import 'package:fluffychat/pangea/chat/widgets/request_regeneration_button.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/async_state.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/error_indicator.dart';
|
||||
import 'package:fluffychat/pangea/events/extensions/pangea_event_extension.dart';
|
||||
|
|
@ -42,6 +43,7 @@ class OverlayMessage extends StatelessWidget {
|
|||
final bool isTransitionAnimation;
|
||||
final ReadingAssistanceMode? readingAssistanceMode;
|
||||
final String overlayKey;
|
||||
final bool canRefresh;
|
||||
|
||||
const OverlayMessage(
|
||||
this.event, {
|
||||
|
|
@ -56,6 +58,7 @@ class OverlayMessage extends StatelessWidget {
|
|||
this.sizeAnimation,
|
||||
this.isTransitionAnimation = false,
|
||||
this.readingAssistanceMode,
|
||||
this.canRefresh = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
|
|
@ -255,6 +258,11 @@ class OverlayMessage extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (canRefresh)
|
||||
RequestRegenerationButton(
|
||||
textColor: textColor,
|
||||
onPressed: () => controller.requestRegeneration(event.eventId),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue