Fix incorrect theme usages.

This commit is contained in:
Dain Nilsson 2023-02-03 09:56:23 +01:00
parent 29cfee8195
commit ca133b5c6c
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
9 changed files with 28 additions and 23 deletions

View File

@ -16,12 +16,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:yubico_authenticator/management/models.dart';
import 'package:yubico_authenticator/widgets/product_image.dart';
import '../../core/models.dart';
import '../../core/state.dart';
import '../../management/models.dart';
import '../../widgets/custom_icons.dart';
import '../../widgets/product_image.dart';
import '../models.dart';
import '../state.dart';
import 'keys.dart';
@ -55,7 +55,10 @@ class DeviceAvatar extends StatelessWidget {
return DeviceAvatar(
radius: radius,
child: const ProductImage(
name: '', formFactor: FormFactor.unknown, isNfc: false),
name: '',
formFactor: FormFactor.unknown,
isNfc: false,
),
);
},
nfcReader: (_) => DeviceAvatar(
@ -94,7 +97,7 @@ class DeviceAvatar extends StatelessWidget {
children: [
CircleAvatar(
radius: radius,
backgroundColor: Theme.of(context).colorScheme.background,
//backgroundColor: Theme.of(context).colorScheme.surfaceVariant,
child: IconTheme(
data: IconTheme.of(context).copyWith(
size: radius,

View File

@ -246,9 +246,10 @@ class _HeroAvatar extends StatelessWidget {
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
theme.colorScheme.background,
theme.colorScheme.background.withOpacity(0.4),
(theme.dialogTheme.backgroundColor ?? theme.dialogBackgroundColor)
theme.colorScheme.inverseSurface.withOpacity(0.6),
theme.colorScheme.inverseSurface.withOpacity(0.25),
(DialogTheme.of(context).backgroundColor ??
theme.dialogBackgroundColor)
.withOpacity(0),
],
),
@ -257,8 +258,8 @@ class _HeroAvatar extends StatelessWidget {
child: Theme(
// Give the avatar a transparent background
data: theme.copyWith(
colorScheme:
theme.colorScheme.copyWith(background: Colors.transparent)),
colorScheme: theme.colorScheme
.copyWith(primaryContainer: Colors.transparent)),
child: child,
),
);

View File

@ -27,8 +27,7 @@ import 'reset_dialog.dart';
Widget fidoBuildActions(
BuildContext context, DeviceNode node, FidoState state, int fingerprints) {
final theme =
ButtonTheme.of(context).colorScheme ?? Theme.of(context).colorScheme;
final theme = Theme.of(context).colorScheme;
return SimpleDialog(
children: [
if (state.bioEnroll != null) ...[

View File

@ -66,8 +66,7 @@ class AccountDialog extends ConsumerWidget with AccountMixin {
List<Widget> _buildActions(BuildContext context, WidgetRef ref) {
final actions = buildActions(context, ref);
final theme =
ButtonTheme.of(context).colorScheme ?? Theme.of(context).colorScheme;
final theme = Theme.of(context).colorScheme;
final copy = actions.firstWhere(((e) => e.text.startsWith('Copy')));
final delete = actions.firstWhere(((e) => e.text.startsWith('Delete')));
@ -177,7 +176,7 @@ class AccountDialog extends ConsumerWidget with AccountMixin {
DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: CardTheme.of(context).color,
color: Theme.of(context).colorScheme.surfaceVariant,
borderRadius: const BorderRadius.all(Radius.circular(30.0)),
),
child: Center(

View File

@ -246,6 +246,10 @@ mixin AccountMixin {
fontFeatures: [FontFeature.tabularFigures()],
//fontWeight: FontWeight.w400,
),
textHeightBehavior: const TextHeightBehavior(
// This helps with vertical centering
applyHeightToFirstAscent: false,
),
),
),
],

View File

@ -176,12 +176,12 @@ class AccountView extends ConsumerWidget with AccountMixin {
child: DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: CardTheme.of(context).color,
borderRadius: const BorderRadius.all(Radius.circular(30.0)),
color: Theme.of(context).colorScheme.surfaceVariant,
borderRadius: const BorderRadius.all(Radius.circular(64.0)),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 2.0),
horizontal: 8.0, vertical: 4.0),
child: DefaultTextStyle.merge(
style: Theme.of(context).textTheme.bodyLarge,
child: buildCodeView(ref),

View File

@ -40,8 +40,7 @@ Widget oathBuildActions(
int? used,
}) {
final capacity = oathState.version.isAtLeast(4) ? 32 : null;
final theme =
ButtonTheme.of(context).colorScheme ?? Theme.of(context).colorScheme;
final theme = Theme.of(context).colorScheme;
return SimpleDialog(
children: [
ListTitle(AppLocalizations.of(context)!.general_setup,

View File

@ -69,7 +69,7 @@ class _ChoiceFilterChipState<T> extends State<ChoiceFilterChip<T>> {
.map((e) => PopupMenuItem<T>(
value: e,
height: chipBox.size.height,
textStyle: Theme.of(context).chipTheme.labelStyle,
textStyle: ChipTheme.of(context).labelStyle,
child: widget.itemBuilder(e),
))
.toList(),
@ -89,7 +89,8 @@ class _ChoiceFilterChipState<T> extends State<ChoiceFilterChip<T>> {
padding: const EdgeInsets.only(left: 6),
child: Icon(
_showing ? Icons.arrow_drop_up : Icons.arrow_drop_down,
color: Theme.of(context).chipTheme.checkmarkColor,
color: ChipTheme.of(context).checkmarkColor,
size: 18,
),
),
],

View File

@ -76,7 +76,6 @@ class _CircleTimerState extends State<CircleTimer>
@override
Widget build(BuildContext context) {
return ProgressCircle(
Theme.of(context).iconTheme.color ?? Colors.grey.shade600,
_progress.value);
IconTheme.of(context).color ?? Colors.grey.shade600, _progress.value);
}
}