mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
Remove child from AppPage (use builder instead).
This commit is contained in:
parent
fa05e72538
commit
50dd72b83b
@ -33,8 +33,7 @@ final _navExpandedKey = GlobalKey();
|
||||
|
||||
class AppPage extends StatelessWidget {
|
||||
final Widget? title;
|
||||
final Widget? child;
|
||||
final Widget Function(BuildContext context, bool expanded)? builder;
|
||||
final Widget Function(BuildContext context, bool expanded) builder;
|
||||
final Widget Function(BuildContext context)? detailViewBuilder;
|
||||
final List<Widget> actions;
|
||||
final Widget Function(BuildContext context)? keyActionsBuilder;
|
||||
@ -47,8 +46,7 @@ class AppPage extends StatelessWidget {
|
||||
const AppPage({
|
||||
super.key,
|
||||
this.title,
|
||||
this.child,
|
||||
this.builder,
|
||||
required this.builder,
|
||||
this.actions = const [],
|
||||
this.centered = false,
|
||||
this.keyActionsBuilder,
|
||||
@ -58,12 +56,8 @@ class AppPage extends StatelessWidget {
|
||||
this.onFileDropped,
|
||||
this.delayedContent = false,
|
||||
this.keyActionsBadge = false,
|
||||
}) : assert(!(onFileDropped != null && fileDropOverlay == null),
|
||||
'Declaring onFileDropped requires declaring a fileDropOverlay'),
|
||||
assert(
|
||||
((child == null && builder != null) ||
|
||||
(child != null && builder == null)),
|
||||
'Exactly one of child and builder must be declared');
|
||||
}) : assert(!(onFileDropped != null && fileDropOverlay == null),
|
||||
'Declaring onFileDropped requires declaring a fileDropOverlay');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
@ -159,7 +153,7 @@ class AppPage extends StatelessWidget {
|
||||
Widget _buildMainContent(BuildContext context, bool expanded) {
|
||||
final content = Column(
|
||||
children: [
|
||||
child ?? builder!(context, expanded),
|
||||
builder(context, expanded),
|
||||
if (actions.isNotEmpty)
|
||||
Align(
|
||||
alignment: centered ? Alignment.center : Alignment.centerLeft,
|
||||
|
@ -59,7 +59,7 @@ class MessagePage extends StatelessWidget {
|
||||
onFileDropped: onFileDropped,
|
||||
actionButtonBuilder: actionButtonBuilder,
|
||||
delayedContent: delayedContent,
|
||||
child: Padding(
|
||||
builder: (context, _) => Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8.0, top: 0.0, right: 8.0, bottom: 96.0),
|
||||
child: Column(
|
||||
|
@ -39,7 +39,7 @@ class FidoScreen extends ConsumerWidget {
|
||||
title: Text(l10n.s_webauthn),
|
||||
centered: true,
|
||||
delayedContent: true,
|
||||
child: const CircularProgressIndicator(),
|
||||
builder: (context, _) => const CircularProgressIndicator(),
|
||||
),
|
||||
error: (error, _) {
|
||||
final supported = deviceData
|
||||
|
@ -92,7 +92,7 @@ class FidoLockedPage extends ConsumerWidget {
|
||||
return AppPage(
|
||||
title: Text(l10n.s_webauthn),
|
||||
keyActionsBuilder: hasActions ? _buildActions : null,
|
||||
child: Column(
|
||||
builder: (context, _) => Column(
|
||||
children: [
|
||||
_PinEntryForm(state, node),
|
||||
],
|
||||
|
@ -365,7 +365,7 @@ class _FidoUnlockedPageState extends ConsumerState<FidoUnlockedPage> {
|
||||
title: Text(AppLocalizations.of(context)!.s_webauthn),
|
||||
centered: true,
|
||||
delayedContent: true,
|
||||
child: const CircularProgressIndicator(),
|
||||
builder: (context, _) => const CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class _LockedView extends ConsumerWidget {
|
||||
keyActionsBuilder: hasActions
|
||||
? (context) => oathBuildActions(context, devicePath, oathState, ref)
|
||||
: null,
|
||||
child: Padding(
|
||||
builder: (context, _) => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 18),
|
||||
child: UnlockForm(
|
||||
devicePath,
|
||||
@ -259,7 +259,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
),
|
||||
centered: numCreds == null,
|
||||
delayedContent: numCreds == null,
|
||||
child: numCreds != null
|
||||
builder: (context, expanded) => numCreds != null
|
||||
? Consumer(
|
||||
builder: (context, ref, _) {
|
||||
return AccountList(
|
||||
|
Loading…
Reference in New Issue
Block a user