* fix: simplify word zoom card, make all activity buttons stateless * feat: make it visually clearer which activity type is selected * fix: give message to user when no token is selected in word zoom card * feat: don't highlight selected token or speak selected token if message has hidden word activity * feat: added error widgets to word zoom card * feat: added x-out badge to word zoom activity buttons, created word zoom activity button widget * fix: sort morph activity buttons to always have POS as first option, then having unlocked buttons before locked buttons, then alphabetically
54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
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/common/bot_face_svg.dart';
|
|
import 'package:fluffychat/pangea/widgets/igc/card_header.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CardErrorWidget extends StatelessWidget {
|
|
final Object error;
|
|
final Choreographer? choreographer;
|
|
final int? offset;
|
|
final double maxWidth;
|
|
final double padding;
|
|
|
|
const CardErrorWidget({
|
|
super.key,
|
|
required this.error,
|
|
this.choreographer,
|
|
this.offset,
|
|
this.maxWidth = 275,
|
|
this.padding = 8,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final ErrorCopy errorCopy = ErrorCopy(context, error);
|
|
|
|
return Container(
|
|
padding: EdgeInsets.all(padding),
|
|
constraints: BoxConstraints(maxWidth: maxWidth),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
CardHeader(
|
|
text: errorCopy.title,
|
|
botExpression: BotExpression.addled,
|
|
onClose: () => choreographer?.onMatchError(
|
|
cursorOffset: offset,
|
|
),
|
|
),
|
|
const SizedBox(height: 6.0),
|
|
Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: Text(
|
|
errorCopy.body,
|
|
style: BotStyle.text(context),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|