Selects icon color for phonetic audio button based on background darkness
This commit is contained in:
parent
fd3958800f
commit
0ff8b04740
2 changed files with 16 additions and 3 deletions
|
|
@ -16,11 +16,13 @@ class PhoneticTranscriptionWidget extends StatefulWidget {
|
|||
final LanguageModel textLanguage;
|
||||
final TextStyle? style;
|
||||
final double? iconSize;
|
||||
final bool? lightBackground;
|
||||
|
||||
const PhoneticTranscriptionWidget({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.textLanguage,
|
||||
this.lightBackground,
|
||||
this.style,
|
||||
this.iconSize,
|
||||
});
|
||||
|
|
@ -143,9 +145,19 @@ class _PhoneticTranscriptionWidgetState
|
|||
: Icon(
|
||||
_isPlaying ? Icons.pause_outlined : Icons.volume_up,
|
||||
size: widget.iconSize ?? 24,
|
||||
color: _isPlaying
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).iconTheme.color,
|
||||
color: widget.lightBackground ??
|
||||
Theme.of(context).brightness ==
|
||||
Brightness.light
|
||||
? _isPlaying
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.onPrimaryFixed
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onTertiaryFixed
|
||||
: _isPlaying
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ class OverlayMessage extends StatelessWidget {
|
|||
event,
|
||||
textColor,
|
||||
),
|
||||
lightBackground: ownMessage ? true : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue