|
|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
import 'package:material_symbols_icons/symbols.dart';
|
|
|
|
|
@ -79,4 +80,29 @@ extension MessageModeExtension on MessageMode {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Color? iconColor(
|
|
|
|
|
PangeaMessageEvent event,
|
|
|
|
|
MessageMode? currentMode,
|
|
|
|
|
BuildContext context,
|
|
|
|
|
) {
|
|
|
|
|
final bool isPracticeActivity = this == MessageMode.practiceActivity;
|
|
|
|
|
final bool practicing = currentMode == MessageMode.practiceActivity;
|
|
|
|
|
final bool practiceEnabled = event.hasUncompletedActivity;
|
|
|
|
|
|
|
|
|
|
// if this is the practice activity icon, and there's no practice activities available,
|
|
|
|
|
// and the current mode is not practice, return lower opacity color.
|
|
|
|
|
if (isPracticeActivity && !practicing && !practiceEnabled) {
|
|
|
|
|
return Theme.of(context).iconTheme.color?.withOpacity(0.5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if this is not a practice activity icon, and practice activities are available,
|
|
|
|
|
// then return lower opacity color if the current mode is practice.
|
|
|
|
|
if (!isPracticeActivity && practicing && practiceEnabled) {
|
|
|
|
|
return Theme.of(context).iconTheme.color?.withOpacity(0.5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if this is the current mode, return primary color.
|
|
|
|
|
return currentMode == this ? Theme.of(context).colorScheme.primary : null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|