mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-22 13:57:29 +01:00
Make kanji widgets squared
This commit is contained in:
parent
9cea71a1a0
commit
e994d73506
@ -5,18 +5,50 @@ import '../../../../routing/routes.dart';
|
|||||||
|
|
||||||
class KanjiRow extends StatelessWidget {
|
class KanjiRow extends StatelessWidget {
|
||||||
final List<String> kanji;
|
final List<String> kanji;
|
||||||
|
final double fontSize;
|
||||||
const KanjiRow({
|
const KanjiRow({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.kanji,
|
required this.kanji,
|
||||||
|
this.fontSize = 20,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
Widget _kanjiBox(String kanji) => UnconstrainedBox(
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 1,
|
||||||
|
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
final colors = state.theme.menuGreyLight;
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: colors.background,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(
|
||||||
|
kanji,
|
||||||
|
style: TextStyle(
|
||||||
|
color: colors.foreground,
|
||||||
|
fontSize: fontSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Text(
|
const Text(
|
||||||
'Kanji',
|
'Kanji:',
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
@ -26,21 +58,12 @@ class KanjiRow extends StatelessWidget {
|
|||||||
children: kanji
|
children: kanji
|
||||||
.map(
|
.map(
|
||||||
(k) => InkWell(
|
(k) => InkWell(
|
||||||
onTap: () => Navigator.pushNamed(context, Routes.kanjiSearch, arguments: k),
|
onTap: () => Navigator.pushNamed(
|
||||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
context,
|
||||||
builder: (context, state) {
|
Routes.kanjiSearch,
|
||||||
final colors = state.theme.menuGreyLight;
|
arguments: k,
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: colors.background,
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child:
|
|
||||||
Text(k, style: TextStyle(color: colors.foreground, fontSize: 25)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
child: _kanjiBox(k),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
|
Loading…
Reference in New Issue
Block a user