mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-26 22:03:55 +03:00
Merge PR #1362.
This commit is contained in:
commit
8f3ca9ecf0
@ -193,6 +193,14 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
);
|
||||
}
|
||||
|
||||
if (numCreds == null) {
|
||||
return AppPage(
|
||||
centered: true,
|
||||
delayedContent: true,
|
||||
builder: (context, _) => const CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
return OathActions(
|
||||
devicePath: widget.devicePath,
|
||||
actions: (context) => {
|
||||
@ -257,7 +265,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
widget.devicePath,
|
||||
widget.oathState,
|
||||
ref,
|
||||
used: numCreds ?? 0,
|
||||
used: numCreds,
|
||||
)
|
||||
: null,
|
||||
onFileDropped: onFileDropped,
|
||||
@ -265,8 +273,6 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
title: l10n.s_add_account,
|
||||
subtitle: l10n.l_drop_qr_description,
|
||||
),
|
||||
centered: numCreds == null,
|
||||
delayedContent: numCreds == null,
|
||||
detailViewBuilder: _selected != null
|
||||
? (context) {
|
||||
final helper = AccountHelper(context, ref, _selected!);
|
||||
@ -350,107 +356,100 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
});
|
||||
});
|
||||
}
|
||||
return numCreds != null
|
||||
? Actions(
|
||||
actions: {
|
||||
if (expanded)
|
||||
OpenIntent<OathCredential>:
|
||||
CallbackAction<OpenIntent<OathCredential>>(
|
||||
onInvoke: (OpenIntent<OathCredential> intent) {
|
||||
setState(() {
|
||||
_selected = intent.target;
|
||||
});
|
||||
return null;
|
||||
}),
|
||||
return Actions(
|
||||
actions: {
|
||||
if (expanded)
|
||||
OpenIntent<OathCredential>:
|
||||
CallbackAction<OpenIntent<OathCredential>>(
|
||||
onInvoke: (OpenIntent<OathCredential> intent) {
|
||||
setState(() {
|
||||
_selected = intent.target;
|
||||
});
|
||||
return null;
|
||||
}),
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Focus(
|
||||
canRequestFocus: false,
|
||||
onKeyEvent: (node, event) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
||||
node.focusInDirection(TraversalDirection.down);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Focus(
|
||||
canRequestFocus: false,
|
||||
onKeyEvent: (node, event) {
|
||||
if (event.logicalKey ==
|
||||
LogicalKeyboardKey.arrowDown) {
|
||||
node.focusInDirection(TraversalDirection.down);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0, vertical: 8.0),
|
||||
child: AppTextFormField(
|
||||
key: keys.searchAccountsField,
|
||||
controller: searchController,
|
||||
focusNode: searchFocus,
|
||||
// Use the default style, but with a smaller font size:
|
||||
style: textTheme.titleMedium?.copyWith(
|
||||
fontSize: textTheme.titleSmall?.fontSize),
|
||||
decoration: AppInputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
borderSide: BorderSide(
|
||||
width: 0,
|
||||
style: searchFocus.hasFocus
|
||||
? BorderStyle.solid
|
||||
: BorderStyle.none,
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
fillColor: Theme.of(context).hoverColor,
|
||||
filled: true,
|
||||
hintText: l10n.s_search_accounts,
|
||||
isDense: true,
|
||||
prefixIcon: const Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.only(start: 8.0),
|
||||
child: Icon(Icons.search_outlined),
|
||||
),
|
||||
suffixIcon: searchController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
iconSize: 16,
|
||||
onPressed: () {
|
||||
searchController.clear();
|
||||
ref
|
||||
.read(searchProvider.notifier)
|
||||
.setFilter('');
|
||||
setState(() {});
|
||||
},
|
||||
)
|
||||
: null,
|
||||
),
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(searchProvider.notifier)
|
||||
.setFilter(value);
|
||||
setState(() {});
|
||||
},
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (value) {
|
||||
Focus.of(context)
|
||||
.focusInDirection(TraversalDirection.down);
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0, vertical: 8.0),
|
||||
child: AppTextFormField(
|
||||
key: keys.searchAccountsField,
|
||||
controller: searchController,
|
||||
focusNode: searchFocus,
|
||||
// Use the default style, but with a smaller font size:
|
||||
style: textTheme.titleMedium?.copyWith(
|
||||
fontSize: textTheme.titleSmall?.fontSize),
|
||||
decoration: AppInputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
borderSide: BorderSide(
|
||||
width: 0,
|
||||
style: searchFocus.hasFocus
|
||||
? BorderStyle.solid
|
||||
: BorderStyle.none,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
return AccountList(
|
||||
ref.watch(credentialListProvider(
|
||||
widget.devicePath)) ??
|
||||
[],
|
||||
expanded: expanded,
|
||||
selected: _selected,
|
||||
);
|
||||
),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
fillColor: Theme.of(context).hoverColor,
|
||||
filled: true,
|
||||
hintText: l10n.s_search_accounts,
|
||||
isDense: true,
|
||||
prefixIcon: const Padding(
|
||||
padding: EdgeInsetsDirectional.only(start: 8.0),
|
||||
child: Icon(Icons.search_outlined),
|
||||
),
|
||||
suffixIcon: searchController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
iconSize: 16,
|
||||
onPressed: () {
|
||||
searchController.clear();
|
||||
ref
|
||||
.read(searchProvider.notifier)
|
||||
.setFilter('');
|
||||
setState(() {});
|
||||
},
|
||||
)
|
||||
: null,
|
||||
),
|
||||
onChanged: (value) {
|
||||
ref.read(searchProvider.notifier).setFilter(value);
|
||||
setState(() {});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (value) {
|
||||
Focus.of(context)
|
||||
.focusInDirection(TraversalDirection.down);
|
||||
},
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
return AccountList(
|
||||
ref.watch(credentialListProvider(widget.devicePath)) ??
|
||||
[],
|
||||
expanded: expanded,
|
||||
selected: _selected,
|
||||
);
|
||||
},
|
||||
)
|
||||
: const CircularProgressIndicator();
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user