mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-29 23:20:03 +03:00
Add alternativeTitle
to AppPage
and change border radius
This commit is contained in:
parent
ad54c18205
commit
c3c70029a9
@ -53,7 +53,7 @@ class ActionListItem extends StatelessWidget {
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(48)),
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
subtitle: subtitle != null ? Text(subtitle!) : null,
|
subtitle: subtitle != null ? Text(subtitle!) : null,
|
||||||
leading: Opacity(
|
leading: Opacity(
|
||||||
|
@ -77,7 +77,7 @@ class _AppListItemState<T> extends ConsumerState<AppListItem> {
|
|||||||
item: widget.item,
|
item: widget.item,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(48),
|
||||||
onSecondaryTapDown: buildPopupActions == null
|
onSecondaryTapDown: buildPopupActions == null
|
||||||
? null
|
? null
|
||||||
: (details) {
|
: (details) {
|
||||||
|
@ -41,6 +41,7 @@ final _mainContentGlobalKey = GlobalKey();
|
|||||||
|
|
||||||
class AppPage extends StatefulWidget {
|
class AppPage extends StatefulWidget {
|
||||||
final String? title;
|
final String? title;
|
||||||
|
final String? alternativeTitle;
|
||||||
final String? footnote;
|
final String? footnote;
|
||||||
final Widget Function(BuildContext context, bool expanded) builder;
|
final Widget Function(BuildContext context, bool expanded) builder;
|
||||||
final Widget Function(BuildContext context)? detailViewBuilder;
|
final Widget Function(BuildContext context)? detailViewBuilder;
|
||||||
@ -58,6 +59,7 @@ class AppPage extends StatefulWidget {
|
|||||||
const AppPage(
|
const AppPage(
|
||||||
{super.key,
|
{super.key,
|
||||||
this.title,
|
this.title,
|
||||||
|
this.alternativeTitle,
|
||||||
this.footnote,
|
this.footnote,
|
||||||
required this.builder,
|
required this.builder,
|
||||||
this.centered = false,
|
this.centered = false,
|
||||||
@ -215,31 +217,38 @@ class _AppPageState extends State<AppPage> {
|
|||||||
AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
opacity: !_isSliverTitleScrolledUnder ? 1 : 0,
|
opacity: !_isSliverTitleScrolledUnder ? 1 : 0,
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: Wrap(
|
child: Row(
|
||||||
alignment: WrapAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
children: [
|
||||||
spacing: 2.0,
|
Flexible(
|
||||||
runSpacing: 8.0,
|
child: Text(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
key: _sliverTitleGlobalKey,
|
key: _sliverTitleGlobalKey,
|
||||||
widget.title!,
|
widget.alternativeTitle ?? widget.title!,
|
||||||
style: Theme.of(context).textTheme.displaySmall!.copyWith(
|
style: Theme.of(context).textTheme.displaySmall!.copyWith(
|
||||||
color: Theme.of(context)
|
color: widget.alternativeTitle != null
|
||||||
.colorScheme
|
? Theme.of(context)
|
||||||
.primary
|
.colorScheme
|
||||||
.withOpacity(0.9),
|
.onSurfaceVariant
|
||||||
|
.withOpacity(0.4)
|
||||||
|
: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary
|
||||||
|
.withOpacity(0.9),
|
||||||
),
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
if (widget.capabilities != null)
|
),
|
||||||
Wrap(
|
if (widget.capabilities != null &&
|
||||||
spacing: 4.0,
|
widget.alternativeTitle == null)
|
||||||
runSpacing: 8.0,
|
Wrap(
|
||||||
children: [
|
spacing: 4.0,
|
||||||
...widget.capabilities!.map((c) => CapabilityBadge(c))
|
runSpacing: 8.0,
|
||||||
],
|
children: [
|
||||||
)
|
...widget.capabilities!.map((c) => CapabilityBadge(c))
|
||||||
]),
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -267,7 +276,7 @@ class _AppPageState extends State<AppPage> {
|
|||||||
child: AnimatedOpacity(
|
child: AnimatedOpacity(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
opacity: _isSliverTitleScrolledUnder ? 1 : 0,
|
opacity: _isSliverTitleScrolledUnder ? 1 : 0,
|
||||||
child: Text(widget.title!),
|
child: Text(widget.alternativeTitle ?? widget.title!),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
|||||||
.select((value) => value?.length));
|
.select((value) => value?.length));
|
||||||
final hasFeature = ref.watch(featureProvider);
|
final hasFeature = ref.watch(featureProvider);
|
||||||
final hasActions = hasFeature(features.actions);
|
final hasActions = hasFeature(features.actions);
|
||||||
|
final searchText = searchController.text;
|
||||||
|
|
||||||
Future<void> onFileDropped(File file) async {
|
Future<void> onFileDropped(File file) async {
|
||||||
final qrScanner = ref.read(qrScannerProvider);
|
final qrScanner = ref.read(qrScannerProvider);
|
||||||
@ -262,6 +263,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
|||||||
},
|
},
|
||||||
builder: (context) => AppPage(
|
builder: (context) => AppPage(
|
||||||
title: l10n.s_accounts,
|
title: l10n.s_accounts,
|
||||||
|
alternativeTitle: searchText != '' ? 'Results for "$searchText"' : null,
|
||||||
capabilities: const [Capability.oath],
|
capabilities: const [Capability.oath],
|
||||||
keyActionsBuilder: hasActions
|
keyActionsBuilder: hasActions
|
||||||
? (context) => oathBuildActions(
|
? (context) => oathBuildActions(
|
||||||
@ -381,7 +383,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
|||||||
?.copyWith(fontSize: textTheme.titleSmall?.fontSize),
|
?.copyWith(fontSize: textTheme.titleSmall?.fontSize),
|
||||||
decoration: AppInputDecoration(
|
decoration: AppInputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(32),
|
borderRadius: BorderRadius.circular(48),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
width: 0,
|
width: 0,
|
||||||
style: searchFocus.hasFocus
|
style: searchFocus.hasFocus
|
||||||
|
Loading…
Reference in New Issue
Block a user