fluffychat/lib/pangea/morphs/morph_icon.dart
wcjord 379e4a8db9
Reading assistance (#2175)
* still in draft

* feat(reading_assistance): whole message activity oriented

* chore: fix .env file path

* feat: animate selected toolbar into middle of screen

* chore: initial work for message bubble size animation

* refactor(reading_assistance): hooking up the choice interactions and polishing UI

* chore: animate in content and buttons

* formatting

* position reading content relative to selected token

* working on limiting choices

* chore: fix positioning of toolbar animation

* chore: simplify positioning logic

* chore: animate in button height

* getting there

* rough draft with restricted activity number is complete

---------

Co-authored-by: ggurdin <ggurdin@gmail.com>
2025-03-24 15:20:07 -04:00

55 lines
1.6 KiB
Dart

import 'package:fluffychat/pangea/common/widgets/customized_svg.dart';
import 'package:fluffychat/pangea/morphs/get_grammar_copy.dart';
import 'package:fluffychat/pangea/morphs/get_svg_link.dart';
import 'package:fluffychat/pangea/morphs/morph_features_enum.dart';
import 'package:fluffychat/utils/color_value.dart';
import 'package:flutter/material.dart';
class MorphIcon extends StatelessWidget {
const MorphIcon({
super.key,
required this.morphFeature,
required this.morphTag,
this.size,
this.showTooltip = false,
});
final MorphFeaturesEnum morphFeature;
final String? morphTag;
final bool showTooltip;
final Size? size;
@override
Widget build(BuildContext context) {
// debugPrint("MorphIcon: morphFeature: $morphFeature, morphTag: $morphTag");
final ThemeData theme = Theme.of(context);
return Tooltip(
message: morphTag == null
? morphFeature.getDisplayCopy(context)
: getGrammarCopy(
category: morphFeature.name,
lemma: morphTag!,
context: context,
),
triggerMode: TooltipTriggerMode.tap,
child: CustomizedSvg(
svgUrl: getMorphSvgLink(
morphFeature: morphFeature.name,
morphTag: morphTag,
context: context,
),
colorReplacements: theme.brightness == Brightness.dark
? {
"white": theme.cardColor.hexValue.toString(),
"black": "white",
}
: {},
errorIcon: Icon(morphFeature.fallbackIcon),
width: size?.width,
height: size?.height,
),
);
}
}