2021-04-11 01:48:43 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2024-11-13 22:43:44 +01:00
|
|
|
import 'circle_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) {
|
2024-11-13 22:43:44 +01:00
|
|
|
return CircleBadge(
|
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
|
|
|
}
|