chore: simplifying changes
This commit is contained in:
parent
667922c909
commit
649ecc6b15
1 changed files with 12 additions and 20 deletions
|
|
@ -297,17 +297,13 @@ class MessageTokenButtonContent extends StatelessWidget {
|
|||
|
||||
Color _color(BuildContext context) {
|
||||
final bool isLight = Theme.of(context).brightness == Brightness.light;
|
||||
if (activity == null) {
|
||||
return isLight
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.primaryContainer;
|
||||
}
|
||||
if (isActivityCompleteOrNullForToken) {
|
||||
return AppConfig.gold;
|
||||
}
|
||||
return isLight
|
||||
final defaultColor = isLight
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.primaryContainer;
|
||||
|
||||
return activity != null && isActivityCompleteOrNullForToken
|
||||
? AppConfig.gold
|
||||
: defaultColor;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -382,6 +378,8 @@ class MessageTokenButtonContent extends StatelessWidget {
|
|||
(selectedChoice != null ? 0.4 : 0.0) +
|
||||
(accepted.isNotEmpty ? 0.3 : 0.0);
|
||||
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return InkWell(
|
||||
onTap: selectedChoice != null
|
||||
? () => onMatch?.call(selectedChoice!)
|
||||
|
|
@ -389,15 +387,11 @@ class MessageTokenButtonContent extends StatelessWidget {
|
|||
borderRadius: _borderRadius,
|
||||
child: CustomPaint(
|
||||
painter: DottedBorderPainter(
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
color: theme.brightness == Brightness.light
|
||||
? theme.colorScheme.primary
|
||||
.withAlpha((colorAlpha * 255).toInt())
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.primaryContainer
|
||||
.withAlpha((colorAlpha * 275).toInt()),
|
||||
: theme.colorScheme.primaryContainer
|
||||
.withAlpha((colorAlpha * 255).toInt()),
|
||||
borderRadius: _borderRadius,
|
||||
),
|
||||
child: Container(
|
||||
|
|
@ -406,9 +400,7 @@ class MessageTokenButtonContent extends StatelessWidget {
|
|||
width: max(width, 24.0),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
color: theme.colorScheme.primary
|
||||
.withAlpha((max(0, colorAlpha - 0.7) * 255).toInt()),
|
||||
borderRadius: _borderRadius,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue