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

38 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
import '../../../bloc/theme/theme_bloc.dart';
class Rank extends StatelessWidget {
final int? rank;
final String ifNullChar;
const Rank({
required this.rank,
this.ifNullChar = '',
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: (rank == null) ? BoxShape.circle : BoxShape.rectangle,
borderRadius: (rank == null) ? null : BorderRadius.circular(10.0),
color: colors.background,
),
child: Text(
rank != null ? '${rank.toString()} / 2500' : ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
),
),
);
},
);
}