Better DM

This commit is contained in:
2024-05-29 00:14:41 +08:00
parent c50a49f37d
commit d4cbabeb31
17 changed files with 253 additions and 187 deletions

View File

@ -3,11 +3,17 @@ import 'package:solian/services.dart';
class AccountAvatar extends StatelessWidget {
final dynamic content;
final Color? color;
final Color? bgColor;
final Color? feColor;
final double? radius;
const AccountAvatar(
{super.key, required this.content, this.color, this.radius});
const AccountAvatar({
super.key,
required this.content,
this.bgColor,
this.feColor,
this.radius,
});
@override
Widget build(BuildContext context) {
@ -22,7 +28,7 @@ class AccountAvatar extends StatelessWidget {
return CircleAvatar(
key: Key('a$content'),
radius: radius,
backgroundColor: color,
backgroundColor: bgColor,
backgroundImage: !isEmpty
? NetworkImage(
direct
@ -34,6 +40,7 @@ class AccountAvatar extends StatelessWidget {
? Icon(
Icons.account_circle,
size: radius != null ? radius! * 1.2 : 24,
color: feColor,
)
: null,
);

View File

@ -19,7 +19,7 @@ class FriendSelect extends StatefulWidget {
class _FriendSelectState extends State<FriendSelect> {
int _accountId = 0;
List<Friendship> _friends = List.empty(growable: true);
final List<Friendship> _friends = List.empty(growable: true);
getFriends() async {
final AuthProvider auth = Get.find();

View File

@ -56,7 +56,7 @@ class _AttachmentPublishingPopupState extends State<AttachmentPublishingPopup> {
ratio: await calculateFileAspectRatio(file),
);
} catch (err) {
this.context.showErrorDialog(err);
context.showErrorDialog(err);
}
}
@ -79,7 +79,7 @@ class _AttachmentPublishingPopupState extends State<AttachmentPublishingPopup> {
try {
await uploadAttachment(file, hash, ratio: ratio);
} catch (err) {
this.context.showErrorDialog(err);
context.showErrorDialog(err);
}
setState(() => _isBusy = false);
@ -102,7 +102,7 @@ class _AttachmentPublishingPopupState extends State<AttachmentPublishingPopup> {
try {
await uploadAttachment(file, hash);
} catch (err) {
this.context.showErrorDialog(err);
context.showErrorDialog(err);
}
}
@ -136,7 +136,7 @@ class _AttachmentPublishingPopupState extends State<AttachmentPublishingPopup> {
try {
await uploadAttachment(file, hash, ratio: ratio);
} catch (err) {
this.context.showErrorDialog(err);
context.showErrorDialog(err);
}
setState(() => _isBusy = false);
@ -392,7 +392,7 @@ class _AttachmentEditingDialogState extends State<AttachmentEditingDialog> {
);
return Attachment.fromJson(resp.body);
} catch (e) {
this.context.showErrorDialog(e);
context.showErrorDialog(e);
return null;
} finally {
setState(() => _isBusy = false);
@ -406,7 +406,7 @@ class _AttachmentEditingDialogState extends State<AttachmentEditingDialog> {
await provider.deleteAttachment(widget.item.id);
widget.onDelete();
} catch (e) {
this.context.showErrorDialog(e);
context.showErrorDialog(e);
} finally {
setState(() => _isBusy = false);
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';