diff --git a/lib/screens/word_details/definition_tile.dart b/lib/screens/word_details/definition_tile.dart index 9e5a17c..4dcc612 100644 --- a/lib/screens/word_details/definition_tile.dart +++ b/lib/screens/word_details/definition_tile.dart @@ -9,14 +9,9 @@ import "package:jsdict/screens/word_details/word_details_screen.dart"; import "package:jsdict/widgets/link_span.dart"; class DefinitionTile extends StatelessWidget { - const DefinitionTile({ - required this.definition, - this.textColor, - this.isLast = false, - }); + const DefinitionTile({required this.definition, this.isLast = false}); final Definition definition; - final Color? textColor; final bool isLast; @override @@ -40,13 +35,22 @@ class DefinitionTile extends StatelessWidget { Text(definition.types.join(", ")), if (definition.tags.isNotEmpty) JpText(definition.tags.join(", ")), if (definition.seeAlso.isNotEmpty) - seeAlsoText(context, definition.seeAlso), + _SeeAlsoText(words: definition.seeAlso), ], ), ); } +} + +class _SeeAlsoText extends StatelessWidget { + const _SeeAlsoText({required this.words}); + + final List words; + + @override + Widget build(BuildContext context) { + final textColor = Theme.of(context).textTheme.bodyLarge!.color; - Widget seeAlsoText(BuildContext context, List words) { return SelectableText.rich( TextSpan( children: [ diff --git a/lib/screens/word_details/word_details_screen.dart b/lib/screens/word_details/word_details_screen.dart index adbcaf2..d72f95a 100644 --- a/lib/screens/word_details/word_details_screen.dart +++ b/lib/screens/word_details/word_details_screen.dart @@ -82,7 +82,6 @@ class _WordContentWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final textColor = Theme.of(context).textTheme.bodyLarge!.color; final shadowColor = Theme.of(context).colorScheme.shadow; return SingleChildScrollView( @@ -127,7 +126,6 @@ class _WordContentWidget extends StatelessWidget { .map( (definition) => DefinitionTile( definition: definition, - textColor: textColor, isLast: definition == word.definitions.last, ), )