🎨 Fix most of linting notes
This commit is contained in:
parent
7656c08832
commit
ee7d0ddd25
@ -217,15 +217,17 @@ class SnAttachmentProvider {
|
||||
}
|
||||
|
||||
Future<SnAttachment> updateOne(
|
||||
int id,
|
||||
String alt, {
|
||||
required Map<String, dynamic> metadata,
|
||||
bool isMature = false,
|
||||
int id, {
|
||||
String? alt,
|
||||
String? thumbnail,
|
||||
Map<String, dynamic>? metadata,
|
||||
bool? isIndexable,
|
||||
}) async {
|
||||
final resp = await _sn.client.put('/cgi/uc/attachments/$id', data: {
|
||||
'alt': alt,
|
||||
'thumbnail': thumbnail,
|
||||
'metadata': metadata,
|
||||
'is_mature': isMature,
|
||||
'is_indexable': isIndexable,
|
||||
});
|
||||
return SnAttachment.fromJson(resp.data);
|
||||
}
|
||||
|
@ -22,15 +22,14 @@ import 'package:surface/widgets/universal_image.dart';
|
||||
|
||||
class AccountPublisherEditScreen extends StatefulWidget {
|
||||
final String name;
|
||||
|
||||
const AccountPublisherEditScreen({super.key, required this.name});
|
||||
|
||||
@override
|
||||
State<AccountPublisherEditScreen> createState() =>
|
||||
_AccountPublisherEditScreenState();
|
||||
State<AccountPublisherEditScreen> createState() => _AccountPublisherEditScreenState();
|
||||
}
|
||||
|
||||
class _AccountPublisherEditScreenState
|
||||
extends State<AccountPublisherEditScreen> {
|
||||
class _AccountPublisherEditScreenState extends State<AccountPublisherEditScreen> {
|
||||
bool _isBusy = false;
|
||||
|
||||
SnPublisher? _publisher;
|
||||
@ -54,7 +53,7 @@ class _AccountPublisherEditScreenState
|
||||
_publisher = SnPublisher.fromJson(resp.data);
|
||||
_syncWidget();
|
||||
} catch (err) {
|
||||
context.showErrorDialog(err);
|
||||
if (mounted) context.showErrorDialog(err);
|
||||
} finally {
|
||||
setState(() => _isBusy = false);
|
||||
}
|
||||
@ -75,9 +74,9 @@ class _AccountPublisherEditScreenState
|
||||
'name': _nameController.text,
|
||||
'description': _descriptionController.text,
|
||||
});
|
||||
Navigator.pop(context, true);
|
||||
if (mounted) Navigator.pop(context, true);
|
||||
} catch (err) {
|
||||
context.showErrorDialog(err);
|
||||
if(mounted) context.showErrorDialog(err);
|
||||
} finally {
|
||||
setState(() => _isBusy = false);
|
||||
}
|
||||
@ -108,11 +107,9 @@ class _AccountPublisherEditScreenState
|
||||
if (image == null) return;
|
||||
if (!mounted) return;
|
||||
|
||||
final ImageProvider imageProvider =
|
||||
kIsWeb ? NetworkImage(image.path) : FileImage(File(image.path));
|
||||
final aspectRatios = place == 'banner'
|
||||
? [CropAspectRatio(width: 16, height: 7)]
|
||||
: [CropAspectRatio(width: 1, height: 1)];
|
||||
final ImageProvider imageProvider = kIsWeb ? NetworkImage(image.path) : FileImage(File(image.path));
|
||||
final aspectRatios =
|
||||
place == 'banner' ? [CropAspectRatio(width: 16, height: 7)] : [CropAspectRatio(width: 1, height: 1)];
|
||||
final result = (!kIsWeb && (Platform.isIOS || Platform.isMacOS))
|
||||
? await showCupertinoImageCropper(
|
||||
// ignore: use_build_context_synchronously
|
||||
@ -134,10 +131,7 @@ class _AccountPublisherEditScreenState
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
final rawBytes =
|
||||
(await result.uiImage.toByteData(format: ImageByteFormat.png))!
|
||||
.buffer
|
||||
.asUint8List();
|
||||
final rawBytes = (await result.uiImage.toByteData(format: ImageByteFormat.png))!.buffer.asUint8List();
|
||||
|
||||
try {
|
||||
final attachment = await attach.directUploadOne(
|
||||
@ -199,9 +193,7 @@ class _AccountPublisherEditScreenState
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: Container(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.surfaceContainerHigh,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
child: _banner != null
|
||||
? AutoResizeUniversalImage(
|
||||
sn.getAttachmentUrl(_banner!),
|
||||
@ -240,8 +232,7 @@ class _AccountPublisherEditScreenState
|
||||
labelText: 'fieldUsername'.tr(),
|
||||
helperText: 'fieldUsernameCannotEditHint'.tr(),
|
||||
),
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
),
|
||||
const Gap(4),
|
||||
TextField(
|
||||
@ -249,8 +240,7 @@ class _AccountPublisherEditScreenState
|
||||
decoration: InputDecoration(
|
||||
labelText: 'fieldNickname'.tr(),
|
||||
),
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
),
|
||||
const Gap(4),
|
||||
TextField(
|
||||
@ -260,8 +250,7 @@ class _AccountPublisherEditScreenState
|
||||
decoration: InputDecoration(
|
||||
labelText: 'fieldDescription'.tr(),
|
||||
),
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
),
|
||||
const Gap(12),
|
||||
Row(
|
||||
|
@ -201,7 +201,7 @@ class _PublisherNewPersonalState extends State<_PublisherNewPersonal> {
|
||||
}
|
||||
|
||||
class _PublisherNewOrganization extends StatefulWidget {
|
||||
const _PublisherNewOrganization({super.key});
|
||||
const _PublisherNewOrganization();
|
||||
|
||||
@override
|
||||
State<_PublisherNewOrganization> createState() =>
|
||||
|
@ -105,6 +105,7 @@ class _LoginCheckScreen extends StatefulWidget {
|
||||
final SnAuthFactor? factor;
|
||||
final Function(SnAuthTicket?) onTicket;
|
||||
final Function onNext;
|
||||
|
||||
const _LoginCheckScreen({
|
||||
super.key,
|
||||
required this.ticket,
|
||||
@ -204,9 +205,7 @@ class _LoginCheckScreenState extends State<_LoginCheckScreen> {
|
||||
controller: _passwordController,
|
||||
obscureText: true,
|
||||
autofillHints: [
|
||||
(_factorLabelMap[widget.factor!.type]?.$3 ?? true)
|
||||
? AutofillHints.password
|
||||
: AutofillHints.oneTimeCode
|
||||
(_factorLabelMap[widget.factor!.type]?.$3 ?? true) ? AutofillHints.password : AutofillHints.oneTimeCode
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
@ -243,6 +242,7 @@ class _LoginPickerScreen extends StatefulWidget {
|
||||
final Function(SnAuthTicket?) onTicket;
|
||||
final Function(SnAuthFactor) onPickFactor;
|
||||
final Function onNext;
|
||||
|
||||
const _LoginPickerScreen({
|
||||
super.key,
|
||||
required this.ticket,
|
||||
@ -260,8 +260,7 @@ class _LoginPickerScreenState extends State<_LoginPickerScreen> {
|
||||
bool _isBusy = false;
|
||||
int? _factorPicked;
|
||||
|
||||
Color get _unFocusColor =>
|
||||
Theme.of(context).colorScheme.onSurface.withAlpha((255 * 0.75).round());
|
||||
Color get _unFocusColor => Theme.of(context).colorScheme.onSurface.withAlpha((255 * 0.75).round());
|
||||
|
||||
void _performGetFactorCode() async {
|
||||
if (_factorPicked == null) return;
|
||||
@ -373,6 +372,7 @@ class _LoginLookupScreen extends StatefulWidget {
|
||||
final Function(SnAuthTicket?) onTicket;
|
||||
final Function(List<SnAuthFactor>?) onFactor;
|
||||
final Function onNext;
|
||||
|
||||
const _LoginLookupScreen({
|
||||
super.key,
|
||||
required this.ticket,
|
||||
@ -401,14 +401,13 @@ class _LoginLookupScreenState extends State<_LoginLookupScreen> {
|
||||
|
||||
try {
|
||||
final sn = context.read<SnNetworkProvider>();
|
||||
final lookupResp =
|
||||
await sn.client.get('/cgi/id/users/lookup?probe=$username');
|
||||
final lookupResp = await sn.client.get('/cgi/id/users/lookup?probe=$username');
|
||||
await sn.client.post('/cgi/id/users/me/password-reset', data: {
|
||||
'user_id': lookupResp.data['id'],
|
||||
});
|
||||
context.showModalDialog('done'.tr(), 'signinResetPasswordSent'.tr());
|
||||
if (mounted) context.showModalDialog('done'.tr(), 'signinResetPasswordSent'.tr());
|
||||
} catch (err) {
|
||||
context.showErrorDialog(err);
|
||||
if (mounted) context.showErrorDialog(err);
|
||||
} finally {
|
||||
setState(() => _isBusy = false);
|
||||
}
|
||||
@ -431,8 +430,7 @@ class _LoginLookupScreenState extends State<_LoginLookupScreen> {
|
||||
widget.onTicket(result.ticket);
|
||||
|
||||
// Pull factors
|
||||
final factorResp =
|
||||
await sn.client.get('/cgi/id/auth/factors', queryParameters: {
|
||||
final factorResp = await sn.client.get('/cgi/id/auth/factors', queryParameters: {
|
||||
'ticketId': result.ticket!.id.toString(),
|
||||
});
|
||||
widget.onFactor(
|
||||
@ -443,7 +441,7 @@ class _LoginLookupScreenState extends State<_LoginLookupScreen> {
|
||||
|
||||
widget.onNext();
|
||||
} catch (err) {
|
||||
context.showErrorDialog(err);
|
||||
if(mounted) context.showErrorDialog(err);
|
||||
return;
|
||||
} finally {
|
||||
setState(() => _isBusy = false);
|
||||
@ -526,10 +524,7 @@ class _LoginLookupScreenState extends State<_LoginLookupScreen> {
|
||||
'termAcceptNextWithAgree'.tr(),
|
||||
textAlign: TextAlign.end,
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurface
|
||||
.withAlpha((255 * 0.75).round()),
|
||||
color: Theme.of(context).colorScheme.onSurface.withAlpha((255 * 0.75).round()),
|
||||
),
|
||||
),
|
||||
Material(
|
||||
|
@ -443,7 +443,7 @@ class _ChannelProfileDetailDialogState
|
||||
|
||||
class _ChannelMemberListWidget extends StatefulWidget {
|
||||
final SnChannel channel;
|
||||
const _ChannelMemberListWidget({super.key, required this.channel});
|
||||
const _ChannelMemberListWidget({required this.channel});
|
||||
|
||||
@override
|
||||
State<_ChannelMemberListWidget> createState() =>
|
||||
@ -580,7 +580,7 @@ class _ChannelMemberListWidgetState extends State<_ChannelMemberListWidget> {
|
||||
|
||||
class _NewChannelMemberWidget extends StatefulWidget {
|
||||
final SnChannel channel;
|
||||
const _NewChannelMemberWidget({super.key, required this.channel});
|
||||
const _NewChannelMemberWidget({required this.channel});
|
||||
|
||||
@override
|
||||
State<_NewChannelMemberWidget> createState() =>
|
||||
|
@ -97,7 +97,6 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
|
||||
}
|
||||
} catch (err) {
|
||||
if (!mounted) return;
|
||||
print((err as DioException).response?.data);
|
||||
context.showErrorDialog(err);
|
||||
} finally {
|
||||
setState(() => _isCalling = false);
|
||||
|
@ -289,7 +289,7 @@ class _FriendScreenState extends State<FriendScreen> {
|
||||
}
|
||||
|
||||
class _NewFriendWidget extends StatefulWidget {
|
||||
const _NewFriendWidget({super.key});
|
||||
const _NewFriendWidget();
|
||||
|
||||
@override
|
||||
State<_NewFriendWidget> createState() => _NewFriendWidgetState();
|
||||
@ -365,7 +365,7 @@ class _NewFriendWidgetState extends State<_NewFriendWidget> {
|
||||
|
||||
class _FriendshipListWidget extends StatefulWidget {
|
||||
final List<SnRelationship> relations;
|
||||
const _FriendshipListWidget({super.key, required this.relations});
|
||||
const _FriendshipListWidget({required this.relations});
|
||||
|
||||
@override
|
||||
State<_FriendshipListWidget> createState() => _FriendshipListWidgetState();
|
||||
|
@ -109,7 +109,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
class _HomeDashUpdateWidget extends StatelessWidget {
|
||||
final EdgeInsets? padding;
|
||||
|
||||
const _HomeDashUpdateWidget({super.key, this.padding});
|
||||
const _HomeDashUpdateWidget({this.padding});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -153,7 +153,7 @@ class _HomeDashUpdateWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _HomeDashSpecialDayWidget extends StatelessWidget {
|
||||
const _HomeDashSpecialDayWidget({super.key});
|
||||
const _HomeDashSpecialDayWidget();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -215,7 +215,7 @@ class _HomeDashSpecialDayWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _HomeDashCheckInWidget extends StatefulWidget {
|
||||
const _HomeDashCheckInWidget({super.key});
|
||||
const _HomeDashCheckInWidget();
|
||||
|
||||
@override
|
||||
State<_HomeDashCheckInWidget> createState() => _HomeDashCheckInWidgetState();
|
||||
@ -433,7 +433,7 @@ class _HomeDashCheckInWidgetState extends State<_HomeDashCheckInWidget> {
|
||||
}
|
||||
|
||||
class _HomeDashNotificationWidget extends StatefulWidget {
|
||||
const _HomeDashNotificationWidget({super.key});
|
||||
const _HomeDashNotificationWidget();
|
||||
|
||||
@override
|
||||
State<_HomeDashNotificationWidget> createState() => _HomeDashNotificationWidgetState();
|
||||
@ -504,7 +504,7 @@ class _HomeDashNotificationWidgetState extends State<_HomeDashNotificationWidget
|
||||
}
|
||||
|
||||
class _HomeDashRecommendationPostWidget extends StatefulWidget {
|
||||
const _HomeDashRecommendationPostWidget({super.key});
|
||||
const _HomeDashRecommendationPostWidget();
|
||||
|
||||
@override
|
||||
State<_HomeDashRecommendationPostWidget> createState() => _HomeDashRecommendationPostWidgetState();
|
||||
|
@ -580,7 +580,6 @@ class _PublisherPostList extends StatelessWidget {
|
||||
final void Function() onDeleted;
|
||||
|
||||
const _PublisherPostList({
|
||||
super.key,
|
||||
required this.isBusy,
|
||||
required this.postCount,
|
||||
required this.posts,
|
||||
|
@ -119,7 +119,7 @@ class _RealmDetailHomeWidget extends StatelessWidget {
|
||||
final SnRealm? realm;
|
||||
final List<SnPublisher>? publishers;
|
||||
|
||||
const _RealmDetailHomeWidget({super.key, required this.realm, this.publishers});
|
||||
const _RealmDetailHomeWidget({required this.realm, this.publishers});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -175,7 +175,7 @@ class _RealmDetailHomeWidget extends StatelessWidget {
|
||||
class _RealmMemberListWidget extends StatefulWidget {
|
||||
final SnRealm? realm;
|
||||
|
||||
const _RealmMemberListWidget({super.key, this.realm});
|
||||
const _RealmMemberListWidget({this.realm});
|
||||
|
||||
@override
|
||||
State<_RealmMemberListWidget> createState() => _RealmMemberListWidgetState();
|
||||
@ -304,7 +304,7 @@ class _RealmMemberListWidgetState extends State<_RealmMemberListWidget> {
|
||||
class _NewRealmMemberWidget extends StatefulWidget {
|
||||
final SnRealm realm;
|
||||
|
||||
const _NewRealmMemberWidget({super.key, required this.realm});
|
||||
const _NewRealmMemberWidget({required this.realm});
|
||||
|
||||
@override
|
||||
State<_NewRealmMemberWidget> createState() => _NewRealmMemberWidgetState();
|
||||
@ -384,7 +384,7 @@ class _RealmSettingsWidget extends StatefulWidget {
|
||||
final SnRealm? realm;
|
||||
final Function() onUpdate;
|
||||
|
||||
const _RealmSettingsWidget({super.key, required this.realm, required this.onUpdate});
|
||||
const _RealmSettingsWidget({required this.realm, required this.onUpdate});
|
||||
|
||||
@override
|
||||
State<_RealmSettingsWidget> createState() => _RealmSettingsWidgetState();
|
||||
|
@ -43,6 +43,7 @@ class SnAttachment with _$SnAttachment {
|
||||
required int accountId,
|
||||
@Default({}) Map<String, dynamic> usermeta,
|
||||
@Default({}) Map<String, dynamic> metadata,
|
||||
String? thumbnail,
|
||||
}) = _SnAttachment;
|
||||
|
||||
factory SnAttachment.fromJson(Map<String, Object?> json) => _$SnAttachmentFromJson(json);
|
||||
|
@ -47,6 +47,7 @@ mixin _$SnAttachment {
|
||||
int get accountId => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic> get usermeta => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic> get metadata => throw _privateConstructorUsedError;
|
||||
String? get thumbnail => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this SnAttachment to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@ -91,7 +92,8 @@ abstract class $SnAttachmentCopyWith<$Res> {
|
||||
int poolId,
|
||||
int accountId,
|
||||
Map<String, dynamic> usermeta,
|
||||
Map<String, dynamic> metadata});
|
||||
Map<String, dynamic> metadata,
|
||||
String? thumbnail});
|
||||
|
||||
$SnAttachmentPoolCopyWith<$Res>? get pool;
|
||||
}
|
||||
@ -138,6 +140,7 @@ class _$SnAttachmentCopyWithImpl<$Res, $Val extends SnAttachment>
|
||||
Object? accountId = null,
|
||||
Object? usermeta = null,
|
||||
Object? metadata = null,
|
||||
Object? thumbnail = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
@ -248,6 +251,10 @@ class _$SnAttachmentCopyWithImpl<$Res, $Val extends SnAttachment>
|
||||
? _value.metadata
|
||||
: metadata // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>,
|
||||
thumbnail: freezed == thumbnail
|
||||
? _value.thumbnail
|
||||
: thumbnail // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@ -301,7 +308,8 @@ abstract class _$$SnAttachmentImplCopyWith<$Res>
|
||||
int poolId,
|
||||
int accountId,
|
||||
Map<String, dynamic> usermeta,
|
||||
Map<String, dynamic> metadata});
|
||||
Map<String, dynamic> metadata,
|
||||
String? thumbnail});
|
||||
|
||||
@override
|
||||
$SnAttachmentPoolCopyWith<$Res>? get pool;
|
||||
@ -347,6 +355,7 @@ class __$$SnAttachmentImplCopyWithImpl<$Res>
|
||||
Object? accountId = null,
|
||||
Object? usermeta = null,
|
||||
Object? metadata = null,
|
||||
Object? thumbnail = freezed,
|
||||
}) {
|
||||
return _then(_$SnAttachmentImpl(
|
||||
id: null == id
|
||||
@ -457,6 +466,10 @@ class __$$SnAttachmentImplCopyWithImpl<$Res>
|
||||
? _value._metadata
|
||||
: metadata // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>,
|
||||
thumbnail: freezed == thumbnail
|
||||
? _value.thumbnail
|
||||
: thumbnail // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -491,7 +504,8 @@ class _$SnAttachmentImpl extends _SnAttachment {
|
||||
required this.poolId,
|
||||
required this.accountId,
|
||||
final Map<String, dynamic> usermeta = const {},
|
||||
final Map<String, dynamic> metadata = const {}})
|
||||
final Map<String, dynamic> metadata = const {},
|
||||
this.thumbnail})
|
||||
: _usermeta = usermeta,
|
||||
_metadata = metadata,
|
||||
super._();
|
||||
@ -569,9 +583,12 @@ class _$SnAttachmentImpl extends _SnAttachment {
|
||||
return EqualUnmodifiableMapView(_metadata);
|
||||
}
|
||||
|
||||
@override
|
||||
final String? thumbnail;
|
||||
|
||||
@override
|
||||
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, fileChunks: $fileChunks, cleanedAt: $cleanedAt, isAnalyzed: $isAnalyzed, isUploaded: $isUploaded, isSelfRef: $isSelfRef, ref: $ref, refId: $refId, pool: $pool, poolId: $poolId, accountId: $accountId, 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, fileChunks: $fileChunks, cleanedAt: $cleanedAt, isAnalyzed: $isAnalyzed, isUploaded: $isUploaded, isSelfRef: $isSelfRef, ref: $ref, refId: $refId, pool: $pool, poolId: $poolId, accountId: $accountId, usermeta: $usermeta, metadata: $metadata, thumbnail: $thumbnail)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -617,7 +634,9 @@ class _$SnAttachmentImpl extends _SnAttachment {
|
||||
(identical(other.accountId, accountId) ||
|
||||
other.accountId == accountId) &&
|
||||
const DeepCollectionEquality().equals(other._usermeta, _usermeta) &&
|
||||
const DeepCollectionEquality().equals(other._metadata, _metadata));
|
||||
const DeepCollectionEquality().equals(other._metadata, _metadata) &&
|
||||
(identical(other.thumbnail, thumbnail) ||
|
||||
other.thumbnail == thumbnail));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@ -650,7 +669,8 @@ class _$SnAttachmentImpl extends _SnAttachment {
|
||||
poolId,
|
||||
accountId,
|
||||
const DeepCollectionEquality().hash(_usermeta),
|
||||
const DeepCollectionEquality().hash(_metadata)
|
||||
const DeepCollectionEquality().hash(_metadata),
|
||||
thumbnail
|
||||
]);
|
||||
|
||||
/// Create a copy of SnAttachment
|
||||
@ -697,7 +717,8 @@ abstract class _SnAttachment extends SnAttachment {
|
||||
required final int poolId,
|
||||
required final int accountId,
|
||||
final Map<String, dynamic> usermeta,
|
||||
final Map<String, dynamic> metadata}) = _$SnAttachmentImpl;
|
||||
final Map<String, dynamic> metadata,
|
||||
final String? thumbnail}) = _$SnAttachmentImpl;
|
||||
const _SnAttachment._() : super._();
|
||||
|
||||
factory _SnAttachment.fromJson(Map<String, dynamic> json) =
|
||||
@ -757,6 +778,8 @@ abstract class _SnAttachment extends SnAttachment {
|
||||
Map<String, dynamic> get usermeta;
|
||||
@override
|
||||
Map<String, dynamic> get metadata;
|
||||
@override
|
||||
String? get thumbnail;
|
||||
|
||||
/// Create a copy of SnAttachment
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
@ -37,6 +37,7 @@ _$SnAttachmentImpl _$$SnAttachmentImplFromJson(Map<String, dynamic> json) =>
|
||||
accountId: (json['account_id'] as num).toInt(),
|
||||
usermeta: json['usermeta'] as Map<String, dynamic>? ?? const {},
|
||||
metadata: json['metadata'] as Map<String, dynamic>? ?? const {},
|
||||
thumbnail: json['thumbnail'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SnAttachmentImplToJson(_$SnAttachmentImpl instance) =>
|
||||
@ -68,6 +69,7 @@ Map<String, dynamic> _$$SnAttachmentImplToJson(_$SnAttachmentImpl instance) =>
|
||||
'account_id': instance.accountId,
|
||||
'usermeta': instance.usermeta,
|
||||
'metadata': instance.metadata,
|
||||
'thumbnail': instance.thumbnail,
|
||||
};
|
||||
|
||||
_$SnAttachmentPoolImpl _$$SnAttachmentPoolImplFromJson(
|
||||
|
@ -32,7 +32,7 @@ class _AccountSelectState extends State<AccountSelect> {
|
||||
final List<SnAccount> _pendingUsers = List.empty(growable: true);
|
||||
final List<SnAccount> _selectedUsers = List.empty(growable: true);
|
||||
|
||||
int _accountId = 0;
|
||||
final int _accountId = 0;
|
||||
|
||||
Future<void> _revertSelectedUsers() async {
|
||||
if (widget.initialSelection?.isEmpty ?? true) return;
|
||||
|
@ -80,7 +80,7 @@ class _AttachmentItemSensitiveBlur extends StatefulWidget {
|
||||
final Widget child;
|
||||
final bool isCompact;
|
||||
|
||||
const _AttachmentItemSensitiveBlur({super.key, required this.child, this.isCompact = false});
|
||||
const _AttachmentItemSensitiveBlur({required this.child, this.isCompact = false});
|
||||
|
||||
@override
|
||||
State<_AttachmentItemSensitiveBlur> createState() => _AttachmentItemSensitiveBlurState();
|
||||
@ -166,7 +166,6 @@ class _AttachmentItemContentVideo extends StatefulWidget {
|
||||
final bool isAutoload;
|
||||
|
||||
const _AttachmentItemContentVideo({
|
||||
super.key,
|
||||
required this.data,
|
||||
this.isAutoload = false,
|
||||
});
|
||||
@ -207,7 +206,7 @@ class _AttachmentItemContentVideoState extends State<_AttachmentItemContentVideo
|
||||
),
|
||||
];
|
||||
|
||||
final ratio = widget.data.metadata['ratio'] ?? 16 / 9;
|
||||
final ratio = widget.data.data['ratio'] ?? 16 / 9;
|
||||
|
||||
final sn = context.read<SnNetworkProvider>();
|
||||
|
||||
@ -216,9 +215,9 @@ class _AttachmentItemContentVideoState extends State<_AttachmentItemContentVideo
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (widget.data.metadata['thumbnail'] != null)
|
||||
if (widget.data.thumbnail != null)
|
||||
AutoResizeUniversalImage(
|
||||
sn.getAttachmentUrl(widget.data.metadata['thumbnail']),
|
||||
sn.getAttachmentUrl(widget.data.thumbnail!),
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
else
|
||||
@ -266,7 +265,7 @@ class _AttachmentItemContentVideoState extends State<_AttachmentItemContentVideo
|
||||
),
|
||||
Text(
|
||||
Duration(
|
||||
milliseconds: (widget.data.metadata['duration'] ?? 0).toInt() * 1000,
|
||||
milliseconds: (widget.data.data['duration'] ?? 0).toInt() * 1000,
|
||||
).toString(),
|
||||
style: GoogleFonts.robotoMono(
|
||||
fontSize: 12,
|
||||
@ -316,7 +315,6 @@ class _AttachmentItemContentAudio extends StatefulWidget {
|
||||
final bool isAutoload;
|
||||
|
||||
const _AttachmentItemContentAudio({
|
||||
super.key,
|
||||
required this.data,
|
||||
this.isAutoload = false,
|
||||
});
|
||||
@ -374,11 +372,11 @@ class _AttachmentItemContentAudioState extends State<_AttachmentItemContentAudio
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (widget.data.metadata['thumbnail'] != null)
|
||||
if (widget.data.thumbnail != null)
|
||||
AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: AutoResizeUniversalImage(
|
||||
sn.getAttachmentUrl(widget.data.metadata['thumbnail']),
|
||||
sn.getAttachmentUrl(widget.data.data['thumbnail']),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)
|
||||
@ -459,11 +457,11 @@ class _AttachmentItemContentAudioState extends State<_AttachmentItemContentAudio
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
if (widget.data.metadata['thumbnail'] != null)
|
||||
if (widget.data.data['thumbnail'] != null)
|
||||
AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: AutoResizeUniversalImage(
|
||||
sn.getAttachmentUrl(widget.data.metadata['thumbnail']),
|
||||
sn.getAttachmentUrl(widget.data.data['thumbnail']),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
|
@ -174,7 +174,7 @@ class ChatMessage extends StatelessWidget {
|
||||
class _ChatMessageText extends StatelessWidget {
|
||||
final SnChatMessage data;
|
||||
|
||||
const _ChatMessageText({super.key, required this.data});
|
||||
const _ChatMessageText({required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -214,7 +214,7 @@ class _ChatMessageText extends StatelessWidget {
|
||||
class _ChatMessageSystemNotify extends StatelessWidget {
|
||||
final SnChatMessage data;
|
||||
|
||||
const _ChatMessageSystemNotify({super.key, required this.data});
|
||||
const _ChatMessageSystemNotify({required this.data});
|
||||
|
||||
String _formatDuration(Duration duration) {
|
||||
String negativeSign = duration.isNegative ? '-' : '';
|
||||
|
@ -60,7 +60,6 @@ class _LinkPreviewEntry extends StatelessWidget {
|
||||
final SnLinkMeta meta;
|
||||
|
||||
const _LinkPreviewEntry({
|
||||
super.key,
|
||||
required this.meta,
|
||||
});
|
||||
|
||||
|
@ -549,7 +549,6 @@ class _PostHeadline extends StatelessWidget {
|
||||
final bool isEnlarge;
|
||||
|
||||
const _PostHeadline({
|
||||
super.key,
|
||||
required this.data,
|
||||
this.isEnlarge = false,
|
||||
});
|
||||
@ -894,7 +893,6 @@ class _PostQuoteContent extends StatelessWidget {
|
||||
final bool isFlatted;
|
||||
|
||||
const _PostQuoteContent({
|
||||
super.key,
|
||||
this.isRelativeDate = true,
|
||||
this.isFlatted = false,
|
||||
required this.child,
|
||||
@ -962,7 +960,7 @@ class _PostQuoteContent extends StatelessWidget {
|
||||
class _PostTagsList extends StatelessWidget {
|
||||
final SnPost data;
|
||||
|
||||
const _PostTagsList({super.key, required this.data});
|
||||
const _PostTagsList({required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -1035,7 +1033,7 @@ class _PostTagsList extends StatelessWidget {
|
||||
class _PostVisibilityHint extends StatelessWidget {
|
||||
final SnPost data;
|
||||
|
||||
const _PostVisibilityHint({super.key, required this.data});
|
||||
const _PostVisibilityHint({required this.data});
|
||||
|
||||
static const List<IconData> kVisibilityIcons = [
|
||||
Symbols.public,
|
||||
@ -1060,7 +1058,7 @@ class _PostVisibilityHint extends StatelessWidget {
|
||||
class _PostTruncatedHint extends StatelessWidget {
|
||||
final SnPost data;
|
||||
|
||||
const _PostTruncatedHint({super.key, required this.data});
|
||||
const _PostTruncatedHint({required this.data});
|
||||
|
||||
static const int kHumanReadSpeed = 238;
|
||||
|
||||
@ -1102,7 +1100,7 @@ class _PostTruncatedHint extends StatelessWidget {
|
||||
class _PostAbuseReportDialog extends StatefulWidget {
|
||||
final SnPost data;
|
||||
|
||||
const _PostAbuseReportDialog({super.key, required this.data});
|
||||
const _PostAbuseReportDialog({required this.data});
|
||||
|
||||
@override
|
||||
State<_PostAbuseReportDialog> createState() => _PostAbuseReportDialogState();
|
||||
|
@ -96,10 +96,7 @@ class PostMediaPendingList extends StatelessWidget {
|
||||
if (!context.mounted) return;
|
||||
|
||||
final attach = context.read<SnAttachmentProvider>();
|
||||
final newAttach = await attach.updateOne(attachments[idx].attachment!.id, thumbnail.alt, metadata: {
|
||||
...attachments[idx].attachment!.metadata,
|
||||
'thumbnail': thumbnail.rid,
|
||||
});
|
||||
final newAttach = await attach.updateOne(attachments[idx].attachment!.id, thumbnail: thumbnail.rid);
|
||||
|
||||
onUpdate!(idx, PostWriteMedia(newAttach));
|
||||
}
|
||||
|
@ -763,13 +763,13 @@ packages:
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_webrtc:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_webrtc
|
||||
sha256: "0e138a0a3bf6830c29c8439b17be0e222d0de27fa72f24e6aee4d34de72f22ef"
|
||||
sha256: "3efe9828f19a07d29a51a726759ad0c70a840d231548a1c7d0332075a94db1df"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.5"
|
||||
version: "0.12.5+hotfix.1"
|
||||
freezed:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
@ -113,6 +113,7 @@ dependencies:
|
||||
version: ^3.0.2
|
||||
flutter_colorpicker: ^1.1.0
|
||||
fl_chart: ^0.70.0
|
||||
flutter_webrtc: ^0.12.5+hotfix.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
Reference in New Issue
Block a user