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.
44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
// assistance state is, user has not typed a message, user has typed a message and IGC has not run,
|
|
// IGC is running, IGC has run and there are remaining steps (either IT or IGC), or all steps are done
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
import 'package:fluffychat/pangea/constants/colors.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
enum AssistanceState {
|
|
noMessage,
|
|
notFetched,
|
|
fetching,
|
|
fetched,
|
|
complete,
|
|
}
|
|
|
|
extension AssistanceStateExtension on AssistanceState {
|
|
Color stateColor(context) {
|
|
switch (this) {
|
|
case AssistanceState.noMessage:
|
|
case AssistanceState.notFetched:
|
|
case AssistanceState.fetching:
|
|
return Theme.of(context).colorScheme.primary;
|
|
case AssistanceState.fetched:
|
|
return PangeaColors.igcError;
|
|
case AssistanceState.complete:
|
|
return AppConfig.success;
|
|
}
|
|
}
|
|
|
|
String tooltip(L10n l10n) {
|
|
switch (this) {
|
|
case AssistanceState.noMessage:
|
|
case AssistanceState.notFetched:
|
|
return l10n.runGrammarCorrection;
|
|
case AssistanceState.fetching:
|
|
return "";
|
|
case AssistanceState.fetched:
|
|
return l10n.grammarCorrectionFailed;
|
|
case AssistanceState.complete:
|
|
return l10n.grammarCorrectionComplete;
|
|
}
|
|
}
|
|
}
|