Jisho-Study-Tool/lib/components/kanji/kanji_result_body/grade.dart

36 lines
773 B
Dart
Raw Permalink Normal View History

2020-07-11 13:33:31 +02:00
import 'package:flutter/material.dart';
2021-12-01 23:09:53 +01:00
2022-01-19 02:10:05 +01:00
import '../../../bloc/theme/theme_bloc.dart';
2020-07-11 13:33:31 +02:00
2022-01-19 02:10:05 +01:00
class Grade extends StatelessWidget {
final String? grade;
final String ifNullChar;
2020-07-11 13:33:31 +02:00
2022-01-19 02:10:05 +01:00
const Grade({
required this.grade,
this.ifNullChar = '',
2021-12-01 23:09:53 +01:00
Key? key,
}) : super(key: key);
2020-07-11 13:33:31 +02:00
@override
Widget build(BuildContext context) {
2022-01-19 02:10:05 +01:00
final colors =
2021-12-01 23:09:53 +01:00
BlocProvider.of<ThemeBloc>(context).state.theme.kanjiResultColor;
2021-08-08 23:16:54 +02:00
2020-07-11 13:33:31 +02:00
return Container(
2021-12-01 23:09:53 +01:00
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
2022-01-19 02:10:05 +01:00
color: colors.background,
2021-12-01 23:09:53 +01:00
shape: BoxShape.circle,
),
2020-07-11 13:33:31 +02:00
child: Text(
2022-01-19 02:10:05 +01:00
grade ?? ifNullChar,
2020-07-11 13:33:31 +02:00
style: TextStyle(
2022-01-19 02:10:05 +01:00
color: colors.foreground,
2020-07-11 13:33:31 +02:00
fontSize: 20.0,
),
),
);
}
2021-12-01 23:09:53 +01:00
}