2021-04-11 01:48:43 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2021-09-07 00:05:33 +02:00
|
|
|
import './badge.dart';
|
2021-04-11 01:48:43 +02:00
|
|
|
|
|
|
|
class JLPTBadge extends StatelessWidget {
|
2022-01-23 18:27:00 +01:00
|
|
|
final String? jlptLevel;
|
2021-04-11 01:48:43 +02:00
|
|
|
|
2021-12-01 23:09:53 +01:00
|
|
|
const JLPTBadge({
|
|
|
|
required this.jlptLevel,
|
|
|
|
Key? key,
|
|
|
|
}) : super(key: key);
|
2021-04-11 01:48:43 +02:00
|
|
|
|
2021-12-01 23:09:53 +01:00
|
|
|
String get formattedJlptLevel =>
|
2022-01-23 18:27:00 +01:00
|
|
|
jlptLevel != null ? jlptLevel!.substring(5).toUpperCase() : '';
|
2021-04-11 01:48:43 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Badge(
|
2022-01-23 18:27:00 +01:00
|
|
|
color: jlptLevel != null ? Colors.blue : Colors.transparent,
|
2021-12-01 23:09:53 +01:00
|
|
|
child: Text(
|
|
|
|
formattedJlptLevel,
|
|
|
|
style: const TextStyle(color: Colors.white),
|
2021-04-11 01:48:43 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2021-12-01 23:09:53 +01:00
|
|
|
}
|