Suspended account tip

This commit is contained in:
LittleSheep 2024-07-13 19:09:04 +08:00
parent a68a78597e
commit 6311322c4a
5 changed files with 37 additions and 2 deletions

View File

@ -3,6 +3,8 @@ class Account {
DateTime createdAt;
DateTime updatedAt;
DateTime? deletedAt;
DateTime? confirmedAt;
DateTime? suspendedAt;
String name;
String nick;
dynamic avatar;
@ -17,6 +19,8 @@ class Account {
required this.createdAt,
required this.updatedAt,
required this.deletedAt,
required this.confirmedAt,
required this.suspendedAt,
required this.name,
required this.nick,
required this.avatar,
@ -31,7 +35,15 @@ class Account {
id: json['id'],
createdAt: DateTime.parse(json['created_at']),
updatedAt: DateTime.parse(json['updated_at']),
deletedAt: json['deleted_at'],
deletedAt: json['deleted_at'] != null
? DateTime.parse(json['deleted_at'])
: null,
confirmedAt: json['confirmed_at'] != null
? DateTime.parse(json['confirmed_at'])
: null,
suspendedAt: json['suspended_at'] != null
? DateTime.parse(json['suspended_at'])
: null,
name: json['name'],
nick: json['nick'],
avatar: json['avatar'],
@ -49,7 +61,9 @@ class Account {
'id': id,
'created_at': createdAt.toIso8601String(),
'updated_at': updatedAt.toIso8601String(),
'deleted_at': deletedAt,
'deleted_at': deletedAt?.toIso8601String(),
'confirmed_at': confirmedAt?.toIso8601String(),
'suspended_at': suspendedAt?.toIso8601String(),
'name': name,
'nick': nick,
'avatar': avatar,

View File

@ -50,6 +50,8 @@ const messagesEnglish = {
'accountFriendPending': 'Friend requests',
'accountFriendBlocked': 'Friend blocklist',
'accountFriendListHint': 'Swipe left to decline, right to approve',
'accountSuspended': 'Account was suspended',
'accountSuspendedAt': 'Account was suspended since @date',
'aspectRatio': 'Aspect Ratio',
'aspectRatioSquare': 'Square',
'aspectRatioPortrait': 'Portrait',

View File

@ -49,6 +49,8 @@ const simplifiedChineseMessages = {
'accountFriendPending': '好友请求',
'accountFriendBlocked': '好友黑名单',
'accountFriendListHint': '左滑来拒绝,右滑来接受',
'accountSuspended': '帐号被停用',
'accountSuspendedAt': '该帐号自 @date 起被停用',
'aspectRatio': '纵横比',
'aspectRatioSquare': '方型',
'aspectRatioPortrait': '竖型',

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:solian/models/account.dart';
import 'package:solian/models/account_status.dart';
import 'package:solian/platform.dart';
@ -15,6 +16,7 @@ class AccountHeadingWidget extends StatelessWidget {
final String name;
final String nick;
final String? desc;
final Account? detail;
final List<AccountBadge>? badges;
final Future<Response>? status;
@ -28,6 +30,7 @@ class AccountHeadingWidget extends StatelessWidget {
required this.nick,
required this.desc,
required this.badges,
this.detail,
this.status,
this.onEditStatus,
});
@ -146,6 +149,19 @@ class AccountHeadingWidget extends StatelessWidget {
],
).paddingOnly(left: 116, top: 6),
const SizedBox(height: 4),
if (detail?.suspendedAt != null)
SizedBox(
width: double.infinity,
child: Card(
child: ListTile(
title: Text('accountSuspended'.tr),
subtitle: Text('accountSuspendedAt'.trParams({
'date': DateFormat('y/M/d').format(detail!.suspendedAt!),
})),
trailing: const Icon(Icons.block),
),
),
).paddingOnly(left: 16, right: 16),
if (badges?.isNotEmpty ?? false)
SizedBox(
width: double.infinity,

View File

@ -60,6 +60,7 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
name: _userinfo!.name,
nick: _userinfo!.nick,
desc: _userinfo!.description,
detail: _userinfo!,
badges: _userinfo!.badges,
status: Get.find<StatusProvider>().getSomeoneStatus(_userinfo!.name),
).paddingOnly(top: 16),