This commit is contained in:
Adam Velebil 2022-11-08 15:41:58 +01:00
commit c0a478de71
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084
4 changed files with 14 additions and 9 deletions

View File

@ -15,13 +15,12 @@
*/
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'device_button.dart';
import 'keys.dart';
import 'main_drawer.dart';
class AppPage extends ConsumerWidget {
class AppPage extends StatelessWidget {
final Widget? title;
final Widget child;
final List<Widget> actions;
@ -39,11 +38,11 @@ class AppPage extends ConsumerWidget {
});
@override
Widget build(BuildContext context, WidgetRef ref) => LayoutBuilder(
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 540) {
// Single column layout
return _buildScaffold(context, ref, true);
return _buildScaffold(context, true);
} else {
// Two-column layout
return Scaffold(
@ -56,7 +55,7 @@ class AppPage extends ConsumerWidget {
child: MainPageDrawer(shouldPop: false)),
),
Expanded(
child: _buildScaffold(context, ref, false),
child: _buildScaffold(context, false),
),
],
),
@ -96,7 +95,7 @@ class AppPage extends ConsumerWidget {
);
}
Scaffold _buildScaffold(BuildContext context, WidgetRef ref, bool hasDrawer) {
Scaffold _buildScaffold(BuildContext context, bool hasDrawer) {
return Scaffold(
key: scaffoldGlobalKey,
appBar: AppBar(

View File

@ -16,6 +16,7 @@
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';
@ -53,7 +54,8 @@ class DeviceAvatar extends StatelessWidget {
}
return DeviceAvatar(
radius: radius,
child: const Icon(Icons.device_unknown),
child: const ProductImage(
name: '', formFactor: FormFactor.unknown, isNfc: false),
);
},
nfcReader: (_) => DeviceAvatar(

View File

@ -134,7 +134,7 @@ class _SlideInWidgetState extends ConsumerState<_SlideInWidget>
horizontalTitleGap: 13,
leading: _CircledDeviceAvatar(widget.radius),
title: Text(messages.removeAt(0)),
subtitle: Text(messages.first),
subtitle: Text(messages.isNotEmpty ? messages.first : ''),
),
);
}

View File

@ -277,7 +277,11 @@ class CurrentDeviceDataNotifier extends StateNotifier<AsyncValue<YubiKeyData>> {
state = AsyncValue.data(YubiKeyData(node, result['data']['name'],
DeviceInfo.fromJson(result['data']['info'])));
} else {
state = AsyncValue.error(result['data']['status'], StackTrace.current);
final status = result['data']['status'];
// Only update if status is not changed
if (state.asError?.error != status) {
state = AsyncValue.error(status, StackTrace.current);
}
}
}
} on RpcError catch (e) {