Skip to content

Commit

Permalink
Merge pull request #1660 from bitmark-inc/2066/add-date-to-artwork-title
Browse files Browse the repository at this point in the history
2066/add date to artwork title
  • Loading branch information
hoangbtmrk authored May 6, 2024
2 parents 08461f4 + 6c65096 commit 0680c06
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 15 deletions.
1 change: 1 addition & 0 deletions lib/model/ff_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class Artwork {
null,
null,
null,
null,
),
null,
);
Expand Down
6 changes: 6 additions & 0 deletions lib/model/ff_series.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FFSeries {
final Exhibition? exhibition;
final DateTime? createdAt;
final DateTime? updatedAt;
final DateTime? mintedAt;
final FileInfo? originalFile;
final FileInfo? previewFile;
final Artwork? artwork;
Expand All @@ -44,6 +45,7 @@ class FFSeries {
this.artist,
this.exhibition,
this.createdAt,
this.mintedAt,
this.displayIndex,
this.featuringIndex,
this.updatedAt,
Expand Down Expand Up @@ -84,6 +86,9 @@ class FFSeries {
json['createdAt'] == null
? null
: DateTime.parse(json['createdAt'] as String),
json['mintedAt'] == null
? null
: DateTime.parse(json['mintedAt'] as String),
json['displayIndex'] as int?,
json['featuringIndex'] as int?,
json['updatedAt'] == null
Expand Down Expand Up @@ -122,6 +127,7 @@ class FFSeries {
'exhibition': exhibition,
'createdAt': createdAt?.toIso8601String(),
'updatedAt': updatedAt?.toIso8601String(),
'mintedAt': mintedAt?.toIso8601String(),
'originalFile': originalFile?.toJson(),
'previewFile': previewFile?.toJson(),
'artwork': artwork?.toJson(),
Expand Down
3 changes: 2 additions & 1 deletion lib/screen/collection_pro/collection_pro_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:autonomy_flutter/screen/wallet/wallet_page.dart';
import 'package:autonomy_flutter/service/configuration_service.dart';
import 'package:autonomy_flutter/service/playlist_service.dart';
import 'package:autonomy_flutter/service/versions_service.dart';
import 'package:autonomy_flutter/util/asset_token_ext.dart';
import 'package:autonomy_flutter/util/collection_ext.dart';
import 'package:autonomy_flutter/util/medium_category_ext.dart';
import 'package:autonomy_flutter/util/predefined_collection_ext.dart';
Expand Down Expand Up @@ -571,7 +572,7 @@ class CollectionProState extends State<CollectionPro>

Widget _artworkItem(BuildContext context, CompactedAssetToken token) {
final theme = Theme.of(context);
final title = token.title ?? '';
final title = token.displayTitle ?? '';
final artistName = token.artistTitle ?? token.artistID ?? '';
return GestureDetector(
onTap: () async {
Expand Down
2 changes: 1 addition & 1 deletion lib/screen/detail/artwork_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class _ArtworkDetailPageState extends State<ArtworkDetailPage>
centerTitle: false,
backgroundColor: Colors.transparent,
title: ArtworkDetailsHeader(
title: asset.title ?? '',
title: asset.displayTitle ?? '',
subTitle: subTitle,
onSubTitleTap: asset.artistID != null
? () => unawaited(
Expand Down
2 changes: 1 addition & 1 deletion lib/screen/detail/preview/artwork_preview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class _ArtworkPreviewPageState extends State<ArtworkPreviewPage>
title: GestureDetector(
onTap: () async => _moveToInfo(assetToken),
child: ArtworkDetailsHeader(
title: assetToken?.title ?? '',
title: assetToken?.displayTitle ?? '',
subTitle: subTitle,
hideArtist: hideArtist,
)),
Expand Down
2 changes: 1 addition & 1 deletion lib/screen/detail/preview_primer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class _PreviewPrimerPageState extends State<PreviewPrimerPage>
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
token.title ?? '',
token.displayTitle ?? '',
style: theme.textTheme.ppMori400White16,
maxLines: 1,
overflow: TextOverflow.ellipsis,
Expand Down
2 changes: 1 addition & 1 deletion lib/screen/home/collection_home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class CollectionHomePageState extends State<CollectionHomePage>
}) {
final theme = Theme.of(context);
final asset = tokens[index];
final title = asset.title;
final title = asset.displayTitle;
final artistTitle = asset.artistTitle?.toIdentityOrMask(artistIdentities);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
2 changes: 1 addition & 1 deletion lib/screen/interactive_postcard/postcard_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class ClaimedPostcardDetailPageState extends State<ClaimedPostcardDetailPage>
toolbarHeight: 70,
centerTitle: false,
title: Text(
asset.title!,
asset.displayTitle!,
style: theme.textTheme.moMASans400Black12,
overflow: TextOverflow.ellipsis,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/screen/interactive_postcard/stamp_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class _StampPreviewState extends State<StampPreview> with AfterLayoutMixin {
backgroundColor: backgroundColor,
appBar: getCloseAppBar(
context,
title: widget.payload.asset.title ?? '',
title: widget.payload.asset.displayTitle ?? '',
titleStyle: theme.textTheme.moMASans700Black16.copyWith(
fontSize: 18,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ class _SendArtworkPageState extends State<SendArtworkPage> {
}

Widget _artworkView(BuildContext context) {
final title = widget.payload.asset.title;
final title = widget.payload.asset.displayTitle;
final theme = Theme.of(context);
final asset = widget.payload.asset;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class _SendArtworkReviewPageState extends State<SendArtworkReviewPage> {
_item(
context: context,
title: 'title'.tr(),
content: assetToken.title ?? '',
content: assetToken.displayTitle ?? '',
),
divider,
_item(
Expand Down
16 changes: 16 additions & 0 deletions lib/util/asset_token_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ extension AssetTokenExtension on AssetToken {
}
};

String? get displayTitle {
if (title == null) {
return null;
}

return mintedAt != null ? '$title (${mintedAt!.year})' : title;
}

bool get hasMetadata => galleryThumbnailURL != null;

String get secondaryMarketURL {
Expand Down Expand Up @@ -457,6 +465,14 @@ extension CompactedAssetTokenExtension on CompactedAssetToken {

ArtworkIdentity get identity => ArtworkIdentity(id, owner);

String? get displayTitle {
if (title == null) {
return null;
}

return mintedAt != null ? '$title (${mintedAt!.year})' : title;
}

bool get isPostcard {
final splitted = id.split('-');
return splitted.length > 1 &&
Expand Down
8 changes: 8 additions & 0 deletions lib/util/series_ext.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:autonomy_flutter/model/ff_series.dart';

extension FFSeriesExt on FFSeries {
String get displayTitle {
final year = mintedAt?.year ?? createdAt?.year;
return year != null ? '$title ($year)' : title;
}
}
4 changes: 2 additions & 2 deletions lib/view/artwork_common_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ Widget postcardDetailsMetadataSection(
child: MetaDataItem(
title: 'title'.tr(),
titleStyle: titleStyle,
value: assetToken.title ?? '',
value: assetToken.displayTitle ?? '',
valueStyle: theme.textTheme.moMASans400Black12,
),
),
Expand Down Expand Up @@ -1116,7 +1116,7 @@ Widget artworkDetailsMetadataSection(
children: [
MetaDataItem(
title: 'title'.tr(),
value: assetToken.title ?? '',
value: assetToken.displayTitle ?? '',
),
if (artistName != null) ...[
divider,
Expand Down
3 changes: 2 additions & 1 deletion lib/view/series_title_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:autonomy_flutter/model/ff_series.dart';
import 'package:autonomy_flutter/model/ff_user.dart';
import 'package:autonomy_flutter/util/series_ext.dart';
import 'package:feralfile_app_theme/feral_file_app_theme.dart';
import 'package:flutter/material.dart';

Expand All @@ -23,7 +24,7 @@ class SeriesTitleView extends StatelessWidget {
),
const SizedBox(height: 3),
Text(
series.title,
series.displayTitle,
style: theme.textTheme.ppMori700White14.copyWith(
fontStyle: FontStyle.italic,
),
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1862,8 +1862,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "103d9009bd87a5d95123c53dd0a0ee4da6bc3904"
resolved-ref: "103d9009bd87a5d95123c53dd0a0ee4da6bc3904"
ref: fe728879ea8fad6853e222826047728ba2eb5f98
resolved-ref: fe728879ea8fad6853e222826047728ba2eb5f98
url: "https://github.com/autonomy-system/nft-collection"
source: git
version: "0.0.1"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dependencies:
nft_collection:
git:
url: https://github.com/autonomy-system/nft-collection
ref: 103d9009bd87a5d95123c53dd0a0ee4da6bc3904
ref: fe728879ea8fad6853e222826047728ba2eb5f98
feralfile_app_tv_proto:
git:
url: https://github.com/autonomy-system/feralfile-app-tv-proto-communication
Expand Down

0 comments on commit 0680c06

Please sign in to comment.