✨ User profile
This commit is contained in:
@ -21,7 +21,7 @@ import 'package:surface/screens/home.dart';
|
||||
import 'package:surface/screens/notification.dart';
|
||||
import 'package:surface/screens/post/post_detail.dart';
|
||||
import 'package:surface/screens/post/post_editor.dart';
|
||||
import 'package:surface/screens/post/post_publisher.dart';
|
||||
import 'package:surface/screens/post/publisher_page.dart';
|
||||
import 'package:surface/screens/post/post_search.dart';
|
||||
import 'package:surface/screens/realm.dart';
|
||||
import 'package:surface/screens/realm/manage.dart';
|
||||
|
@ -13,14 +13,16 @@ import 'package:surface/widgets/account/account_image.dart';
|
||||
import 'package:surface/widgets/dialog.dart';
|
||||
import 'package:surface/widgets/universal_image.dart';
|
||||
|
||||
const Map<String, (String, IconData)> kBadgesMeta = {
|
||||
const Map<String, (String, IconData, Color)> kBadgesMeta = {
|
||||
'company.staff': (
|
||||
'badgeCompanyStaff',
|
||||
Symbols.tools_wrench,
|
||||
Colors.teal,
|
||||
),
|
||||
'site.migration': (
|
||||
'badgeSiteMigration',
|
||||
Symbols.flag,
|
||||
Colors.orange,
|
||||
),
|
||||
};
|
||||
|
||||
@ -54,6 +56,22 @@ class _UserScreenState extends State<UserScreen>
|
||||
}
|
||||
}
|
||||
|
||||
SnAccountStatusInfo? _status;
|
||||
|
||||
Future<void> _fetchStatus() async {
|
||||
try {
|
||||
final sn = context.read<SnNetworkProvider>();
|
||||
final resp = await sn.client.get('/cgi/id/users/${widget.name}/status');
|
||||
if (!mounted) return;
|
||||
_status = SnAccountStatusInfo.fromJson(resp.data);
|
||||
} catch (err) {
|
||||
if (!mounted) return;
|
||||
context.showErrorDialog(err);
|
||||
} finally {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
double _appBarBlur = 0.0;
|
||||
|
||||
late final _appBarWidth = MediaQuery.of(context).size.width;
|
||||
@ -71,7 +89,9 @@ class _UserScreenState extends State<UserScreen>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fetchAccount().then((_) {});
|
||||
_fetchAccount().then((_) {
|
||||
_fetchStatus();
|
||||
});
|
||||
_scrollController.addListener(_updateAppBarBlur);
|
||||
}
|
||||
|
||||
@ -99,175 +119,208 @@ class _UserScreenState extends State<UserScreen>
|
||||
final sn = context.read<SnNetworkProvider>();
|
||||
|
||||
return Scaffold(
|
||||
body: NestedScrollView(
|
||||
body: CustomScrollView(
|
||||
controller: _scrollController,
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
SliverAppBar(
|
||||
expandedHeight: _appBarHeight,
|
||||
title: _account == null
|
||||
? Text('loading').tr()
|
||||
: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(children: [
|
||||
TextSpan(
|
||||
text: _account!.nick,
|
||||
style:
|
||||
Theme.of(context).textTheme.titleLarge!.copyWith(
|
||||
color: Colors.white,
|
||||
shadows: labelShadows,
|
||||
),
|
||||
),
|
||||
const TextSpan(text: '\n'),
|
||||
TextSpan(
|
||||
text: '@${_account!.name}',
|
||||
style:
|
||||
Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Colors.white,
|
||||
shadows: labelShadows,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
pinned: true,
|
||||
flexibleSpace: _account != null
|
||||
? Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
UniversalImage(
|
||||
sn.getAttachmentUrl(_account!.banner),
|
||||
fit: BoxFit.cover,
|
||||
height: imageHeight,
|
||||
width: _appBarWidth,
|
||||
cacheHeight: imageHeight,
|
||||
cacheWidth: _appBarWidth,
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 56 + MediaQuery.of(context).padding.top,
|
||||
child: ClipRect(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: _appBarBlur,
|
||||
sigmaY: _appBarBlur,
|
||||
),
|
||||
child: Container(
|
||||
color: Colors.black.withOpacity(
|
||||
clampDouble(_appBarBlur * 0.1, 0, 0.5),
|
||||
),
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
expandedHeight: _appBarHeight,
|
||||
title: _account == null
|
||||
? Text('loading').tr()
|
||||
: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(children: [
|
||||
TextSpan(
|
||||
text: _account!.nick,
|
||||
style: Theme.of(context).textTheme.titleLarge!.copyWith(
|
||||
color: Colors.white,
|
||||
shadows: labelShadows,
|
||||
),
|
||||
),
|
||||
const TextSpan(text: '\n'),
|
||||
TextSpan(
|
||||
text: '@${_account!.name}',
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Colors.white,
|
||||
shadows: labelShadows,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
pinned: true,
|
||||
flexibleSpace: _account != null
|
||||
? Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
UniversalImage(
|
||||
sn.getAttachmentUrl(_account!.banner),
|
||||
fit: BoxFit.cover,
|
||||
height: imageHeight,
|
||||
width: _appBarWidth,
|
||||
cacheHeight: imageHeight,
|
||||
cacheWidth: _appBarWidth,
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 56 + MediaQuery.of(context).padding.top,
|
||||
child: ClipRect(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: _appBarBlur,
|
||||
sigmaY: _appBarBlur,
|
||||
),
|
||||
child: Container(
|
||||
color: Colors.black.withOpacity(
|
||||
clampDouble(_appBarBlur * 0.1, 0, 0.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
),
|
||||
];
|
||||
},
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
AccountImage(
|
||||
content: _account!.avatar,
|
||||
radius: 28,
|
||||
),
|
||||
const Gap(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_account!.nick,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
).bold(),
|
||||
Text('@${_account!.name}').fontSize(13),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
).padding(right: 8),
|
||||
const Gap(12),
|
||||
Text(_account!.description).padding(horizontal: 8),
|
||||
const Gap(12),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Symbols.calendar_add_on),
|
||||
const Gap(8),
|
||||
Text('publisherJoinedAt').tr(args: [
|
||||
DateFormat('y/M/d').format(_account!.createdAt)
|
||||
]),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Symbols.cake),
|
||||
const Gap(8),
|
||||
Text('accountBirthday').tr(args: [
|
||||
_account!.profile?.birthday == null
|
||||
? 'unknown'.tr()
|
||||
: DateFormat('M/d')
|
||||
.format(_account!.profile!.birthday!)
|
||||
]),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Symbols.identity_platform),
|
||||
const Gap(8),
|
||||
Text(
|
||||
'#${_account!.id.toString().padLeft(8, '0')}',
|
||||
style: GoogleFonts.robotoMono(),
|
||||
).opacity(0.8),
|
||||
],
|
||||
),
|
||||
],
|
||||
).padding(horizontal: 8),
|
||||
],
|
||||
).padding(all: 16),
|
||||
const Divider(),
|
||||
const Gap(12),
|
||||
Text('accountBadge')
|
||||
.bold()
|
||||
.fontSize(17)
|
||||
.tr()
|
||||
.padding(horizontal: 20, bottom: 4),
|
||||
SizedBox(
|
||||
height: 64,
|
||||
width: double.infinity,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
scrollDirection: Axis.horizontal,
|
||||
],
|
||||
)
|
||||
: null,
|
||||
),
|
||||
if (_account != null)
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
for (final badge in _account?.badges ?? [])
|
||||
SizedBox(
|
||||
width: 280,
|
||||
child: Card(
|
||||
child: ListTile(
|
||||
leading: Icon(
|
||||
kBadgesMeta[badge.type]?.$2 ??
|
||||
Symbols.question_mark,
|
||||
),
|
||||
title: Text(
|
||||
kBadgesMeta[badge.type]?.$1 ?? 'unknown',
|
||||
).tr(),
|
||||
Row(
|
||||
children: [
|
||||
AccountImage(
|
||||
content: _account!.avatar,
|
||||
radius: 28,
|
||||
),
|
||||
const Gap(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_account!.nick,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
).bold(),
|
||||
Text('@${_account!.name}').fontSize(13),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).padding(right: 8),
|
||||
const Gap(12),
|
||||
Text(_account!.description).padding(horizontal: 8),
|
||||
const Gap(4),
|
||||
Card(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Symbols.circle,
|
||||
fill: 1,
|
||||
size: 16,
|
||||
color: (_status?.isOnline ?? false)
|
||||
? Colors.green
|
||||
: Colors.grey,
|
||||
).padding(all: 4),
|
||||
const Gap(8),
|
||||
Text(
|
||||
_status != null
|
||||
? _status!.isOnline
|
||||
? 'accountStatusOnline'.tr()
|
||||
: 'accountStatusOffline'.tr()
|
||||
: 'loading'.tr(),
|
||||
),
|
||||
],
|
||||
).padding(vertical: 8, horizontal: 12),
|
||||
),
|
||||
const Gap(8),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Symbols.calendar_add_on),
|
||||
const Gap(8),
|
||||
Text('publisherJoinedAt').tr(args: [
|
||||
DateFormat('y/M/d').format(_account!.createdAt)
|
||||
]),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Symbols.cake),
|
||||
const Gap(8),
|
||||
Text('accountBirthday').tr(args: [
|
||||
_account!.profile?.birthday == null
|
||||
? 'unknown'.tr()
|
||||
: DateFormat('M/d').format(
|
||||
_account!.profile!.birthday!.toLocal(),
|
||||
)
|
||||
]),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Symbols.identity_platform),
|
||||
const Gap(8),
|
||||
Text(
|
||||
'#${_account!.id.toString().padLeft(8, '0')}',
|
||||
style: GoogleFonts.robotoMono(),
|
||||
).opacity(0.8),
|
||||
],
|
||||
),
|
||||
],
|
||||
).padding(horizontal: 8),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
).padding(all: 16),
|
||||
),
|
||||
SliverToBoxAdapter(child: const Divider()),
|
||||
const SliverGap(12),
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('accountBadge')
|
||||
.bold()
|
||||
.fontSize(17)
|
||||
.tr()
|
||||
.padding(horizontal: 20, bottom: 4),
|
||||
SizedBox(
|
||||
height: 80,
|
||||
width: double.infinity,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: [
|
||||
for (final badge in _account?.badges ?? [])
|
||||
SizedBox(
|
||||
width: 280,
|
||||
child: Card(
|
||||
child: ListTile(
|
||||
leading: Icon(
|
||||
kBadgesMeta[badge.type]?.$2 ??
|
||||
Symbols.question_mark,
|
||||
color: kBadgesMeta[badge.type]?.$3,
|
||||
fill: 1,
|
||||
),
|
||||
title: Text(
|
||||
kBadgesMeta[badge.type]?.$1 ?? 'unknown',
|
||||
).tr(),
|
||||
subtitle: badge.metadata['title'] != null
|
||||
? Text(badge.metadata['title'])
|
||||
: Text(
|
||||
DateFormat('y/M/d')
|
||||
.format(badge.createdAt),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -404,30 +404,36 @@ class _PostPublisherScreenState extends State<PostPublisherScreen>
|
||||
],
|
||||
),
|
||||
SliverToBoxAdapter(child: const Divider(height: 1)),
|
||||
Gap(math.max(MediaQuery.of(context).padding.top, 50)),
|
||||
],
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: List.filled(
|
||||
3,
|
||||
_PublisherPostList(
|
||||
isBusy: _isBusy,
|
||||
postCount: _postCount,
|
||||
posts: _posts,
|
||||
fetchPosts: _fetchPosts,
|
||||
onChanged: (idx, data) {
|
||||
setState(() => _posts[idx] = data);
|
||||
},
|
||||
onDeleted: () {
|
||||
_posts.clear();
|
||||
_fetchPosts();
|
||||
},
|
||||
body: Column(
|
||||
children: [
|
||||
Gap(math.max(MediaQuery.of(context).padding.top, 64)),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: List.filled(
|
||||
3,
|
||||
_PublisherPostList(
|
||||
isBusy: _isBusy,
|
||||
postCount: _postCount,
|
||||
posts: _posts,
|
||||
fetchPosts: _fetchPosts,
|
||||
onChanged: (idx, data) {
|
||||
setState(() => _posts[idx] = data);
|
||||
},
|
||||
onDeleted: () {
|
||||
_posts.clear();
|
||||
_fetchPosts();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
@ -106,3 +106,16 @@ class SnAccountBadge with _$SnAccountBadge {
|
||||
factory SnAccountBadge.fromJson(Map<String, Object?> json) =>
|
||||
_$SnAccountBadgeFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class SnAccountStatusInfo with _$SnAccountStatusInfo {
|
||||
const factory SnAccountStatusInfo({
|
||||
required bool isDisturbable,
|
||||
required bool isOnline,
|
||||
required DateTime? lastSeenAt,
|
||||
required dynamic status,
|
||||
}) = _SnAccountStatusInfo;
|
||||
|
||||
factory SnAccountStatusInfo.fromJson(Map<String, Object?> json) =>
|
||||
_$SnAccountStatusInfoFromJson(json);
|
||||
}
|
||||
|
@ -1987,3 +1987,221 @@ abstract class _SnAccountBadge implements SnAccountBadge {
|
||||
_$$SnAccountBadgeImplCopyWith<_$SnAccountBadgeImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
SnAccountStatusInfo _$SnAccountStatusInfoFromJson(Map<String, dynamic> json) {
|
||||
return _SnAccountStatusInfo.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SnAccountStatusInfo {
|
||||
bool get isDisturbable => throw _privateConstructorUsedError;
|
||||
bool get isOnline => throw _privateConstructorUsedError;
|
||||
DateTime? get lastSeenAt => throw _privateConstructorUsedError;
|
||||
dynamic get status => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this SnAccountStatusInfo to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of SnAccountStatusInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SnAccountStatusInfoCopyWith<SnAccountStatusInfo> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SnAccountStatusInfoCopyWith<$Res> {
|
||||
factory $SnAccountStatusInfoCopyWith(
|
||||
SnAccountStatusInfo value, $Res Function(SnAccountStatusInfo) then) =
|
||||
_$SnAccountStatusInfoCopyWithImpl<$Res, SnAccountStatusInfo>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool isDisturbable,
|
||||
bool isOnline,
|
||||
DateTime? lastSeenAt,
|
||||
dynamic status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SnAccountStatusInfoCopyWithImpl<$Res, $Val extends SnAccountStatusInfo>
|
||||
implements $SnAccountStatusInfoCopyWith<$Res> {
|
||||
_$SnAccountStatusInfoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SnAccountStatusInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isDisturbable = null,
|
||||
Object? isOnline = null,
|
||||
Object? lastSeenAt = freezed,
|
||||
Object? status = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
isDisturbable: null == isDisturbable
|
||||
? _value.isDisturbable
|
||||
: isDisturbable // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
isOnline: null == isOnline
|
||||
? _value.isOnline
|
||||
: isOnline // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
lastSeenAt: freezed == lastSeenAt
|
||||
? _value.lastSeenAt
|
||||
: lastSeenAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SnAccountStatusInfoImplCopyWith<$Res>
|
||||
implements $SnAccountStatusInfoCopyWith<$Res> {
|
||||
factory _$$SnAccountStatusInfoImplCopyWith(_$SnAccountStatusInfoImpl value,
|
||||
$Res Function(_$SnAccountStatusInfoImpl) then) =
|
||||
__$$SnAccountStatusInfoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool isDisturbable,
|
||||
bool isOnline,
|
||||
DateTime? lastSeenAt,
|
||||
dynamic status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SnAccountStatusInfoImplCopyWithImpl<$Res>
|
||||
extends _$SnAccountStatusInfoCopyWithImpl<$Res, _$SnAccountStatusInfoImpl>
|
||||
implements _$$SnAccountStatusInfoImplCopyWith<$Res> {
|
||||
__$$SnAccountStatusInfoImplCopyWithImpl(_$SnAccountStatusInfoImpl _value,
|
||||
$Res Function(_$SnAccountStatusInfoImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SnAccountStatusInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isDisturbable = null,
|
||||
Object? isOnline = null,
|
||||
Object? lastSeenAt = freezed,
|
||||
Object? status = freezed,
|
||||
}) {
|
||||
return _then(_$SnAccountStatusInfoImpl(
|
||||
isDisturbable: null == isDisturbable
|
||||
? _value.isDisturbable
|
||||
: isDisturbable // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
isOnline: null == isOnline
|
||||
? _value.isOnline
|
||||
: isOnline // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
lastSeenAt: freezed == lastSeenAt
|
||||
? _value.lastSeenAt
|
||||
: lastSeenAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$SnAccountStatusInfoImpl implements _SnAccountStatusInfo {
|
||||
const _$SnAccountStatusInfoImpl(
|
||||
{required this.isDisturbable,
|
||||
required this.isOnline,
|
||||
required this.lastSeenAt,
|
||||
required this.status});
|
||||
|
||||
factory _$SnAccountStatusInfoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$SnAccountStatusInfoImplFromJson(json);
|
||||
|
||||
@override
|
||||
final bool isDisturbable;
|
||||
@override
|
||||
final bool isOnline;
|
||||
@override
|
||||
final DateTime? lastSeenAt;
|
||||
@override
|
||||
final dynamic status;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SnAccountStatusInfo(isDisturbable: $isDisturbable, isOnline: $isOnline, lastSeenAt: $lastSeenAt, status: $status)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SnAccountStatusInfoImpl &&
|
||||
(identical(other.isDisturbable, isDisturbable) ||
|
||||
other.isDisturbable == isDisturbable) &&
|
||||
(identical(other.isOnline, isOnline) ||
|
||||
other.isOnline == isOnline) &&
|
||||
(identical(other.lastSeenAt, lastSeenAt) ||
|
||||
other.lastSeenAt == lastSeenAt) &&
|
||||
const DeepCollectionEquality().equals(other.status, status));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, isDisturbable, isOnline,
|
||||
lastSeenAt, const DeepCollectionEquality().hash(status));
|
||||
|
||||
/// Create a copy of SnAccountStatusInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SnAccountStatusInfoImplCopyWith<_$SnAccountStatusInfoImpl> get copyWith =>
|
||||
__$$SnAccountStatusInfoImplCopyWithImpl<_$SnAccountStatusInfoImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$SnAccountStatusInfoImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _SnAccountStatusInfo implements SnAccountStatusInfo {
|
||||
const factory _SnAccountStatusInfo(
|
||||
{required final bool isDisturbable,
|
||||
required final bool isOnline,
|
||||
required final DateTime? lastSeenAt,
|
||||
required final dynamic status}) = _$SnAccountStatusInfoImpl;
|
||||
|
||||
factory _SnAccountStatusInfo.fromJson(Map<String, dynamic> json) =
|
||||
_$SnAccountStatusInfoImpl.fromJson;
|
||||
|
||||
@override
|
||||
bool get isDisturbable;
|
||||
@override
|
||||
bool get isOnline;
|
||||
@override
|
||||
DateTime? get lastSeenAt;
|
||||
@override
|
||||
dynamic get status;
|
||||
|
||||
/// Create a copy of SnAccountStatusInfo
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SnAccountStatusInfoImplCopyWith<_$SnAccountStatusInfoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
@ -192,3 +192,23 @@ Map<String, dynamic> _$$SnAccountBadgeImplToJson(
|
||||
'account_id': instance.accountId,
|
||||
'metadata': instance.metadata,
|
||||
};
|
||||
|
||||
_$SnAccountStatusInfoImpl _$$SnAccountStatusInfoImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$SnAccountStatusInfoImpl(
|
||||
isDisturbable: json['is_disturbable'] as bool,
|
||||
isOnline: json['is_online'] as bool,
|
||||
lastSeenAt: json['last_seen_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_seen_at'] as String),
|
||||
status: json['status'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SnAccountStatusInfoImplToJson(
|
||||
_$SnAccountStatusInfoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'is_disturbable': instance.isDisturbable,
|
||||
'is_online': instance.isOnline,
|
||||
'last_seen_at': instance.lastSeenAt?.toIso8601String(),
|
||||
'status': instance.status,
|
||||
};
|
||||
|
Reference in New Issue
Block a user