💄 Some improvements
🐛 Bug fixes ✨ The heart reaction
This commit is contained in:
parent
ae0809ad35
commit
269caf7555
lib
@ -8,7 +8,6 @@ import 'package:material_symbols_icons/symbols.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/providers/user_directory.dart';
|
|
||||||
import 'package:surface/types/attachment.dart';
|
import 'package:surface/types/attachment.dart';
|
||||||
import 'package:surface/widgets/attachment/attachment_zoom.dart';
|
import 'package:surface/widgets/attachment/attachment_zoom.dart';
|
||||||
import 'package:surface/widgets/attachment/attachment_item.dart';
|
import 'package:surface/widgets/attachment/attachment_item.dart';
|
||||||
@ -53,7 +52,6 @@ class _AlbumScreenState extends State<AlbumScreen> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final sn = context.read<SnNetworkProvider>();
|
final sn = context.read<SnNetworkProvider>();
|
||||||
final ud = context.read<UserDirectoryProvider>();
|
|
||||||
final resp = await sn.client.get('/cgi/uc/attachments', queryParameters: {
|
final resp = await sn.client.get('/cgi/uc/attachments', queryParameters: {
|
||||||
'take': 10,
|
'take': 10,
|
||||||
'offset': _attachments.length,
|
'offset': _attachments.length,
|
||||||
@ -64,8 +62,6 @@ class _AlbumScreenState extends State<AlbumScreen> {
|
|||||||
_attachments.addAll(attachments);
|
_attachments.addAll(attachments);
|
||||||
_heroTags.addAll(_attachments.map((_) => uuid.v4()));
|
_heroTags.addAll(_attachments.map((_) => uuid.v4()));
|
||||||
|
|
||||||
await ud.listAccount(attachments.map((e) => e.accountId).toSet());
|
|
||||||
|
|
||||||
_totalCount = resp.data['count'] as int?;
|
_totalCount = resp.data['count'] as int?;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:surface/types/account.dart';
|
||||||
|
|
||||||
part 'attachment.freezed.dart';
|
part 'attachment.freezed.dart';
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ abstract class SnAttachment with _$SnAttachment {
|
|||||||
required int? refId,
|
required int? refId,
|
||||||
required SnAttachmentPool? pool,
|
required SnAttachmentPool? pool,
|
||||||
required int? poolId,
|
required int? poolId,
|
||||||
|
required SnAccount? account,
|
||||||
required int accountId,
|
required int accountId,
|
||||||
int? thumbnailId,
|
int? thumbnailId,
|
||||||
SnAttachment? thumbnail,
|
SnAttachment? thumbnail,
|
||||||
@ -49,7 +51,8 @@ abstract class SnAttachment with _$SnAttachment {
|
|||||||
@Default({}) Map<String, dynamic> metadata,
|
@Default({}) Map<String, dynamic> metadata,
|
||||||
}) = _SnAttachment;
|
}) = _SnAttachment;
|
||||||
|
|
||||||
factory SnAttachment.fromJson(Map<String, Object?> json) => _$SnAttachmentFromJson(json);
|
factory SnAttachment.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnAttachmentFromJson(json);
|
||||||
|
|
||||||
Map<String, dynamic> get data => {
|
Map<String, dynamic> get data => {
|
||||||
...metadata,
|
...metadata,
|
||||||
@ -85,7 +88,8 @@ abstract class SnAttachmentFragment with _$SnAttachmentFragment {
|
|||||||
@Default([]) List<String> fileChunksMissing,
|
@Default([]) List<String> fileChunksMissing,
|
||||||
}) = _SnAttachmentFragment;
|
}) = _SnAttachmentFragment;
|
||||||
|
|
||||||
factory SnAttachmentFragment.fromJson(Map<String, Object?> json) => _$SnAttachmentFragmentFromJson(json);
|
factory SnAttachmentFragment.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnAttachmentFragmentFromJson(json);
|
||||||
|
|
||||||
SnMediaType get mediaType => switch (mimetype.split('/').firstOrNull) {
|
SnMediaType get mediaType => switch (mimetype.split('/').firstOrNull) {
|
||||||
'image' => SnMediaType.image,
|
'image' => SnMediaType.image,
|
||||||
@ -109,7 +113,8 @@ abstract class SnAttachmentPool with _$SnAttachmentPool {
|
|||||||
required int? accountId,
|
required int? accountId,
|
||||||
}) = _SnAttachmentPool;
|
}) = _SnAttachmentPool;
|
||||||
|
|
||||||
factory SnAttachmentPool.fromJson(Map<String, Object?> json) => _$SnAttachmentPoolFromJson(json);
|
factory SnAttachmentPool.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnAttachmentPoolFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
@ -122,7 +127,8 @@ abstract class SnAttachmentDestination with _$SnAttachmentDestination {
|
|||||||
required bool isBoost,
|
required bool isBoost,
|
||||||
}) = _SnAttachmentDestination;
|
}) = _SnAttachmentDestination;
|
||||||
|
|
||||||
factory SnAttachmentDestination.fromJson(Map<String, Object?> json) => _$SnAttachmentDestinationFromJson(json);
|
factory SnAttachmentDestination.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnAttachmentDestinationFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
@ -139,7 +145,8 @@ abstract class SnAttachmentBoost with _$SnAttachmentBoost {
|
|||||||
required int account,
|
required int account,
|
||||||
}) = _SnAttachmentBoost;
|
}) = _SnAttachmentBoost;
|
||||||
|
|
||||||
factory SnAttachmentBoost.fromJson(Map<String, Object?> json) => _$SnAttachmentBoostFromJson(json);
|
factory SnAttachmentBoost.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnAttachmentBoostFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
@ -158,7 +165,8 @@ abstract class SnSticker with _$SnSticker {
|
|||||||
required int accountId,
|
required int accountId,
|
||||||
}) = _SnSticker;
|
}) = _SnSticker;
|
||||||
|
|
||||||
factory SnSticker.fromJson(Map<String, Object?> json) => _$SnStickerFromJson(json);
|
factory SnSticker.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnStickerFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
@ -175,7 +183,8 @@ abstract class SnStickerPack with _$SnStickerPack {
|
|||||||
required int accountId,
|
required int accountId,
|
||||||
}) = _SnStickerPack;
|
}) = _SnStickerPack;
|
||||||
|
|
||||||
factory SnStickerPack.fromJson(Map<String, Object?> json) => _$SnStickerPackFromJson(json);
|
factory SnStickerPack.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnStickerPackFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
@ -186,5 +195,6 @@ abstract class SnAttachmentBilling with _$SnAttachmentBilling {
|
|||||||
required double includedRatio,
|
required double includedRatio,
|
||||||
}) = _SnAttachmentBilling;
|
}) = _SnAttachmentBilling;
|
||||||
|
|
||||||
factory SnAttachmentBilling.fromJson(Map<String, Object?> json) => _$SnAttachmentBillingFromJson(json);
|
factory SnAttachmentBilling.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$SnAttachmentBillingFromJson(json);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ mixin _$SnAttachment {
|
|||||||
int? get refId;
|
int? get refId;
|
||||||
SnAttachmentPool? get pool;
|
SnAttachmentPool? get pool;
|
||||||
int? get poolId;
|
int? get poolId;
|
||||||
|
SnAccount? get account;
|
||||||
int get accountId;
|
int get accountId;
|
||||||
int? get thumbnailId;
|
int? get thumbnailId;
|
||||||
SnAttachment? get thumbnail;
|
SnAttachment? get thumbnail;
|
||||||
@ -98,6 +99,7 @@ mixin _$SnAttachment {
|
|||||||
(identical(other.refId, refId) || other.refId == refId) &&
|
(identical(other.refId, refId) || other.refId == refId) &&
|
||||||
(identical(other.pool, pool) || other.pool == pool) &&
|
(identical(other.pool, pool) || other.pool == pool) &&
|
||||||
(identical(other.poolId, poolId) || other.poolId == poolId) &&
|
(identical(other.poolId, poolId) || other.poolId == poolId) &&
|
||||||
|
(identical(other.account, account) || other.account == account) &&
|
||||||
(identical(other.accountId, accountId) ||
|
(identical(other.accountId, accountId) ||
|
||||||
other.accountId == accountId) &&
|
other.accountId == accountId) &&
|
||||||
(identical(other.thumbnailId, thumbnailId) ||
|
(identical(other.thumbnailId, thumbnailId) ||
|
||||||
@ -140,6 +142,7 @@ mixin _$SnAttachment {
|
|||||||
refId,
|
refId,
|
||||||
pool,
|
pool,
|
||||||
poolId,
|
poolId,
|
||||||
|
account,
|
||||||
accountId,
|
accountId,
|
||||||
thumbnailId,
|
thumbnailId,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
@ -152,7 +155,7 @@ mixin _$SnAttachment {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnAttachment(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, rid: $rid, uuid: $uuid, size: $size, name: $name, alt: $alt, mimetype: $mimetype, hash: $hash, destination: $destination, refCount: $refCount, contentRating: $contentRating, qualityRating: $qualityRating, cleanedAt: $cleanedAt, isAnalyzed: $isAnalyzed, isSelfRef: $isSelfRef, isIndexable: $isIndexable, ref: $ref, refId: $refId, pool: $pool, poolId: $poolId, accountId: $accountId, thumbnailId: $thumbnailId, thumbnail: $thumbnail, compressedId: $compressedId, compressed: $compressed, boosts: $boosts, usermeta: $usermeta, metadata: $metadata)';
|
return 'SnAttachment(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, rid: $rid, uuid: $uuid, size: $size, name: $name, alt: $alt, mimetype: $mimetype, hash: $hash, destination: $destination, refCount: $refCount, contentRating: $contentRating, qualityRating: $qualityRating, cleanedAt: $cleanedAt, isAnalyzed: $isAnalyzed, isSelfRef: $isSelfRef, isIndexable: $isIndexable, ref: $ref, refId: $refId, pool: $pool, poolId: $poolId, account: $account, accountId: $accountId, thumbnailId: $thumbnailId, thumbnail: $thumbnail, compressedId: $compressedId, compressed: $compressed, boosts: $boosts, usermeta: $usermeta, metadata: $metadata)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,6 +189,7 @@ abstract mixin class $SnAttachmentCopyWith<$Res> {
|
|||||||
int? refId,
|
int? refId,
|
||||||
SnAttachmentPool? pool,
|
SnAttachmentPool? pool,
|
||||||
int? poolId,
|
int? poolId,
|
||||||
|
SnAccount? account,
|
||||||
int accountId,
|
int accountId,
|
||||||
int? thumbnailId,
|
int? thumbnailId,
|
||||||
SnAttachment? thumbnail,
|
SnAttachment? thumbnail,
|
||||||
@ -197,6 +201,7 @@ abstract mixin class $SnAttachmentCopyWith<$Res> {
|
|||||||
|
|
||||||
$SnAttachmentCopyWith<$Res>? get ref;
|
$SnAttachmentCopyWith<$Res>? get ref;
|
||||||
$SnAttachmentPoolCopyWith<$Res>? get pool;
|
$SnAttachmentPoolCopyWith<$Res>? get pool;
|
||||||
|
$SnAccountCopyWith<$Res>? get account;
|
||||||
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
||||||
$SnAttachmentCopyWith<$Res>? get compressed;
|
$SnAttachmentCopyWith<$Res>? get compressed;
|
||||||
}
|
}
|
||||||
@ -236,6 +241,7 @@ class _$SnAttachmentCopyWithImpl<$Res> implements $SnAttachmentCopyWith<$Res> {
|
|||||||
Object? refId = freezed,
|
Object? refId = freezed,
|
||||||
Object? pool = freezed,
|
Object? pool = freezed,
|
||||||
Object? poolId = freezed,
|
Object? poolId = freezed,
|
||||||
|
Object? account = freezed,
|
||||||
Object? accountId = null,
|
Object? accountId = null,
|
||||||
Object? thumbnailId = freezed,
|
Object? thumbnailId = freezed,
|
||||||
Object? thumbnail = freezed,
|
Object? thumbnail = freezed,
|
||||||
@ -338,6 +344,10 @@ class _$SnAttachmentCopyWithImpl<$Res> implements $SnAttachmentCopyWith<$Res> {
|
|||||||
? _self.poolId
|
? _self.poolId
|
||||||
: poolId // ignore: cast_nullable_to_non_nullable
|
: poolId // ignore: cast_nullable_to_non_nullable
|
||||||
as int?,
|
as int?,
|
||||||
|
account: freezed == account
|
||||||
|
? _self.account
|
||||||
|
: account // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnAccount?,
|
||||||
accountId: null == accountId
|
accountId: null == accountId
|
||||||
? _self.accountId
|
? _self.accountId
|
||||||
: accountId // ignore: cast_nullable_to_non_nullable
|
: accountId // ignore: cast_nullable_to_non_nullable
|
||||||
@ -401,6 +411,20 @@ class _$SnAttachmentCopyWithImpl<$Res> implements $SnAttachmentCopyWith<$Res> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a copy of SnAttachment
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnAccountCopyWith<$Res>? get account {
|
||||||
|
if (_self.account == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnAccountCopyWith<$Res>(_self.account!, (value) {
|
||||||
|
return _then(_self.copyWith(account: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Create a copy of SnAttachment
|
/// Create a copy of SnAttachment
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@ -457,6 +481,7 @@ class _SnAttachment extends SnAttachment {
|
|||||||
required this.refId,
|
required this.refId,
|
||||||
required this.pool,
|
required this.pool,
|
||||||
required this.poolId,
|
required this.poolId,
|
||||||
|
required this.account,
|
||||||
required this.accountId,
|
required this.accountId,
|
||||||
this.thumbnailId,
|
this.thumbnailId,
|
||||||
this.thumbnail,
|
this.thumbnail,
|
||||||
@ -521,6 +546,8 @@ class _SnAttachment extends SnAttachment {
|
|||||||
@override
|
@override
|
||||||
final int? poolId;
|
final int? poolId;
|
||||||
@override
|
@override
|
||||||
|
final SnAccount? account;
|
||||||
|
@override
|
||||||
final int accountId;
|
final int accountId;
|
||||||
@override
|
@override
|
||||||
final int? thumbnailId;
|
final int? thumbnailId;
|
||||||
@ -612,6 +639,7 @@ class _SnAttachment extends SnAttachment {
|
|||||||
(identical(other.refId, refId) || other.refId == refId) &&
|
(identical(other.refId, refId) || other.refId == refId) &&
|
||||||
(identical(other.pool, pool) || other.pool == pool) &&
|
(identical(other.pool, pool) || other.pool == pool) &&
|
||||||
(identical(other.poolId, poolId) || other.poolId == poolId) &&
|
(identical(other.poolId, poolId) || other.poolId == poolId) &&
|
||||||
|
(identical(other.account, account) || other.account == account) &&
|
||||||
(identical(other.accountId, accountId) ||
|
(identical(other.accountId, accountId) ||
|
||||||
other.accountId == accountId) &&
|
other.accountId == accountId) &&
|
||||||
(identical(other.thumbnailId, thumbnailId) ||
|
(identical(other.thumbnailId, thumbnailId) ||
|
||||||
@ -654,6 +682,7 @@ class _SnAttachment extends SnAttachment {
|
|||||||
refId,
|
refId,
|
||||||
pool,
|
pool,
|
||||||
poolId,
|
poolId,
|
||||||
|
account,
|
||||||
accountId,
|
accountId,
|
||||||
thumbnailId,
|
thumbnailId,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
@ -666,7 +695,7 @@ class _SnAttachment extends SnAttachment {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnAttachment(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, rid: $rid, uuid: $uuid, size: $size, name: $name, alt: $alt, mimetype: $mimetype, hash: $hash, destination: $destination, refCount: $refCount, contentRating: $contentRating, qualityRating: $qualityRating, cleanedAt: $cleanedAt, isAnalyzed: $isAnalyzed, isSelfRef: $isSelfRef, isIndexable: $isIndexable, ref: $ref, refId: $refId, pool: $pool, poolId: $poolId, accountId: $accountId, thumbnailId: $thumbnailId, thumbnail: $thumbnail, compressedId: $compressedId, compressed: $compressed, boosts: $boosts, usermeta: $usermeta, metadata: $metadata)';
|
return 'SnAttachment(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, rid: $rid, uuid: $uuid, size: $size, name: $name, alt: $alt, mimetype: $mimetype, hash: $hash, destination: $destination, refCount: $refCount, contentRating: $contentRating, qualityRating: $qualityRating, cleanedAt: $cleanedAt, isAnalyzed: $isAnalyzed, isSelfRef: $isSelfRef, isIndexable: $isIndexable, ref: $ref, refId: $refId, pool: $pool, poolId: $poolId, account: $account, accountId: $accountId, thumbnailId: $thumbnailId, thumbnail: $thumbnail, compressedId: $compressedId, compressed: $compressed, boosts: $boosts, usermeta: $usermeta, metadata: $metadata)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,6 +731,7 @@ abstract mixin class _$SnAttachmentCopyWith<$Res>
|
|||||||
int? refId,
|
int? refId,
|
||||||
SnAttachmentPool? pool,
|
SnAttachmentPool? pool,
|
||||||
int? poolId,
|
int? poolId,
|
||||||
|
SnAccount? account,
|
||||||
int accountId,
|
int accountId,
|
||||||
int? thumbnailId,
|
int? thumbnailId,
|
||||||
SnAttachment? thumbnail,
|
SnAttachment? thumbnail,
|
||||||
@ -716,6 +746,8 @@ abstract mixin class _$SnAttachmentCopyWith<$Res>
|
|||||||
@override
|
@override
|
||||||
$SnAttachmentPoolCopyWith<$Res>? get pool;
|
$SnAttachmentPoolCopyWith<$Res>? get pool;
|
||||||
@override
|
@override
|
||||||
|
$SnAccountCopyWith<$Res>? get account;
|
||||||
|
@override
|
||||||
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
||||||
@override
|
@override
|
||||||
$SnAttachmentCopyWith<$Res>? get compressed;
|
$SnAttachmentCopyWith<$Res>? get compressed;
|
||||||
@ -757,6 +789,7 @@ class __$SnAttachmentCopyWithImpl<$Res>
|
|||||||
Object? refId = freezed,
|
Object? refId = freezed,
|
||||||
Object? pool = freezed,
|
Object? pool = freezed,
|
||||||
Object? poolId = freezed,
|
Object? poolId = freezed,
|
||||||
|
Object? account = freezed,
|
||||||
Object? accountId = null,
|
Object? accountId = null,
|
||||||
Object? thumbnailId = freezed,
|
Object? thumbnailId = freezed,
|
||||||
Object? thumbnail = freezed,
|
Object? thumbnail = freezed,
|
||||||
@ -859,6 +892,10 @@ class __$SnAttachmentCopyWithImpl<$Res>
|
|||||||
? _self.poolId
|
? _self.poolId
|
||||||
: poolId // ignore: cast_nullable_to_non_nullable
|
: poolId // ignore: cast_nullable_to_non_nullable
|
||||||
as int?,
|
as int?,
|
||||||
|
account: freezed == account
|
||||||
|
? _self.account
|
||||||
|
: account // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnAccount?,
|
||||||
accountId: null == accountId
|
accountId: null == accountId
|
||||||
? _self.accountId
|
? _self.accountId
|
||||||
: accountId // ignore: cast_nullable_to_non_nullable
|
: accountId // ignore: cast_nullable_to_non_nullable
|
||||||
@ -922,6 +959,20 @@ class __$SnAttachmentCopyWithImpl<$Res>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a copy of SnAttachment
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnAccountCopyWith<$Res>? get account {
|
||||||
|
if (_self.account == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnAccountCopyWith<$Res>(_self.account!, (value) {
|
||||||
|
return _then(_self.copyWith(account: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Create a copy of SnAttachment
|
/// Create a copy of SnAttachment
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
|
@ -39,6 +39,9 @@ _SnAttachment _$SnAttachmentFromJson(Map<String, dynamic> json) =>
|
|||||||
? null
|
? null
|
||||||
: SnAttachmentPool.fromJson(json['pool'] as Map<String, dynamic>),
|
: SnAttachmentPool.fromJson(json['pool'] as Map<String, dynamic>),
|
||||||
poolId: (json['pool_id'] as num?)?.toInt(),
|
poolId: (json['pool_id'] as num?)?.toInt(),
|
||||||
|
account: json['account'] == null
|
||||||
|
? null
|
||||||
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
accountId: (json['account_id'] as num).toInt(),
|
accountId: (json['account_id'] as num).toInt(),
|
||||||
thumbnailId: (json['thumbnail_id'] as num?)?.toInt(),
|
thumbnailId: (json['thumbnail_id'] as num?)?.toInt(),
|
||||||
thumbnail: json['thumbnail'] == null
|
thumbnail: json['thumbnail'] == null
|
||||||
@ -82,6 +85,7 @@ Map<String, dynamic> _$SnAttachmentToJson(_SnAttachment instance) =>
|
|||||||
'ref_id': instance.refId,
|
'ref_id': instance.refId,
|
||||||
'pool': instance.pool?.toJson(),
|
'pool': instance.pool?.toJson(),
|
||||||
'pool_id': instance.poolId,
|
'pool_id': instance.poolId,
|
||||||
|
'account': instance.account?.toJson(),
|
||||||
'account_id': instance.accountId,
|
'account_id': instance.accountId,
|
||||||
'thumbnail_id': instance.thumbnailId,
|
'thumbnail_id': instance.thumbnailId,
|
||||||
'thumbnail': instance.thumbnail?.toJson(),
|
'thumbnail': instance.thumbnail?.toJson(),
|
||||||
|
@ -17,4 +17,5 @@ const Map<String, ReactInfo> kTemplateReactions = {
|
|||||||
'party': ReactInfo(icon: '🎉', attitude: 1),
|
'party': ReactInfo(icon: '🎉', attitude: 1),
|
||||||
'joy': ReactInfo(icon: '🤣', attitude: 1),
|
'joy': ReactInfo(icon: '🤣', attitude: 1),
|
||||||
'pray': ReactInfo(icon: '🙏', attitude: 1),
|
'pray': ReactInfo(icon: '🙏', attitude: 1),
|
||||||
|
'heart': ReactInfo(icon: '❤️', attitude: 1),
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,6 @@ import 'package:photo_view/photo_view_gallery.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/providers/user_directory.dart';
|
|
||||||
import 'package:surface/types/attachment.dart';
|
import 'package:surface/types/attachment.dart';
|
||||||
import 'package:surface/widgets/account/account_image.dart';
|
import 'package:surface/widgets/account/account_image.dart';
|
||||||
import 'package:surface/widgets/dialog.dart';
|
import 'package:surface/widgets/dialog.dart';
|
||||||
@ -418,8 +417,7 @@ class _AttachmentZoomDetailPopup extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ud = context.read<UserDirectoryProvider>();
|
final account = data.account!;
|
||||||
final account = ud.getFromCache(data.accountId);
|
|
||||||
|
|
||||||
const tableGap = TableRow(
|
const tableGap = TableRow(
|
||||||
children: [
|
children: [
|
||||||
@ -461,12 +459,12 @@ class _AttachmentZoomDetailPopup extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (data.accountId > 0)
|
if (data.accountId > 0)
|
||||||
AccountImage(
|
AccountImage(
|
||||||
content: account?.avatar,
|
content: account.avatar,
|
||||||
radius: 8,
|
radius: 8,
|
||||||
),
|
),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
Text(data.accountId > 0
|
Text(data.accountId > 0
|
||||||
? account?.nick ?? 'unknown'.tr()
|
? account.nick
|
||||||
: 'unknown'.tr()),
|
: 'unknown'.tr()),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
Text('#${data.accountId}',
|
Text('#${data.accountId}',
|
||||||
|
@ -179,57 +179,54 @@ class _PostCommentListPopupState extends State<PostCommentListPopup> {
|
|||||||
final ua = context.watch<UserProvider>();
|
final ua = context.watch<UserProvider>();
|
||||||
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||||
|
|
||||||
return SizedBox(
|
return Column(
|
||||||
height: MediaQuery.of(context).size.height * 0.85,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
Row(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
const Icon(Symbols.comment, size: 24),
|
||||||
children: [
|
const Gap(16),
|
||||||
const Icon(Symbols.comment, size: 24),
|
Text('postCommentsDetailed')
|
||||||
const Gap(16),
|
.plural(widget.commentCount)
|
||||||
Text('postCommentsDetailed')
|
.textStyle(Theme.of(context).textTheme.titleLarge!),
|
||||||
.plural(widget.commentCount)
|
],
|
||||||
.textStyle(Theme.of(context).textTheme.titleLarge!),
|
).padding(horizontal: 20, top: 16, bottom: 12),
|
||||||
],
|
Expanded(
|
||||||
).padding(horizontal: 20, top: 16, bottom: 12),
|
child: CustomScrollView(
|
||||||
Expanded(
|
slivers: [
|
||||||
child: CustomScrollView(
|
if (ua.isAuthorized)
|
||||||
slivers: [
|
SliverToBoxAdapter(
|
||||||
if (ua.isAuthorized)
|
child: Container(
|
||||||
SliverToBoxAdapter(
|
margin: const EdgeInsets.only(bottom: 8),
|
||||||
child: Container(
|
height: 240,
|
||||||
margin: const EdgeInsets.only(bottom: 8),
|
decoration: BoxDecoration(
|
||||||
height: 240,
|
border: Border.symmetric(
|
||||||
decoration: BoxDecoration(
|
horizontal: BorderSide(
|
||||||
border: Border.symmetric(
|
color: Theme.of(context).dividerColor,
|
||||||
horizontal: BorderSide(
|
width: 1 / devicePixelRatio,
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1 / devicePixelRatio,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: PostMiniEditor(
|
),
|
||||||
postReplyId: widget.post.id,
|
child: PostMiniEditor(
|
||||||
onPost: () {
|
postReplyId: widget.post.id,
|
||||||
_childListKey.currentState!.refresh();
|
onPost: () {
|
||||||
},
|
_childListKey.currentState!.refresh();
|
||||||
onExpand: () {
|
},
|
||||||
Navigator.pop(context);
|
onExpand: () {
|
||||||
},
|
Navigator.pop(context);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PostCommentSliverList(
|
|
||||||
parentPost: widget.post,
|
|
||||||
key: _childListKey,
|
|
||||||
),
|
),
|
||||||
],
|
PostCommentSliverList(
|
||||||
),
|
parentPost: widget.post,
|
||||||
|
key: _childListKey,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2056,8 +2056,6 @@ class _PostFeaturedCommentState extends State<_PostFeaturedComment> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: true,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (context) => PostCommentListPopup(
|
builder: (context) => PostCommentListPopup(
|
||||||
post: widget.data,
|
post: widget.data,
|
||||||
commentCount: widget.data.metric.replyCount,
|
commentCount: widget.data.metric.replyCount,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user