mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
Fix deprecation notices and reset styles.
This commit is contained in:
parent
8d4e13fe81
commit
b263f82293
@ -23,6 +23,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../desktop/models.dart';
|
||||
import '../../desktop/state.dart';
|
||||
import '../message.dart';
|
||||
import '../state.dart';
|
||||
import 'graphics.dart';
|
||||
import 'message_page.dart';
|
||||
|
||||
@ -74,7 +75,11 @@ class AppFailurePage extends ConsumerWidget {
|
||||
if (await ref.read(rpcProvider).requireValue.elevate()) {
|
||||
ref.invalidate(rpcProvider);
|
||||
} else {
|
||||
showMessage(context, 'Permission denied');
|
||||
await ref.read(withContextProvider)(
|
||||
(context) async {
|
||||
showMessage(context, 'Permission denied');
|
||||
},
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
closeMessage();
|
||||
|
@ -23,6 +23,7 @@ import '../../core/models.dart';
|
||||
import '../../desktop/state.dart';
|
||||
import '../message.dart';
|
||||
import '../models.dart';
|
||||
import '../state.dart';
|
||||
import 'device_avatar.dart';
|
||||
import 'graphics.dart';
|
||||
import 'message_page.dart';
|
||||
@ -51,7 +52,8 @@ class DeviceErrorScreen extends ConsumerWidget {
|
||||
if (await ref.read(rpcProvider).requireValue.elevate()) {
|
||||
ref.invalidate(rpcProvider);
|
||||
} else {
|
||||
showMessage(context, 'Permission denied');
|
||||
await ref.read(withContextProvider)((context) async =>
|
||||
showMessage(context, 'Permission denied'));
|
||||
}
|
||||
} finally {
|
||||
closeMessage();
|
||||
|
@ -87,18 +87,20 @@ class MainPage extends ConsumerWidget {
|
||||
return;
|
||||
}
|
||||
}
|
||||
await showBlurDialog(
|
||||
context: context,
|
||||
routeSettings: const RouteSettings(name: 'oath_add_account'),
|
||||
builder: (context) {
|
||||
return OathAddAccountPage(
|
||||
null,
|
||||
null,
|
||||
credentials: null,
|
||||
credentialData: otpauth,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
await ref.read(withContextProvider)((context) => showBlurDialog(
|
||||
context: context,
|
||||
routeSettings:
|
||||
const RouteSettings(name: 'oath_add_account'),
|
||||
builder: (context) {
|
||||
return OathAddAccountPage(
|
||||
null,
|
||||
null,
|
||||
credentials: null,
|
||||
credentialData: otpauth,
|
||||
);
|
||||
},
|
||||
));
|
||||
},
|
||||
),
|
||||
);
|
||||
@ -118,7 +120,8 @@ class MainPage extends ConsumerWidget {
|
||||
return const MessagePage(
|
||||
header: 'Device not recognized',
|
||||
);
|
||||
} else if (app.getAvailability(data) == Availability.unsupported) {
|
||||
} else if (app.getAvailability(data) ==
|
||||
Availability.unsupported) {
|
||||
return MessagePage(
|
||||
header: 'Application not supported',
|
||||
message:
|
||||
|
@ -92,7 +92,7 @@ class _UserInteractionDialogState extends State<_UserInteractionDialog> {
|
||||
),
|
||||
Text(
|
||||
widget.controller.title,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
Text(
|
||||
widget.controller.description,
|
||||
|
@ -55,11 +55,6 @@ class _LockKeyNotifier extends StateNotifier<String?> {
|
||||
unsetKey() {
|
||||
state = null;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
final desktopOathState = StateNotifierProvider.autoDispose
|
||||
|
@ -33,7 +33,7 @@ class ErrorPage extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
error,
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -115,7 +115,7 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
|
||||
.fido_warning_will_delete_accounts),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.fido_warning_disable_these_creds,
|
||||
style: Theme.of(context).textTheme.bodyText1,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
Center(
|
||||
child: Text(_getMessage(),
|
||||
|
@ -170,7 +170,7 @@ class AccountDialog extends ConsumerWidget with AccountMixin {
|
||||
textAlign: TextAlign.center,
|
||||
// This is what ListTile uses for subtitle
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Theme.of(context).textTheme.caption!.color,
|
||||
color: Theme.of(context).textTheme.bodySmall!.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12.0),
|
||||
|
@ -73,7 +73,7 @@ class DeleteAccountDialog extends ConsumerWidget {
|
||||
.oath_warning_this_will_delete_account_from_key),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.oath_warning_disable_this_cred,
|
||||
style: Theme.of(context).textTheme.bodyText1,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
Text('${AppLocalizations.of(context)!.oath_account} $label'),
|
||||
]
|
||||
|
@ -149,7 +149,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
controller: searchController,
|
||||
focusNode: searchFocus,
|
||||
// Use the default style, but with a smaller font size:
|
||||
style: textTheme.subtitle1
|
||||
style: textTheme.titleMedium
|
||||
?.copyWith(fontSize: textTheme.titleSmall?.fontSize),
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.oath_search_accounts,
|
||||
|
@ -53,7 +53,7 @@ class ResetDialog extends ConsumerWidget {
|
||||
.oath_warning_will_delete_accounts),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.oath_warning_disable_these_creds,
|
||||
style: Theme.of(context).textTheme.bodyText1,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
]
|
||||
.map((e) => Padding(
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
const primaryGreen = Color(0xffaed581);
|
||||
const accentGreen = Color(0xff9aca3c);
|
||||
@ -24,6 +23,13 @@ const primaryRed = Color(0xffea4335);
|
||||
const darkRed = Color(0xffda4d41);
|
||||
|
||||
class AppTheme {
|
||||
static ThemeData get lightTheme => ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.light,
|
||||
colorSchemeSeed: primaryBlue,
|
||||
);
|
||||
|
||||
/* TODO: Remove this. It is left here as a reference as we adjust styles to work with Flutter 3.7.
|
||||
static ThemeData get lightTheme => ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.light,
|
||||
@ -106,7 +112,15 @@ class AppTheme {
|
||||
fontSize: 16),
|
||||
),
|
||||
);
|
||||
*/
|
||||
|
||||
static ThemeData get darkTheme => ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
colorSchemeSeed: primaryGreen,
|
||||
);
|
||||
|
||||
/* TODO: Remove this. It is left here as a reference as we adjust styles to work with Flutter 3.7.
|
||||
static ThemeData get darkTheme => ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
@ -200,8 +214,10 @@ class AppTheme {
|
||||
fontSize: 16),
|
||||
),
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
/* TODO: Remove this. It is left here as a reference as we adjust styles to work with Flutter 3.7.
|
||||
/// This fixes the issue with FilterChip resizing vertically on toggle.
|
||||
BorderSide? _chipBorder(Color color) =>
|
||||
MaterialStateBorderSide.resolveWith((states) => BorderSide(
|
||||
@ -209,3 +225,4 @@ BorderSide? _chipBorder(Color color) =>
|
||||
color: states.contains(MaterialState.selected)
|
||||
? Colors.transparent
|
||||
: color));
|
||||
*/
|
||||
|
@ -112,7 +112,7 @@ void Function() showToast(
|
||||
final textStyle =
|
||||
ThemeData(brightness: isThemeDark ? Brightness.light : Brightness.dark)
|
||||
.textTheme
|
||||
.subtitle1;
|
||||
.titleMedium;
|
||||
|
||||
OverlayEntry? entry;
|
||||
void close() {
|
||||
@ -146,7 +146,7 @@ void Function() showToast(
|
||||
);
|
||||
});
|
||||
Timer.run(() {
|
||||
Overlay.of(context)!.insert(entry!);
|
||||
Overlay.of(context).insert(entry!);
|
||||
});
|
||||
|
||||
return close;
|
||||
|
@ -30,10 +30,10 @@ int byteLength(String value) => utf8.encode(value).length;
|
||||
InputCounterWidgetBuilder buildByteCounterFor(String currentValue) =>
|
||||
(context, {required currentLength, required isFocused, maxLength}) {
|
||||
final theme = Theme.of(context);
|
||||
final caption = theme.textTheme.caption;
|
||||
final caption = theme.textTheme.bodySmall;
|
||||
final style = (byteLength(currentValue) <= (maxLength ?? 0))
|
||||
? caption
|
||||
: caption?.copyWith(color: theme.errorColor);
|
||||
: caption?.copyWith(color: theme.colorScheme.error);
|
||||
return Text(
|
||||
maxLength != null ? '${byteLength(currentValue)}/$maxLength' : '',
|
||||
style: style,
|
||||
|
Loading…
Reference in New Issue
Block a user