mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 00:12:09 +03:00
Change borderRadius and padding in AppListItem
This commit is contained in:
parent
5565382969
commit
cbedbfae4e
@ -31,7 +31,6 @@ class AppListItem<T> extends ConsumerStatefulWidget {
|
||||
final Widget? trailing;
|
||||
final List<ActionItem> Function(BuildContext context)? buildPopupActions;
|
||||
final Widget Function(BuildContext context)? itemBuilder;
|
||||
final BorderRadius? borderRadius;
|
||||
final Intent? tapIntent;
|
||||
final Intent? doubleTapIntent;
|
||||
final bool selected;
|
||||
@ -46,7 +45,6 @@ class AppListItem<T> extends ConsumerStatefulWidget {
|
||||
this.trailing,
|
||||
this.buildPopupActions,
|
||||
this.itemBuilder,
|
||||
this.borderRadius,
|
||||
this.tapIntent,
|
||||
this.doubleTapIntent,
|
||||
this.selected = false,
|
||||
@ -82,7 +80,7 @@ class _AppListItemState<T> extends ConsumerState<AppListItem> {
|
||||
item: widget.item,
|
||||
child: InkWell(
|
||||
focusNode: _focusNode,
|
||||
borderRadius: widget.borderRadius ?? BorderRadius.circular(48),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
onSecondaryTapDown: buildPopupActions == null
|
||||
? null
|
||||
: (details) {
|
||||
@ -133,9 +131,10 @@ class _AppListItemState<T> extends ConsumerState<AppListItem> {
|
||||
? SystemMouseCursors.click
|
||||
: null,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(48)),
|
||||
borderRadius: BorderRadius.circular(16)),
|
||||
selectedTileColor: colorScheme.secondaryContainer,
|
||||
selectedColor: colorScheme.onSecondaryContainer,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
selected: widget.selected,
|
||||
leading: widget.leading,
|
||||
title: subtitle == null
|
||||
|
@ -331,15 +331,18 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
}),
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: fingerprints
|
||||
.map((fp) => _FingerprintListItem(
|
||||
fp,
|
||||
expanded: expanded,
|
||||
selected: fp == _selected,
|
||||
))
|
||||
.toList()),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: fingerprints
|
||||
.map((fp) => _FingerprintListItem(
|
||||
fp,
|
||||
expanded: expanded,
|
||||
selected: fp == _selected,
|
||||
))
|
||||
.toList()),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -426,9 +426,7 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
if (searchController.text.isEmpty &&
|
||||
!searchFocus.hasFocus &&
|
||||
showLayoutOptions)
|
||||
if (searchController.text.isEmpty && showLayoutOptions)
|
||||
...FlexLayout.values.map(
|
||||
(e) => MouseRegion(
|
||||
onEnter: (event) {
|
||||
@ -533,24 +531,29 @@ class _FidoUnlockedPageState extends ConsumerState<_FidoUnlockedPage> {
|
||||
child: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final layout = ref.watch(passkeysLayoutProvider);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (filteredCredentials.isEmpty)
|
||||
Center(
|
||||
child: Text(l10n.s_no_passkeys),
|
||||
),
|
||||
FlexBox<FidoCredential>(
|
||||
items: filteredCredentials,
|
||||
itemBuilder: (cred) => _CredentialListItem(
|
||||
cred,
|
||||
expanded: expanded,
|
||||
selected: _selected == cred,
|
||||
),
|
||||
layout: layout,
|
||||
getItemsPerRow: _getItemsPerRow,
|
||||
)
|
||||
],
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (filteredCredentials.isEmpty)
|
||||
Center(
|
||||
child: Text(l10n.s_no_passkeys),
|
||||
),
|
||||
FlexBox<FidoCredential>(
|
||||
items: filteredCredentials,
|
||||
itemBuilder: (cred) => _CredentialListItem(
|
||||
cred,
|
||||
expanded: expanded,
|
||||
selected: _selected == cred,
|
||||
),
|
||||
layout: layout,
|
||||
spacing: layout == FlexLayout.grid ? 4.0 : null,
|
||||
runSpacing: layout == FlexLayout.grid ? 4.0 : null,
|
||||
getItemsPerRow: _getItemsPerRow,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -60,57 +60,45 @@ class AccountList extends ConsumerWidget {
|
||||
return FocusTraversalGroup(
|
||||
policy: WidgetOrderTraversalPolicy(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
padding: const EdgeInsets.only(top: 8.0, left: 16, right: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (pinnedCreds.isNotEmpty) ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16, bottom: 8),
|
||||
child: Text(l10n.s_pinned, style: labelStyle),
|
||||
),
|
||||
Padding(
|
||||
padding: pinnedLayout == FlexLayout.grid
|
||||
? const EdgeInsets.only(left: 16.0, right: 16)
|
||||
: const EdgeInsets.all(0),
|
||||
child: FlexBox<OathPair>(
|
||||
items: pinnedCreds.toList(),
|
||||
itemBuilder: (value) => AccountView(
|
||||
value.credential,
|
||||
expanded: expanded,
|
||||
selected: value.credential == selected,
|
||||
large: pinnedLayout == FlexLayout.grid,
|
||||
),
|
||||
layout: pinnedLayout,
|
||||
runSpacing: 8.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (pinnedCreds.isNotEmpty && creds.isNotEmpty) ...[
|
||||
const SizedBox(height: 24),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16, bottom: 8),
|
||||
child: Text(
|
||||
l10n.s_accounts,
|
||||
style: labelStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: normalLayout == FlexLayout.grid
|
||||
? const EdgeInsets.only(left: 16.0, right: 16)
|
||||
: const EdgeInsets.all(0),
|
||||
child: FlexBox<OathPair>(
|
||||
items: creds.toList(),
|
||||
Text(l10n.s_pinned, style: labelStyle),
|
||||
const SizedBox(height: 8),
|
||||
FlexBox<OathPair>(
|
||||
items: pinnedCreds.toList(),
|
||||
itemBuilder: (value) => AccountView(
|
||||
value.credential,
|
||||
expanded: expanded,
|
||||
selected: value.credential == selected,
|
||||
large: normalLayout == FlexLayout.grid,
|
||||
large: pinnedLayout == FlexLayout.grid,
|
||||
),
|
||||
layout: normalLayout,
|
||||
runSpacing: 8.0,
|
||||
spacing: pinnedLayout == FlexLayout.grid ? 4.0 : null,
|
||||
runSpacing: pinnedLayout == FlexLayout.grid ? 4.0 : null,
|
||||
layout: pinnedLayout,
|
||||
),
|
||||
],
|
||||
if (pinnedCreds.isNotEmpty && creds.isNotEmpty) ...[
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
l10n.s_accounts,
|
||||
style: labelStyle,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
FlexBox<OathPair>(
|
||||
items: creds.toList(),
|
||||
itemBuilder: (value) => AccountView(
|
||||
value.credential,
|
||||
expanded: expanded,
|
||||
selected: value.credential == selected,
|
||||
large: normalLayout == FlexLayout.grid,
|
||||
),
|
||||
spacing: normalLayout == FlexLayout.grid ? 4.0 : null,
|
||||
runSpacing: normalLayout == FlexLayout.grid ? 4.0 : null,
|
||||
layout: normalLayout,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -120,7 +120,6 @@ class _AccountViewState extends ConsumerState<AccountView> {
|
||||
? CopyIntent<OathCredential>(credential)
|
||||
: null,
|
||||
buildPopupActions: (_) => helper.buildActions(),
|
||||
borderRadius: widget.large ? BorderRadius.circular(16) : null,
|
||||
itemBuilder: widget.large
|
||||
? (context) {
|
||||
return ListTile(
|
||||
|
@ -452,8 +452,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
if (searchController.text.isEmpty &&
|
||||
!searchFocus.hasFocus) ...[
|
||||
if (searchController.text.isEmpty) ...[
|
||||
if (width >= 450)
|
||||
...availableLayouts.map(
|
||||
(e) => MouseRegion(
|
||||
|
@ -180,13 +180,16 @@ class _OtpScreenState extends ConsumerState<OtpScreen> {
|
||||
return null;
|
||||
}),
|
||||
},
|
||||
child: Column(children: [
|
||||
...otpState.slots.map((e) => _SlotListItem(
|
||||
e,
|
||||
expanded: expanded,
|
||||
selected: e == selected,
|
||||
))
|
||||
]),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(children: [
|
||||
...otpState.slots.map((e) => _SlotListItem(
|
||||
e,
|
||||
expanded: expanded,
|
||||
selected: e == selected,
|
||||
))
|
||||
]),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -200,25 +200,28 @@ class _PivScreenState extends ConsumerState<PivScreen> {
|
||||
return null;
|
||||
}),
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
...normalSlots.map(
|
||||
(e) => _CertificateListItem(
|
||||
pivState,
|
||||
e,
|
||||
expanded: expanded,
|
||||
selected: e == selected,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
...normalSlots.map(
|
||||
(e) => _CertificateListItem(
|
||||
pivState,
|
||||
e,
|
||||
expanded: expanded,
|
||||
selected: e == selected,
|
||||
),
|
||||
),
|
||||
),
|
||||
...shownRetiredSlots.map(
|
||||
(e) => _CertificateListItem(
|
||||
pivState,
|
||||
e,
|
||||
expanded: expanded,
|
||||
selected: e == selected,
|
||||
),
|
||||
)
|
||||
],
|
||||
...shownRetiredSlots.map(
|
||||
(e) => _CertificateListItem(
|
||||
pivState,
|
||||
e,
|
||||
expanded: expanded,
|
||||
selected: e == selected,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -21,6 +21,7 @@ class FlexBox<T> extends StatelessWidget {
|
||||
final Widget Function(T value) itemBuilder;
|
||||
final int Function(double width)? getItemsPerRow;
|
||||
final FlexLayout layout;
|
||||
final double? spacing;
|
||||
final double? runSpacing;
|
||||
const FlexBox({
|
||||
super.key,
|
||||
@ -28,7 +29,8 @@ class FlexBox<T> extends StatelessWidget {
|
||||
required this.itemBuilder,
|
||||
this.getItemsPerRow,
|
||||
this.layout = FlexLayout.list,
|
||||
this.runSpacing,
|
||||
this.spacing = 0.0,
|
||||
this.runSpacing = 0.0,
|
||||
});
|
||||
|
||||
int _getItemsPerRow(double width) {
|
||||
@ -92,10 +94,7 @@ class FlexBox<T> extends StatelessWidget {
|
||||
return Column(
|
||||
children: [
|
||||
for (final c in chunks) ...[
|
||||
if (chunks.indexOf(c) > 0 &&
|
||||
layout == FlexLayout.grid &&
|
||||
runSpacing != null)
|
||||
SizedBox(height: runSpacing),
|
||||
if (chunks.indexOf(c) > 0) SizedBox(height: runSpacing),
|
||||
Row(
|
||||
children: [
|
||||
for (final entry in c) ...[
|
||||
@ -103,7 +102,7 @@ class FlexBox<T> extends StatelessWidget {
|
||||
child: itemBuilder(entry),
|
||||
),
|
||||
if (itemsPerRow != 1 && c.indexOf(entry) != c.length - 1)
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: spacing),
|
||||
],
|
||||
if (c.length < itemsPerRow) ...[
|
||||
// Prevents resizing when an items is removed
|
||||
|
Loading…
Reference in New Issue
Block a user