always provice error message to card error widget

pull/1428/head
ggurdin 1 year ago
parent c028f64f60
commit 2a7fd9a962
No known key found for this signature in database
GPG Key ID: A01CB41737CBB478

@ -210,7 +210,9 @@ class MessageAudioCardState extends State<MessageAudioCard> {
tts.missingVoiceButton,
],
)
: const CardErrorWidget(),
: const CardErrorWidget(
error: "Null audio file in message_audio_card",
),
),
],
);

@ -130,7 +130,7 @@ class MessageTranslationCardState extends State<MessageTranslationCard> {
if (!_fetchingTranslation &&
repEvent == null &&
selectionTranslation == null) {
return const CardErrorWidget();
return const CardErrorWidget(error: "No translation found");
}
return Padding(

@ -1,7 +1,6 @@
import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart';
import 'package:fluffychat/pangea/utils/bot_style.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
import 'package:fluffychat/pangea/widgets/common/bot_face_svg.dart';
import 'package:fluffychat/pangea/widgets/igc/card_header.dart';
import 'package:flutter/material.dart';
@ -21,30 +20,26 @@ class CardErrorWidget extends StatelessWidget {
Widget build(BuildContext context) {
final ErrorCopy errorCopy = ErrorCopy(context, error);
return Container(
return Padding(
padding: const EdgeInsets.all(8),
constraints: const BoxConstraints(minHeight: minCardHeight),
alignment: Alignment.center,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CardHeader(
text: errorCopy.title,
botExpression: BotExpression.addled,
onClose: () => choreographer?.onMatchError(
cursorOffset: offset,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CardHeader(
text: errorCopy.title,
botExpression: BotExpression.addled,
onClose: () => choreographer?.onMatchError(
cursorOffset: offset,
),
const SizedBox(height: 10.0),
Center(
child: Text(
errorCopy.body,
style: BotStyle.text(context),
),
),
const SizedBox(height: 10.0),
Center(
child: Text(
errorCopy.body,
style: BotStyle.text(context),
),
],
),
),
],
),
);
}

@ -1,8 +1,8 @@
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/utils/bot_style.dart';
import 'package:flutter/material.dart';
import 'package:fluffychat/config/app_config.dart';
import '../../../widgets/matrix.dart';
import '../../utils/bot_style.dart';
import '../common/bot_face_svg.dart';
class CardHeader extends StatelessWidget {
@ -22,8 +22,6 @@ class CardHeader extends StatelessWidget {
return Padding(
padding: const EdgeInsets.only(bottom: 5.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 3.0),
@ -33,13 +31,12 @@ class CardHeader extends StatelessWidget {
),
),
const SizedBox(width: 5.0),
Expanded(
child: Text(
text,
style: BotStyle.text(context),
textAlign: TextAlign.left,
),
Text(
text,
style: BotStyle.text(context),
textAlign: TextAlign.left,
),
const SizedBox(width: 5.0),
CircleAvatar(
backgroundColor: AppConfig.primaryColor.withOpacity(0.1),
child: IconButton(

Loading…
Cancel
Save