✨ Account profile page
This commit is contained in:
@ -18,6 +18,7 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
final String? desc;
|
||||
final Account? detail;
|
||||
final List<AccountBadge>? badges;
|
||||
final List<Widget>? extraWidgets;
|
||||
|
||||
final Future<Response>? status;
|
||||
final Function? onEditStatus;
|
||||
@ -32,6 +33,7 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
required this.badges,
|
||||
this.detail,
|
||||
this.status,
|
||||
this.extraWidgets,
|
||||
this.onEditStatus,
|
||||
});
|
||||
|
||||
@ -149,19 +151,6 @@ 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,
|
||||
@ -177,7 +166,21 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
vertical: PlatformInfo.isMobile ? 0 : 6,
|
||||
),
|
||||
),
|
||||
).paddingOnly(left: 16, right: 16),
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
...?extraWidgets?.map((x) => x.paddingSymmetric(horizontal: 16)),
|
||||
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),
|
||||
),
|
||||
),
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
@ -188,7 +191,7 @@ class AccountHeadingWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
).paddingOnly(left: 16, right: 16),
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:solian/exts.dart';
|
||||
import 'package:solian/models/account.dart';
|
||||
import 'package:solian/providers/account_status.dart';
|
||||
import 'package:solian/router.dart';
|
||||
import 'package:solian/services.dart';
|
||||
import 'package:solian/widgets/account/account_heading.dart';
|
||||
|
||||
@ -23,9 +24,7 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
||||
void getUserinfo() async {
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
final client = GetConnect();
|
||||
client.httpClient.baseUrl = ServiceFinder.buildUrl('auth', null);
|
||||
|
||||
final client = ServiceFinder.configureClient('auth');
|
||||
final resp = await client.get('/users/${widget.account.name}');
|
||||
if (resp.statusCode == 200) {
|
||||
_userinfo = Account.fromJson(resp.body);
|
||||
@ -39,14 +38,16 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getUserinfo();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_isBusy || _userinfo == null) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.75,
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
@ -62,7 +63,28 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
||||
desc: _userinfo!.description,
|
||||
detail: _userinfo!,
|
||||
badges: _userinfo!.badges,
|
||||
status: Get.find<StatusProvider>().getSomeoneStatus(_userinfo!.name),
|
||||
status:
|
||||
Get.find<StatusProvider>().getSomeoneStatus(_userinfo!.name),
|
||||
extraWidgets: [
|
||||
Card(
|
||||
child: ListTile(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
title: Text('visitProfilePage'.tr),
|
||||
visualDensity:
|
||||
const VisualDensity(horizontal: -4, vertical: -2),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
AppRouter.instance.goNamed(
|
||||
'accountProfilePage',
|
||||
pathParameters: {'name': _userinfo!.name},
|
||||
);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingOnly(top: 16),
|
||||
],
|
||||
),
|
||||
|
@ -14,6 +14,7 @@ class AttachmentList extends StatefulWidget {
|
||||
final List<int> attachmentsId;
|
||||
final bool isGrid;
|
||||
final bool isForceGrid;
|
||||
final double flatMaxHeight;
|
||||
|
||||
final double? width;
|
||||
final double? viewport;
|
||||
@ -24,6 +25,7 @@ class AttachmentList extends StatefulWidget {
|
||||
required this.attachmentsId,
|
||||
this.isGrid = false,
|
||||
this.isForceGrid = false,
|
||||
this.flatMaxHeight = 720,
|
||||
this.width,
|
||||
this.viewport,
|
||||
});
|
||||
@ -255,20 +257,25 @@ class _AttachmentListState extends State<AttachmentList> {
|
||||
itemBuilder: (context, idx) {
|
||||
final element = _attachmentsMeta[idx];
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border.all(color: Theme.of(context).dividerColor, width: 1),
|
||||
borderRadius: radius,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: radius,
|
||||
child: _buildEntry(element, idx),
|
||||
));
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border.all(color: Theme.of(context).dividerColor, width: 1),
|
||||
borderRadius: radius,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: radius,
|
||||
child: _buildEntry(element, idx),
|
||||
),
|
||||
);
|
||||
},
|
||||
).paddingSymmetric(horizontal: 24);
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: widget.flatMaxHeight,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
border: Border.symmetric(
|
||||
|
@ -298,16 +298,10 @@ class _PostItemState extends State<PostItem> {
|
||||
right: 16,
|
||||
left: 16,
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: 720,
|
||||
),
|
||||
child: AttachmentList(
|
||||
parentId: widget.item.id.toString(),
|
||||
attachmentsId: attachments,
|
||||
isGrid: attachments.length > 1,
|
||||
),
|
||||
AttachmentList(
|
||||
parentId: widget.item.id.toString(),
|
||||
attachmentsId: attachments,
|
||||
isGrid: attachments.length > 1,
|
||||
),
|
||||
if (widget.isShowReply && widget.isReactable)
|
||||
PostQuickAction(
|
||||
|
Reference in New Issue
Block a user