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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:solian/models/account.dart'; import 'package:solian/models/account.dart';
import 'package:solian/models/account_status.dart'; import 'package:solian/models/account_status.dart';
import 'package:solian/platform.dart'; import 'package:solian/platform.dart';
@ -15,6 +16,7 @@ class AccountHeadingWidget extends StatelessWidget {
final String name; final String name;
final String nick; final String nick;
final String? desc; final String? desc;
final Account? detail;
final List<AccountBadge>? badges; final List<AccountBadge>? badges;
final Future<Response>? status; final Future<Response>? status;
@ -28,6 +30,7 @@ class AccountHeadingWidget extends StatelessWidget {
required this.nick, required this.nick,
required this.desc, required this.desc,
required this.badges, required this.badges,
this.detail,
this.status, this.status,
this.onEditStatus, this.onEditStatus,
}); });
@ -146,6 +149,19 @@ class AccountHeadingWidget extends StatelessWidget {
], ],
).paddingOnly(left: 116, top: 6), ).paddingOnly(left: 116, top: 6),
const SizedBox(height: 4), 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) if (badges?.isNotEmpty ?? false)
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,

View File

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