stylistic tweaks
This commit is contained in:
parent
0ec17d615e
commit
d8c1ca991a
4 changed files with 42 additions and 59 deletions
|
|
@ -41,7 +41,7 @@ class ChoreographerErrorController extends ChangeNotifier {
|
|||
|
||||
_error = error;
|
||||
Future.delayed(defaultCooldown, () {
|
||||
clear();
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
});
|
||||
notifyListeners();
|
||||
|
|
@ -53,11 +53,7 @@ class ChoreographerErrorController extends ChangeNotifier {
|
|||
}
|
||||
|
||||
void resetError() {
|
||||
clear();
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_error = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@ import 'package:fluffychat/pangea/choreographer/choreo_mode_enum.dart';
|
|||
import 'package:fluffychat/pangea/choreographer/choreographer.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
extension ChoregrapherUserSettingsExtension on Choreographer {
|
||||
bool get isRunningIT {
|
||||
return choreoMode == ChoreoModeEnum.it &&
|
||||
itController.currentITStep.value?.isFinal != true;
|
||||
}
|
||||
|
||||
extension ChoregrapherStateExtension on Choreographer {
|
||||
AssistanceStateEnum get assistanceState {
|
||||
final isSubscribed =
|
||||
MatrixState.pangeaController.subscriptionController.isSubscribed;
|
||||
|
|
@ -21,7 +16,9 @@ extension ChoregrapherUserSettingsExtension on Choreographer {
|
|||
return AssistanceStateEnum.error;
|
||||
}
|
||||
|
||||
if (igcController.openMatches.isNotEmpty || isRunningIT) {
|
||||
if (igcController.openMatches.isNotEmpty ||
|
||||
(choreoMode == ChoreoModeEnum.it &&
|
||||
itController.currentITStep.value?.isFinal != true)) {
|
||||
return AssistanceStateEnum.fetched;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,47 +7,35 @@ class ItShimmer extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<String> dummyStrings = [];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
dummyStrings.add(" " * 10);
|
||||
}
|
||||
final color = Theme.of(context).colorScheme.primary.withAlpha(50);
|
||||
|
||||
return Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
...dummyStrings.map(
|
||||
(e) => Container(
|
||||
constraints: const BoxConstraints(minWidth: 50),
|
||||
margin: const EdgeInsets.all(2),
|
||||
padding: EdgeInsets.zero,
|
||||
child: ImageFiltered(
|
||||
imageFilter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(
|
||||
const EdgeInsets.symmetric(horizontal: 7),
|
||||
),
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
Theme.of(context).colorScheme.primary.withAlpha(50),
|
||||
),
|
||||
),
|
||||
onPressed: null,
|
||||
child: Text(
|
||||
e,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Colors.transparent,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: List.generate(3, (_) {
|
||||
return ImageFiltered(
|
||||
imageFilter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size(50, 36),
|
||||
backgroundColor: color,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||
),
|
||||
onPressed: null,
|
||||
child: const Text(
|
||||
" ", // 10 spaces
|
||||
style: TextStyle(
|
||||
color: Colors.transparent,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,21 @@ class WordDataCard extends StatelessWidget {
|
|||
required this.langCode,
|
||||
});
|
||||
|
||||
ContextualDefinitionRequestModel get _request =>
|
||||
ContextualDefinitionRequestModel(
|
||||
fullText: fullText,
|
||||
word: word,
|
||||
fullTextLang: langCode,
|
||||
wordLang: langCode,
|
||||
feedbackLang:
|
||||
MatrixState.pangeaController.languageController.activeL1Code() ??
|
||||
LanguageKeys.defaultLanguage,
|
||||
);
|
||||
|
||||
Future<Result<String>> _fetchDefinition() {
|
||||
final request = ContextualDefinitionRequestModel(
|
||||
fullText: fullText,
|
||||
word: word,
|
||||
fullTextLang: langCode,
|
||||
wordLang: langCode,
|
||||
feedbackLang:
|
||||
MatrixState.pangeaController.languageController.activeL1Code() ??
|
||||
LanguageKeys.defaultLanguage,
|
||||
);
|
||||
return ContextualDefinitionRepo.get(
|
||||
MatrixState.pangeaController.userController.accessToken,
|
||||
request,
|
||||
_request,
|
||||
).timeout(
|
||||
const Duration(seconds: 10),
|
||||
onTimeout: () => Result.error("Timeout getting definition"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue