From 3611fe067c1cafa5735f4665006b49cb26aa5a87 Mon Sep 17 00:00:00 2001 From: Hampus Hammarlund Date: Thu, 1 Feb 2024 22:01:28 +0900 Subject: [PATCH] fix: make selection area consistent between kanji and kanji radical views --- lib/ui/views/kanji/kanji_view.dart | 178 +++++++++++++++-------------- 1 file changed, 90 insertions(+), 88 deletions(-) diff --git a/lib/ui/views/kanji/kanji_view.dart b/lib/ui/views/kanji/kanji_view.dart index a6200c2..0471ffe 100644 --- a/lib/ui/views/kanji/kanji_view.dart +++ b/lib/ui/views/kanji/kanji_view.dart @@ -39,12 +39,12 @@ class KanjiView extends StackedView { child: ListView( padding: const EdgeInsets.all(8), children: [ - IntrinsicHeight( - child: Row( - children: [ - Expanded( - child: Center( - child: SelectionContainer.disabled( + SelectionContainer.disabled( + child: IntrinsicHeight( + child: Row( + children: [ + Expanded( + child: Center( child: GestureDetector( onLongPress: viewModel.copyKanji, child: Text( @@ -54,100 +54,102 @@ class KanjiView extends StackedView { ), ), ), - ), - Expanded( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text.rich( - TextSpan( - children: [ - TextSpan( - text: switch (kanji.grade) { - 255 => '—', - 8 => '7-9', - _ => kanji.grade.toString(), - }, - ), - const TextSpan( - text: '\nGrade', - style: TextStyle( - fontSize: 12, - color: Colors.grey, + Expanded( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: switch (kanji.grade) { + 255 => '—', + 8 => '7-9', + _ => kanji.grade.toString(), + }, ), - ), - ], + const TextSpan( + text: '\nGrade', + style: TextStyle( + fontSize: 12, + color: Colors.grey, + ), + ), + ], + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, - ), - Text.rich( - TextSpan( - children: [ - TextSpan(text: kanji.strokeCount.toString()), - const TextSpan( - text: '\nStrokes', - style: TextStyle( - fontSize: 12, - color: Colors.grey, + Text.rich( + TextSpan( + children: [ + TextSpan( + text: kanji.strokeCount.toString(), ), - ), - ], + const TextSpan( + text: '\nStrokes', + style: TextStyle( + fontSize: 12, + color: Colors.grey, + ), + ), + ], + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, - ), - ], + ], + ), ), ), - ), - Expanded( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text.rich( - TextSpan( - children: [ - TextSpan( - text: kanji.frequency != null - ? kanji.frequency.toString() - : '—', - ), - const TextSpan( - text: '\nRank', - style: TextStyle( - fontSize: 12, - color: Colors.grey, + Expanded( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: kanji.frequency != null + ? kanji.frequency.toString() + : '—', ), - ), - ], + const TextSpan( + text: '\nRank', + style: TextStyle( + fontSize: 12, + color: Colors.grey, + ), + ), + ], + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, - ), - Text.rich( - TextSpan( - children: [ - TextSpan( - text: kanji.jlpt != 255 - ? 'N${kanji.jlpt}' - : '—', - ), - const TextSpan( - text: '\nJLPT', - style: TextStyle( - fontSize: 12, - color: Colors.grey, + Text.rich( + TextSpan( + children: [ + TextSpan( + text: kanji.jlpt != 255 + ? 'N${kanji.jlpt}' + : '—', ), - ), - ], + const TextSpan( + text: '\nJLPT', + style: TextStyle( + fontSize: 12, + color: Colors.grey, + ), + ), + ], + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, - ), - ], + ], + ), ), ), - ), - ], + ], + ), ), ), if (kanji.strokes != null && kanji.strokes!.isNotEmpty)