1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2025-01-09 21:11:14 +01:00
Jisho-Study-Tool/lib/components/search/search_results_body/parts/sense/sentences.dart
h7x4 28f900c02e
Add more content to search results (#31)
* Add lots of new functionality to search results

* Fix jlpt level

* Make antonyms clickable

* Add kanji list

* Replace Blocof with BlocBuilder

* Make kanji widgets squared

* Add missing colons to headers

* add romaji under sentences

* Fix extensive search not showing

* Miscellaneous refactoring
2022-01-23 18:27:00 +01:00

67 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:unofficial_jisho_api/api.dart';
import '../../../../../models/themes/theme.dart';
import '../kanji_kana_box.dart';
class Sentences extends StatelessWidget {
final List<PhraseScrapeSentence> sentences;
final ColorSet colors;
const Sentences({
Key? key,
required this.sentences,
this.colors = LightTheme.defaultMenuGreyNormal,
}) : super(key: key);
Widget _sentence(PhraseScrapeSentence sentence) => Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: colors.background,
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
runSpacing: 10,
children: sentence.pieces
.map(
(p) => JishoJapaneseWord(
word: p.unlifted,
reading: p.lifted,
),
)
.map(
(word) => KanjiKanaBox(
word: word,
showRomajiBelow: true,
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
centerFurigana: false,
autoTransliterateRomaji: false,
kanjiFontsize: 15,
furiganaFontsize: 12,
colors: colors,
),
)
.toList(),
),
Divider(
height: 20,
color: Colors.grey[400],
thickness: 3,
),
Text(
sentence.english,
style: TextStyle(color: colors.foreground),
),
],
),
);
@override
Widget build(BuildContext context) =>
Column(children: [for (final s in sentences) _sentence(s)]);
}