You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.0 KiB
Dart
75 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:material_symbols_icons/symbols.dart';
|
|
|
|
import 'package:fluffychat/l10n/l10n.dart';
|
|
import 'package:fluffychat/pangea/analytics_misc/construct_type_enum.dart';
|
|
|
|
enum ProgressIndicatorEnum {
|
|
level,
|
|
wordsUsed,
|
|
morphsUsed,
|
|
activities;
|
|
|
|
static ProgressIndicatorEnum? fromString(String value) {
|
|
switch (value) {
|
|
case 'vocab':
|
|
return ProgressIndicatorEnum.wordsUsed;
|
|
case 'morph':
|
|
return ProgressIndicatorEnum.morphsUsed;
|
|
case 'level':
|
|
return ProgressIndicatorEnum.level;
|
|
case 'activities':
|
|
return ProgressIndicatorEnum.activities;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
extension ProgressIndicatorsExtension on ProgressIndicatorEnum {
|
|
IconData get icon {
|
|
switch (this) {
|
|
case ProgressIndicatorEnum.wordsUsed:
|
|
return Symbols.dictionary;
|
|
case ProgressIndicatorEnum.morphsUsed:
|
|
return Symbols.toys_and_games;
|
|
case ProgressIndicatorEnum.level:
|
|
return Icons.star;
|
|
case ProgressIndicatorEnum.activities:
|
|
return Icons.radar;
|
|
}
|
|
}
|
|
|
|
static bool isDarkMode(BuildContext context) =>
|
|
Theme.of(context).brightness == Brightness.dark;
|
|
|
|
Color color(BuildContext context) {
|
|
return Theme.of(context).colorScheme.primary;
|
|
}
|
|
|
|
String tooltip(BuildContext context) {
|
|
switch (this) {
|
|
case ProgressIndicatorEnum.wordsUsed:
|
|
return L10n.of(context).vocab;
|
|
case ProgressIndicatorEnum.level:
|
|
return L10n.of(context).level;
|
|
case ProgressIndicatorEnum.morphsUsed:
|
|
return L10n.of(context).grammar;
|
|
case ProgressIndicatorEnum.activities:
|
|
return L10n.of(context).activities;
|
|
}
|
|
}
|
|
|
|
ConstructTypeEnum get constructType {
|
|
switch (this) {
|
|
case ProgressIndicatorEnum.wordsUsed:
|
|
return ConstructTypeEnum.vocab;
|
|
case ProgressIndicatorEnum.morphsUsed:
|
|
return ConstructTypeEnum.morph;
|
|
default:
|
|
return ConstructTypeEnum.vocab;
|
|
}
|
|
}
|
|
}
|