mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
Partially fix text size, routing to app detail screen, and app card UI
This commit is contained in:
+1
-1
@@ -113,7 +113,7 @@ class ZapstoreApp extends HookConsumerWidget {
|
|||||||
final mediaQuery = MediaQuery.of(context);
|
final mediaQuery = MediaQuery.of(context);
|
||||||
final constrainedTextScale = mediaQuery.textScaler
|
final constrainedTextScale = mediaQuery.textScaler
|
||||||
.scale(1.0)
|
.scale(1.0)
|
||||||
.clamp(1.0, 1.3);
|
.clamp(1.0, 1.2);
|
||||||
final constrainedTextScaler = TextScaler.linear(constrainedTextScale);
|
final constrainedTextScaler = TextScaler.linear(constrainedTextScale);
|
||||||
|
|
||||||
// Show error overlay if initialization failed (do not block UI during loading)
|
// Show error overlay if initialization failed (do not block UI during loading)
|
||||||
|
|||||||
+13
-7
@@ -8,17 +8,20 @@ import 'package:zapstore/screens/search_screen.dart';
|
|||||||
import 'package:zapstore/screens/updates_screen.dart';
|
import 'package:zapstore/screens/updates_screen.dart';
|
||||||
import 'package:zapstore/screens/profile_screen.dart';
|
import 'package:zapstore/screens/profile_screen.dart';
|
||||||
|
|
||||||
/// Extract app identifier from naddr or return as-is
|
typedef _ResolvedAppRoute = ({String identifier, String? author});
|
||||||
String _extractAppIdentifier(String rawId) {
|
|
||||||
|
_ResolvedAppRoute _resolveAppRouteId(String rawId) {
|
||||||
if (rawId.startsWith('naddr1')) {
|
if (rawId.startsWith('naddr1')) {
|
||||||
try {
|
try {
|
||||||
final decoded = Utils.decodeShareableIdentifier(rawId);
|
final decoded = Utils.decodeShareableIdentifier(rawId);
|
||||||
if (decoded is AddressData) {
|
if (decoded is AddressData) {
|
||||||
return decoded.identifier;
|
return (identifier: decoded.identifier, author: decoded.author);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {
|
||||||
|
// Fall back to treating it as a plain identifier.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rawId;
|
return (identifier: rawId, author: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper to build app detail route
|
/// Helper to build app detail route
|
||||||
@@ -27,8 +30,11 @@ GoRoute _appDetailRoute() {
|
|||||||
path: 'app/:id',
|
path: 'app/:id',
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final rawId = state.pathParameters['id']!;
|
final rawId = state.pathParameters['id']!;
|
||||||
final appId = _extractAppIdentifier(rawId);
|
final resolved = _resolveAppRouteId(rawId);
|
||||||
return AppDetailScreen(appId: appId);
|
return AppDetailScreen(
|
||||||
|
appId: resolved.identifier,
|
||||||
|
authorPubkey: resolved.author,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ import 'package:zapstore/widgets/screenshots_gallery.dart';
|
|||||||
import 'package:zapstore/widgets/version_pill_widget.dart';
|
import 'package:zapstore/widgets/version_pill_widget.dart';
|
||||||
|
|
||||||
class AppDetailScreen extends HookConsumerWidget {
|
class AppDetailScreen extends HookConsumerWidget {
|
||||||
const AppDetailScreen({super.key, required this.appId});
|
const AppDetailScreen({super.key, required this.appId, this.authorPubkey});
|
||||||
|
|
||||||
final String appId;
|
final String appId;
|
||||||
|
final String? authorPubkey;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
@@ -30,33 +31,32 @@ class AppDetailScreen extends HookConsumerWidget {
|
|||||||
// Query app with relationships
|
// Query app with relationships
|
||||||
final appState = ref.watch(
|
final appState = ref.watch(
|
||||||
query<App>(
|
query<App>(
|
||||||
|
authors: authorPubkey != null ? {authorPubkey!} : null,
|
||||||
tags: {
|
tags: {
|
||||||
'#d': {appId},
|
'#d': {appId},
|
||||||
'#f': {platform},
|
'#f': {platform},
|
||||||
},
|
},
|
||||||
limit: 1,
|
limit: 1,
|
||||||
and: (a) => {a.latestRelease, a.latestRelease.value?.latestMetadata},
|
and: (a) => {a.latestRelease, a.latestRelease.value?.latestMetadata},
|
||||||
|
// stream=true ensures cached/local results render immediately; remote
|
||||||
|
// results will merge in as they arrive.
|
||||||
source: const LocalAndRemoteSource(relays: 'AppCatalog', stream: false),
|
source: const LocalAndRemoteSource(relays: 'AppCatalog', stream: false),
|
||||||
subscriptionPrefix: 'app-detail',
|
subscriptionPrefix: authorPubkey != null
|
||||||
|
? 'app-detail-${authorPubkey!}-$appId'
|
||||||
|
: 'app-detail-$appId',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final app = appState.models.firstOrNull;
|
|
||||||
|
|
||||||
// Show app detail once we have the app
|
|
||||||
if (app != null) {
|
|
||||||
return _AppDetailContent(app: app, appState: appState);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle loading/error states when app not yet available
|
// Handle loading/error states when app not yet available
|
||||||
return switch (appState) {
|
return switch (appState) {
|
||||||
StorageError(:final exception) => _ErrorScaffold(
|
StorageError(:final exception) => _ErrorScaffold(
|
||||||
message: exception.toString(),
|
message: exception.toString(),
|
||||||
),
|
),
|
||||||
StorageData() => _ErrorScaffold(
|
StorageData() => _AppDetailContent(
|
||||||
message: 'App "$appId" not found in Zapstore.',
|
app: appState.models.firstOrNull,
|
||||||
|
appState: appState,
|
||||||
),
|
),
|
||||||
_ => const Scaffold(
|
StorageLoading() => const Scaffold(
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
@@ -95,13 +95,18 @@ class _ErrorScaffold extends StatelessWidget {
|
|||||||
|
|
||||||
/// Internal widget that displays app details
|
/// Internal widget that displays app details
|
||||||
class _AppDetailContent extends HookConsumerWidget {
|
class _AppDetailContent extends HookConsumerWidget {
|
||||||
final App app;
|
final App? app;
|
||||||
final StorageState<App> appState;
|
final StorageState<App> appState;
|
||||||
|
|
||||||
const _AppDetailContent({required this.app, required this.appState});
|
const _AppDetailContent({required this.app, required this.appState});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final app = this.app;
|
||||||
|
if (app == null) {
|
||||||
|
return const _ErrorScaffold(message: 'App not found');
|
||||||
|
}
|
||||||
|
|
||||||
final signedInPubkey = ref.watch(Signer.activePubkeyProvider);
|
final signedInPubkey = ref.watch(Signer.activePubkeyProvider);
|
||||||
final showDebugSections = isDebugMode(signedInPubkey);
|
final showDebugSections = isDebugMode(signedInPubkey);
|
||||||
|
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ class _UpdatesListBody extends StatelessWidget {
|
|||||||
showUpdateArrow: false,
|
showUpdateArrow: false,
|
||||||
showUpdateButton: true,
|
showUpdateButton: true,
|
||||||
showZapEncouragement: true,
|
showZapEncouragement: true,
|
||||||
|
showDescription: false,
|
||||||
);
|
);
|
||||||
case _UpdatesItemType.automaticHeader:
|
case _UpdatesItemType.automaticHeader:
|
||||||
return _UpdatesSectionHeader(
|
return _UpdatesSectionHeader(
|
||||||
@@ -309,6 +310,7 @@ class _UpdatesListBody extends StatelessWidget {
|
|||||||
showUpdateArrow: true,
|
showUpdateArrow: true,
|
||||||
showUpdateButton: true,
|
showUpdateButton: true,
|
||||||
showZapEncouragement: true,
|
showZapEncouragement: true,
|
||||||
|
showDescription: false,
|
||||||
);
|
);
|
||||||
case _UpdatesItemType.manualHeader:
|
case _UpdatesItemType.manualHeader:
|
||||||
return _UpdatesSectionHeader(
|
return _UpdatesSectionHeader(
|
||||||
@@ -325,6 +327,7 @@ class _UpdatesListBody extends StatelessWidget {
|
|||||||
showUpdateArrow: true,
|
showUpdateArrow: true,
|
||||||
showUpdateButton: true,
|
showUpdateButton: true,
|
||||||
showZapEncouragement: true,
|
showZapEncouragement: true,
|
||||||
|
showDescription: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -526,7 +529,11 @@ class _UpToDateTab extends HookConsumerWidget {
|
|||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: upToDateApps.length,
|
itemCount: upToDateApps.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return AppCard(app: upToDateApps[index], showUpdateArrow: false);
|
return AppCard(
|
||||||
|
app: upToDateApps[index],
|
||||||
|
showUpdateArrow: false,
|
||||||
|
showDescription: false,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -626,7 +633,11 @@ class _BookmarkedAppsSectionWithIds extends ConsumerWidget {
|
|||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: savedApps.length,
|
itemCount: savedApps.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return AppCard(app: savedApps[index], showUpdateArrow: false);
|
return AppCard(
|
||||||
|
app: savedApps[index],
|
||||||
|
showUpdateArrow: false,
|
||||||
|
showDescription: false,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+220
-199
@@ -11,7 +11,7 @@ import 'package:zapstore/utils/url_utils.dart';
|
|||||||
import 'package:zapstore/services/download/download_service.dart';
|
import 'package:zapstore/services/download/download_service.dart';
|
||||||
import 'package:zapstore/widgets/zap_widgets.dart';
|
import 'package:zapstore/widgets/zap_widgets.dart';
|
||||||
|
|
||||||
import 'author_container.dart';
|
import 'common/profile_avatar.dart';
|
||||||
import 'version_pill_widget.dart';
|
import 'version_pill_widget.dart';
|
||||||
import 'install_button.dart';
|
import 'install_button.dart';
|
||||||
import '../theme.dart';
|
import '../theme.dart';
|
||||||
@@ -23,6 +23,7 @@ class AppCard extends HookConsumerWidget {
|
|||||||
final bool showSignedBy;
|
final bool showSignedBy;
|
||||||
final bool showUpdateButton;
|
final bool showUpdateButton;
|
||||||
final bool showZapEncouragement;
|
final bool showZapEncouragement;
|
||||||
|
final bool showDescription;
|
||||||
|
|
||||||
const AppCard({
|
const AppCard({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -32,6 +33,7 @@ class AppCard extends HookConsumerWidget {
|
|||||||
this.showSignedBy = true,
|
this.showSignedBy = true,
|
||||||
this.showUpdateButton = false,
|
this.showUpdateButton = false,
|
||||||
this.showZapEncouragement = false,
|
this.showZapEncouragement = false,
|
||||||
|
this.showDescription = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -55,7 +57,18 @@ class AppCard extends HookConsumerWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
final segments = GoRouterState.of(context).uri.pathSegments;
|
final segments = GoRouterState.of(context).uri.pathSegments;
|
||||||
final first = segments.isNotEmpty ? segments.first : 'search';
|
final first = segments.isNotEmpty ? segments.first : 'search';
|
||||||
context.push('/$first/app/${app!.identifier}');
|
// Prefer naddr so the detail screen can uniquely identify the app
|
||||||
|
// (identifier + author) and not accidentally resolve to a different
|
||||||
|
// publisher's app with the same identifier.
|
||||||
|
final naddr = Utils.encodeShareableIdentifier(
|
||||||
|
AddressInput(
|
||||||
|
identifier: app!.identifier,
|
||||||
|
author: app!.pubkey,
|
||||||
|
kind: app!.event.kind,
|
||||||
|
relays: const [],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
context.push('/$first/app/$naddr');
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
@@ -68,108 +81,69 @@ class AppCard extends HookConsumerWidget {
|
|||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// App Icon (64px, radius 15 to match old design)
|
// Header row: Icon + Name/Version (icon matches header height)
|
||||||
_buildAppIcon(context),
|
LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
// Icon takes max 20% of available width
|
||||||
|
final iconSize = (constraints.maxWidth * 0.20).clamp(
|
||||||
|
48.0,
|
||||||
|
64.0,
|
||||||
|
);
|
||||||
|
return IntrinsicHeight(
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
// App Icon (stretches to match name + version height, max 20% width)
|
||||||
|
_buildAppIcon(context, iconSize),
|
||||||
|
|
||||||
const SizedBox(width: 18),
|
const SizedBox(width: 14),
|
||||||
|
|
||||||
// App Details with professional typography
|
// App Name and Version (always stacked)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
// App Name and Version
|
children: [
|
||||||
if (showUpdateButton) ...[
|
// App name with optional "by publisher" inline
|
||||||
// When showing update button: name on top, version below
|
_buildAppNameWithPublisher(context, publisher),
|
||||||
Text(
|
const SizedBox(height: 6),
|
||||||
app!.name ?? app!.identifier,
|
Align(
|
||||||
style: context.textTheme.titleMedium?.copyWith(
|
alignment: Alignment.centerLeft,
|
||||||
fontWeight: FontWeight.w900,
|
child: VersionPillWidget(
|
||||||
letterSpacing: 0.1,
|
app: app!,
|
||||||
),
|
showUpdateArrow: showUpdateArrow,
|
||||||
overflow: TextOverflow.ellipsis,
|
),
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: VersionPillWidget(
|
|
||||||
app: app!,
|
|
||||||
showUpdateArrow: showUpdateArrow,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
] else ...[
|
|
||||||
// Default: name and version in same row
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
app!.name ?? app!.identifier,
|
|
||||||
style: context.textTheme.titleMedium?.copyWith(
|
|
||||||
fontWeight: FontWeight.w900,
|
|
||||||
letterSpacing: 0.1,
|
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
],
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
),
|
||||||
VersionPillWidget(
|
],
|
||||||
app: app!,
|
|
||||||
showUpdateArrow: showUpdateArrow,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
|
|
||||||
// App Description rendered as plain text (markdown stripped)
|
|
||||||
Text(
|
|
||||||
descriptionText,
|
|
||||||
style: descriptionStyle,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
maxLines: 3,
|
|
||||||
softWrap: true,
|
|
||||||
),
|
),
|
||||||
|
);
|
||||||
// Author signature (only if app has publisher)
|
},
|
||||||
if (showSignedBy && publisher != null) ...[
|
|
||||||
Gap(14),
|
|
||||||
Theme(
|
|
||||||
data: Theme.of(context).copyWith(
|
|
||||||
textTheme: context.textTheme.copyWith(
|
|
||||||
bodySmall: context.textTheme.bodySmall?.copyWith(
|
|
||||||
color: AppColors.darkOnSurfaceSecondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: AuthorContainer(
|
|
||||||
profile: publisher,
|
|
||||||
beforeText: 'Published by',
|
|
||||||
size: context.textTheme.bodyMedium!.fontSize!,
|
|
||||||
oneLine: true,
|
|
||||||
app: app,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
|
|
||||||
// Update button (for apps with updates or currently downloading/installing)
|
|
||||||
if (showUpdateButton) _AppCardUpdateButtonSection(app: app!),
|
|
||||||
|
|
||||||
// Zap encouragement (only for downloading/installing developer-signed apps)
|
|
||||||
if (showZapEncouragement)
|
|
||||||
_AppCardZapEncouragementSection(
|
|
||||||
app: app!,
|
|
||||||
publisher: publisher,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// App Description rendered as plain text (markdown stripped)
|
||||||
|
if (showDescription) ...[
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Text(
|
||||||
|
descriptionText,
|
||||||
|
style: descriptionStyle,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 3,
|
||||||
|
softWrap: true,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
// Update button (for apps with updates or currently downloading/installing)
|
||||||
|
if (showUpdateButton) _AppCardUpdateButtonSection(app: app!),
|
||||||
|
|
||||||
|
// Zap encouragement (only for downloading/installing developer-signed apps)
|
||||||
|
if (showZapEncouragement)
|
||||||
|
_AppCardZapEncouragementSection(app: app!, publisher: publisher),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -199,47 +173,102 @@ class AppCard extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAppIcon(BuildContext context) {
|
Widget _buildAppIcon(BuildContext context, double size) {
|
||||||
final iconUrl = firstValidHttpUrl(app!.icons);
|
final iconUrl = firstValidHttpUrl(app!.icons);
|
||||||
|
|
||||||
return Container(
|
return AspectRatio(
|
||||||
width: 58,
|
aspectRatio: 1,
|
||||||
height: 58,
|
child: ConstrainedBox(
|
||||||
decoration: BoxDecoration(
|
constraints: BoxConstraints(maxWidth: size, maxHeight: size),
|
||||||
borderRadius: BorderRadius.circular(14),
|
child: Container(
|
||||||
boxShadow: [
|
decoration: BoxDecoration(
|
||||||
BoxShadow(
|
borderRadius: BorderRadius.circular(14),
|
||||||
color: Colors.black.withValues(alpha: 0.1),
|
boxShadow: [
|
||||||
blurRadius: 8,
|
BoxShadow(
|
||||||
offset: const Offset(0, 2),
|
color: Colors.black.withValues(alpha: 0.1),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
child: ClipRRect(
|
||||||
),
|
borderRadius: BorderRadius.circular(14),
|
||||||
child: ClipRRect(
|
child: iconUrl != null
|
||||||
borderRadius: BorderRadius.circular(14),
|
? CachedNetworkImage(
|
||||||
child: iconUrl != null
|
imageUrl: iconUrl,
|
||||||
? CachedNetworkImage(
|
fit: BoxFit.cover,
|
||||||
imageUrl: iconUrl,
|
fadeInDuration: const Duration(milliseconds: 500),
|
||||||
fit: BoxFit.cover,
|
fadeOutDuration: const Duration(milliseconds: 200),
|
||||||
fadeInDuration: const Duration(milliseconds: 500),
|
placeholder: (_, url) => const SizedBox.shrink(),
|
||||||
fadeOutDuration: const Duration(milliseconds: 200),
|
errorWidget: (context, url, error) => Center(
|
||||||
placeholder: (_, url) => const SizedBox.shrink(),
|
child: Icon(
|
||||||
errorWidget: (context, url, error) => Center(
|
Icons.broken_image_outlined,
|
||||||
child: Icon(
|
size: 32,
|
||||||
Icons.broken_image_outlined,
|
color: Colors.grey[400],
|
||||||
size: 32,
|
),
|
||||||
color: Colors.grey[400],
|
),
|
||||||
|
)
|
||||||
|
: Center(
|
||||||
|
child: Icon(
|
||||||
|
Icons.apps_outlined,
|
||||||
|
size: 32,
|
||||||
|
color: Colors.grey[400],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
: Center(
|
),
|
||||||
child: Icon(
|
);
|
||||||
Icons.apps_outlined,
|
}
|
||||||
size: 32,
|
|
||||||
color: Colors.grey[400],
|
Widget _buildAppNameWithPublisher(BuildContext context, Profile? publisher) {
|
||||||
|
final appName = app!.name ?? app!.identifier;
|
||||||
|
final titleStyle = context.textTheme.titleMedium?.copyWith(
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
letterSpacing: 0.1,
|
||||||
|
);
|
||||||
|
|
||||||
|
// If no publisher or relay-signed, just show name
|
||||||
|
if (!showSignedBy || publisher == null || app!.isRelaySigned) {
|
||||||
|
return Text(
|
||||||
|
appName,
|
||||||
|
style: titleStyle,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show "(app name) by (profile)" with wrapping
|
||||||
|
final byStyle = context.textTheme.bodyMedium?.copyWith(
|
||||||
|
color: AppColors.darkOnSurfaceSecondary,
|
||||||
|
);
|
||||||
|
final publisherStyle = byStyle?.copyWith(fontWeight: FontWeight.w600);
|
||||||
|
final avatarSize = context.textTheme.bodyMedium!.fontSize! * 1.4;
|
||||||
|
|
||||||
|
return Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(text: appName, style: titleStyle),
|
||||||
|
TextSpan(text: ' by ', style: byStyle),
|
||||||
|
WidgetSpan(
|
||||||
|
alignment: PlaceholderAlignment.middle,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 4),
|
||||||
|
child: SizedBox(
|
||||||
|
width: avatarSize,
|
||||||
|
height: avatarSize,
|
||||||
|
child: ProfileAvatar(
|
||||||
|
profile: publisher,
|
||||||
|
radius: avatarSize / 2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(text: publisher.nameOrNpub, style: publisherStyle),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
softWrap: true,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,48 +336,58 @@ class AppCard extends HookConsumerWidget {
|
|||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: LayoutBuilder(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
builder: (context, constraints) {
|
||||||
children: [
|
final iconSize = (constraints.maxWidth * 0.20).clamp(48.0, 64.0);
|
||||||
// App icon skeleton
|
return Column(
|
||||||
Container(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
width: 58,
|
children: [
|
||||||
height: 58,
|
// Header row: Icon + Name/Version
|
||||||
decoration: BoxDecoration(
|
Row(
|
||||||
color: AppColors.darkSkeletonBase,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
borderRadius: BorderRadius.circular(14),
|
children: [
|
||||||
),
|
// App icon skeleton
|
||||||
),
|
Container(
|
||||||
const SizedBox(width: 18),
|
width: iconSize,
|
||||||
// App details skeleton
|
height: iconSize,
|
||||||
Expanded(
|
decoration: BoxDecoration(
|
||||||
child: Column(
|
color: AppColors.darkSkeletonBase,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
borderRadius: BorderRadius.circular(14),
|
||||||
children: [
|
|
||||||
// App name skeleton
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: 24,
|
|
||||||
width: 150,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColors.darkSkeletonBase,
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const Spacer(),
|
),
|
||||||
Container(
|
const SizedBox(width: 14),
|
||||||
height: 20,
|
// App name and version skeleton (stacked)
|
||||||
width: 60,
|
Expanded(
|
||||||
decoration: BoxDecoration(
|
child: Column(
|
||||||
color: AppColors.darkSkeletonBase,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
borderRadius: BorderRadius.circular(10),
|
children: [
|
||||||
),
|
// App name skeleton (with "by publisher" space)
|
||||||
|
Container(
|
||||||
|
height: 20,
|
||||||
|
width: 180,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.darkSkeletonBase,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
// Version pill skeleton
|
||||||
|
Container(
|
||||||
|
height: 20,
|
||||||
|
width: 60,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.darkSkeletonBase,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
|
),
|
||||||
|
// Description skeleton - 3 lines to match actual maxLines: 3
|
||||||
|
if (showDescription) ...[
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
// Description skeleton - 3 lines to match actual maxLines: 3
|
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -380,31 +419,10 @@ class AppCard extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// Author skeleton (only if showSignedBy is true) - match Gap(14) spacing
|
|
||||||
if (showSignedBy) ...[
|
|
||||||
const SizedBox(height: 14),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
CircleAvatar(
|
|
||||||
radius: 12,
|
|
||||||
backgroundColor: AppColors.darkSkeletonBase,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Container(
|
|
||||||
height: 16,
|
|
||||||
width: 120,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColors.darkSkeletonBase,
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -428,8 +446,8 @@ class _AppCardUpdateButtonSection extends ConsumerWidget {
|
|||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
const Gap(12),
|
const Gap(12),
|
||||||
SizedBox(
|
ConstrainedBox(
|
||||||
height: 38,
|
constraints: const BoxConstraints(minHeight: 38),
|
||||||
child: _CompactInstallButton(
|
child: _CompactInstallButton(
|
||||||
app: app,
|
app: app,
|
||||||
release: app.latestRelease.value,
|
release: app.latestRelease.value,
|
||||||
@@ -515,8 +533,8 @@ class _ZapEncouragementInCard extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
SizedBox(
|
ConstrainedBox(
|
||||||
height: 28,
|
constraints: const BoxConstraints(minHeight: 28),
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => showZapDialog(context, ref, app, author),
|
onPressed: () => showZapDialog(context, ref, app, author),
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
@@ -532,9 +550,12 @@ class _ZapEncouragementInCard extends HookConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: Text(
|
||||||
'Zap',
|
'Zap',
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
|
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -474,7 +474,18 @@ class AppGridCard extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
final segments = GoRouterState.of(context).uri.pathSegments;
|
final segments = GoRouterState.of(context).uri.pathSegments;
|
||||||
final first = segments.isNotEmpty ? segments.first : 'search';
|
final first = segments.isNotEmpty ? segments.first : 'search';
|
||||||
context.push('/$first/app/${app!.identifier}');
|
// Prefer naddr so the detail screen can uniquely identify the app
|
||||||
|
// (identifier + author) and not accidentally resolve to a different
|
||||||
|
// publisher's app with the same identifier.
|
||||||
|
final naddr = Utils.encodeShareableIdentifier(
|
||||||
|
AddressInput(
|
||||||
|
identifier: app!.identifier,
|
||||||
|
author: app!.pubkey,
|
||||||
|
kind: app!.event.kind,
|
||||||
|
relays: const [],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
context.push('/$first/app/$naddr');
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.all(2),
|
margin: const EdgeInsets.all(2),
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ class NoteParser {
|
|||||||
return Text(content, style: textStyle);
|
return Text(content, style: textStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RichText(text: TextSpan(children: spans));
|
return Text.rich(TextSpan(children: spans));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if a URL is likely a media URL and returns the media type
|
/// Checks if a URL is likely a media URL and returns the media type
|
||||||
@@ -386,10 +386,15 @@ class ProfileEntityWidget extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final profileState = ref.watch(query<Profile>(
|
final profileState = ref.watch(
|
||||||
authors: {profileData.pubkey},
|
query<Profile>(
|
||||||
source: const LocalAndRemoteSource(relays: {'social', 'vertex'}, cachedFor: Duration(hours: 2)),
|
authors: {profileData.pubkey},
|
||||||
));
|
source: const LocalAndRemoteSource(
|
||||||
|
relays: {'social', 'vertex'},
|
||||||
|
cachedFor: Duration(hours: 2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
// Show animated npub while profile is being loaded
|
// Show animated npub while profile is being loaded
|
||||||
return switch (profileState) {
|
return switch (profileState) {
|
||||||
@@ -411,10 +416,7 @@ class ProfileEntityWidget extends ConsumerWidget {
|
|||||||
colorPair: colorPair,
|
colorPair: colorPair,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
StorageData(:final models) => _buildProfileWidget(
|
StorageData(:final models) => _buildProfileWidget(context, models.first),
|
||||||
context,
|
|
||||||
models.first,
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,10 +500,9 @@ class EventEntityWidget extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
shortId,
|
shortId,
|
||||||
style: context.textTheme.bodySmall?.copyWith(
|
style: context.textTheme.bodySmall?.copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(
|
||||||
.colorScheme
|
context,
|
||||||
.onSurface
|
).colorScheme.onSurface.withValues(alpha: 0.7),
|
||||||
.withValues(alpha: 0.7),
|
|
||||||
fontFeatures: const [FontFeature.tabularFigures()],
|
fontFeatures: const [FontFeature.tabularFigures()],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ class InstallButton extends ConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: ConstrainedBox(
|
||||||
height: 48,
|
constraints: const BoxConstraints(minHeight: 48),
|
||||||
child: _buildButtonForState(context, ref, state),
|
child: _buildButtonForState(context, ref, state),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -836,8 +836,8 @@ class InstallButton extends ConsumerWidget {
|
|||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: RichText(
|
child: Text.rich(
|
||||||
text: TextSpan(
|
TextSpan(
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ class PillWidget extends StatelessWidget {
|
|||||||
color: color,
|
color: color,
|
||||||
borderRadius: BorderRadius.circular(size * 1.1),
|
borderRadius: BorderRadius.circular(size * 1.1),
|
||||||
),
|
),
|
||||||
child: RichText(
|
child: Text.rich(
|
||||||
text: TextSpan(
|
TextSpan(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: size,
|
fontSize: size,
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ class RelevantWhoFollowContainer extends HookConsumerWidget {
|
|||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
RichText(
|
Text.rich(
|
||||||
text: TextSpan(
|
TextSpan(
|
||||||
text: 'You follow this publisher. ',
|
text: 'You follow this publisher. ',
|
||||||
style: baseStyle,
|
style: baseStyle,
|
||||||
children: [TextSpan(text: trailingText)],
|
children: [TextSpan(text: trailingText)],
|
||||||
@@ -149,8 +149,8 @@ class RelevantWhoFollowContainer extends HookConsumerWidget {
|
|||||||
String npub,
|
String npub,
|
||||||
TextStyle? baseStyle,
|
TextStyle? baseStyle,
|
||||||
) {
|
) {
|
||||||
return RichText(
|
return Text.rich(
|
||||||
text: TextSpan(
|
TextSpan(
|
||||||
text: 'View profile on nostr',
|
text: 'View profile on nostr',
|
||||||
style: baseStyle?.copyWith(
|
style: baseStyle?.copyWith(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
|||||||
@@ -75,14 +75,16 @@ class VersionPillWidget extends HookConsumerWidget {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
// Current version pill (muted colors for installed version)
|
// Current version pill (muted colors for installed version)
|
||||||
_buildVersionPill(
|
Flexible(
|
||||||
context,
|
child: _buildVersionPill(
|
||||||
ref,
|
context,
|
||||||
installedPackages,
|
ref,
|
||||||
installedVersion,
|
installedPackages,
|
||||||
Theme.of(context).colorScheme.outline.withValues(alpha: 0.3),
|
installedVersion,
|
||||||
Theme.of(context).colorScheme.onSurface,
|
Theme.of(context).colorScheme.outline.withValues(alpha: 0.3),
|
||||||
isInstalledVersion: true,
|
Theme.of(context).colorScheme.onSurface,
|
||||||
|
isInstalledVersion: true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Arrow icon (always arrow, forbidden icon is in the pill itself)
|
// Arrow icon (always arrow, forbidden icon is in the pill itself)
|
||||||
@@ -93,18 +95,20 @@ class VersionPillWidget extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// Available version pill (highlighted for update, greyed for downgrade)
|
// Available version pill (highlighted for update, greyed for downgrade)
|
||||||
_buildVersionPill(
|
Flexible(
|
||||||
context,
|
child: _buildVersionPill(
|
||||||
ref,
|
context,
|
||||||
installedPackages,
|
ref,
|
||||||
availableVersion,
|
installedPackages,
|
||||||
isDowngrade
|
availableVersion,
|
||||||
? Theme.of(context).colorScheme.outline.withValues(alpha: 0.3)
|
isDowngrade
|
||||||
: AppColors.darkPillBackground,
|
? Theme.of(context).colorScheme.outline.withValues(alpha: 0.3)
|
||||||
isDowngrade
|
: AppColors.darkPillBackground,
|
||||||
? Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5)
|
isDowngrade
|
||||||
: Colors.white,
|
? Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5)
|
||||||
isDowngrade: isDowngrade,
|
: Colors.white,
|
||||||
|
isDowngrade: isDowngrade,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -166,14 +170,15 @@ class VersionPillWidget extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Flexible(
|
||||||
displayVersion,
|
child: Text(
|
||||||
maxLines: 1,
|
displayVersion,
|
||||||
overflow: TextOverflow.ellipsis,
|
maxLines: 1,
|
||||||
style: context.textTheme.labelMedium?.copyWith(
|
overflow: TextOverflow.ellipsis,
|
||||||
fontWeight: FontWeight.bold,
|
style: context.textTheme.labelSmall?.copyWith(
|
||||||
color: finalTextColor,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 11.5,
|
color: finalTextColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (statusIcon != null) ...[
|
if (statusIcon != null) ...[
|
||||||
@@ -189,7 +194,8 @@ class VersionPillWidget extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _displayVersion(String version) {
|
String _displayVersion(String version) {
|
||||||
return version.length > 10 ? '${version.substring(0, 9)}...' : version;
|
// Show full version - let Flexible + TextOverflow.ellipsis handle truncation only when needed
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No width enforcement; both pills share the same text style
|
// No width enforcement; both pills share the same text style
|
||||||
|
|||||||
Reference in New Issue
Block a user