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(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(48)),
title: Text(title),
subtitle: subtitle != null ? Text(subtitle!) : null,
leading: Opacity(

View File

@ -77,7 +77,7 @@ class _AppListItemState<T> extends ConsumerState<AppListItem> {
item: widget.item,
child: InkWell(
focusNode: _focusNode,
borderRadius: BorderRadius.circular(30),
borderRadius: BorderRadius.circular(48),
onSecondaryTapDown: buildPopupActions == null
? null
: (details) {

View File

@ -41,6 +41,7 @@ final _mainContentGlobalKey = GlobalKey();
class AppPage extends StatefulWidget {
final String? title;
final String? alternativeTitle;
final String? footnote;
final Widget Function(BuildContext context, bool expanded) builder;
final Widget Function(BuildContext context)? detailViewBuilder;
@ -58,6 +59,7 @@ class AppPage extends StatefulWidget {
const AppPage(
{super.key,
this.title,
this.alternativeTitle,
this.footnote,
required this.builder,
this.centered = false,
@ -215,31 +217,38 @@ class _AppPageState extends State<AppPage> {
AnimatedOpacity(
opacity: !_isSliverTitleScrolledUnder ? 1 : 0,
duration: const Duration(milliseconds: 300),
child: Wrap(
alignment: WrapAlignment.spaceBetween,
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 2.0,
runSpacing: 8.0,
children: [
Text(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Text(
key: _sliverTitleGlobalKey,
widget.title!,
widget.alternativeTitle ?? widget.title!,
style: Theme.of(context).textTheme.displaySmall!.copyWith(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.9),
color: widget.alternativeTitle != null
? Theme.of(context)
.colorScheme
.onSurfaceVariant
.withOpacity(0.4)
: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.9),
),
overflow: TextOverflow.ellipsis,
),
if (widget.capabilities != null)
Wrap(
spacing: 4.0,
runSpacing: 8.0,
children: [
...widget.capabilities!.map((c) => CapabilityBadge(c))
],
)
]),
),
if (widget.capabilities != null &&
widget.alternativeTitle == null)
Wrap(
spacing: 4.0,
runSpacing: 8.0,
children: [
...widget.capabilities!.map((c) => CapabilityBadge(c))
],
)
],
),
)
],
);
@ -267,7 +276,7 @@ class _AppPageState extends State<AppPage> {
child: AnimatedOpacity(
duration: const Duration(milliseconds: 300),
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));
final hasFeature = ref.watch(featureProvider);
final hasActions = hasFeature(features.actions);
final searchText = searchController.text;
Future<void> onFileDropped(File file) async {
final qrScanner = ref.read(qrScannerProvider);
@ -262,6 +263,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
},
builder: (context) => AppPage(
title: l10n.s_accounts,
alternativeTitle: searchText != '' ? 'Results for "$searchText"' : null,
capabilities: const [Capability.oath],
keyActionsBuilder: hasActions
? (context) => oathBuildActions(
@ -381,7 +383,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
?.copyWith(fontSize: textTheme.titleSmall?.fontSize),
decoration: AppInputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32),
borderRadius: BorderRadius.circular(48),
borderSide: BorderSide(
width: 0,
style: searchFocus.hasFocus