mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
Merge PR #286.
This commit is contained in:
commit
c0a478de71
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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 : ''),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user