fluffychat/lib/pangea/widgets/practice_activity/emoji_practice_button.dart
ggurdin 09942aa47e
fix: simplify word zoom card, make all activity buttons stateless (#1330)
* 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
2024-12-31 11:54:46 -05:00

38 lines
1.1 KiB
Dart

import 'package:fluffychat/pangea/enum/activity_type_enum.dart';
import 'package:fluffychat/pangea/models/pangea_token_model.dart';
import 'package:fluffychat/pangea/widgets/practice_activity/word_zoom_activity_button.dart';
import 'package:flutter/material.dart';
class EmojiPracticeButton extends StatelessWidget {
final PangeaToken token;
final VoidCallback onPressed;
final bool isSelected;
const EmojiPracticeButton({
required this.token,
required this.onPressed,
this.isSelected = false,
super.key,
});
bool get _shouldDoActivity => token.shouldDoActivity(
a: ActivityTypeEnum.emoji,
feature: null,
tag: null,
);
@override
Widget build(BuildContext context) {
final emoji = token.getEmoji();
return _shouldDoActivity || emoji != null
? WordZoomActivityButton(
icon: emoji == null
? const Icon(Icons.add_reaction_outlined)
: Text(emoji),
isSelected: isSelected,
onPressed: onPressed,
opacity: _shouldDoActivity ? 0.5 : 1,
)
: const SizedBox(width: 40);
}
}