mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-22 22:07:29 +01:00
29 lines
597 B
Dart
29 lines
597 B
Dart
import 'package:flutter/material.dart';
|
|
import './badge.dart';
|
|
|
|
class WKBadge extends StatelessWidget {
|
|
final String level;
|
|
|
|
const WKBadge({
|
|
required this.level,
|
|
Key? key,
|
|
}) : super(key: key);
|
|
|
|
String _extractWkLevel(String wkRaw) {
|
|
return wkRaw.isNotEmpty ? 'W${wkRaw.substring(8)}' : '';
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Badge(
|
|
color: level.isNotEmpty ? Colors.red : Colors.transparent,
|
|
child: Text(
|
|
_extractWkLevel(level),
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|