Jisho-Study-Tool/lib/components/search/search_results_body/parts/jlpt_badge.dart

26 lines
597 B
Dart

import 'package:flutter/material.dart';
import 'circle_badge.dart';
class JLPTBadge extends StatelessWidget {
final String? jlptLevel;
const JLPTBadge({
required this.jlptLevel,
Key? key,
}) : super(key: key);
String get formattedJlptLevel =>
jlptLevel != null ? jlptLevel!.substring(5).toUpperCase() : '';
@override
Widget build(BuildContext context) {
return CircleBadge(
color: jlptLevel != null ? Colors.blue : Colors.transparent,
child: Text(
formattedJlptLevel,
style: const TextStyle(color: Colors.white),
),
);
}
}