Add alternativeTitle to AppPage and change border radius

This commit is contained in:
Elias Bonnici 2024-02-28 14:49:16 +01:00
parent ad54c18205
commit c3c70029a9
No known key found for this signature in database
GPG Key ID: 5EAC28EA3F980CCF
4 changed files with 36 additions and 25 deletions

View File

@ -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(

View File

@ -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) {

View File

@ -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,23 +217,29 @@ 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,
spacing: 2.0,
runSpacing: 8.0,
children: [ children: [
Text( Flexible(
child: 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
? Theme.of(context)
.colorScheme
.onSurfaceVariant
.withOpacity(0.4)
: Theme.of(context)
.colorScheme .colorScheme
.primary .primary
.withOpacity(0.9), .withOpacity(0.9),
), ),
overflow: TextOverflow.ellipsis,
), ),
if (widget.capabilities != null) ),
if (widget.capabilities != null &&
widget.alternativeTitle == null)
Wrap( Wrap(
spacing: 4.0, spacing: 4.0,
runSpacing: 8.0, runSpacing: 8.0,
@ -239,7 +247,8 @@ class _AppPageState extends State<AppPage> {
...widget.capabilities!.map((c) => CapabilityBadge(c)) ...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!),
), ),
); );
} }

View File

@ -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