✨ Channel kick members
This commit is contained in:
parent
47c10a180a
commit
3a661b67c7
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/providers/chat.dart';
|
import 'package:solian/providers/chat.dart';
|
||||||
|
import 'package:solian/providers/friend.dart';
|
||||||
import 'package:solian/providers/navigation.dart';
|
import 'package:solian/providers/navigation.dart';
|
||||||
import 'package:solian/providers/notify.dart';
|
import 'package:solian/providers/notify.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
@ -42,6 +43,7 @@ class SolianApp extends StatelessWidget {
|
|||||||
Provider(create: (_) => AuthProvider()),
|
Provider(create: (_) => AuthProvider()),
|
||||||
Provider(create: (_) => ChatProvider()),
|
Provider(create: (_) => ChatProvider()),
|
||||||
ChangeNotifierProvider(create: (_) => NotifyProvider()),
|
ChangeNotifierProvider(create: (_) => NotifyProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => FriendProvider()),
|
||||||
],
|
],
|
||||||
child: NotificationNotifier(child: child ?? Container()),
|
child: NotificationNotifier(child: child ?? Container()),
|
||||||
);
|
);
|
||||||
|
@ -63,3 +63,47 @@ class Channel {
|
|||||||
"realm_id": realmId,
|
"realm_id": realmId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ChannelMember {
|
||||||
|
int id;
|
||||||
|
DateTime createdAt;
|
||||||
|
DateTime updatedAt;
|
||||||
|
DateTime? deletedAt;
|
||||||
|
int channelId;
|
||||||
|
int accountId;
|
||||||
|
Account account;
|
||||||
|
int notify;
|
||||||
|
|
||||||
|
ChannelMember({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
this.deletedAt,
|
||||||
|
required this.channelId,
|
||||||
|
required this.accountId,
|
||||||
|
required this.account,
|
||||||
|
required this.notify,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ChannelMember.fromJson(Map<String, dynamic> json) => ChannelMember(
|
||||||
|
id: json["id"],
|
||||||
|
createdAt: DateTime.parse(json["created_at"]),
|
||||||
|
updatedAt: DateTime.parse(json["updated_at"]),
|
||||||
|
deletedAt: json["deleted_at"],
|
||||||
|
channelId: json["channel_id"],
|
||||||
|
accountId: json["account_id"],
|
||||||
|
account: Account.fromJson(json["account"]),
|
||||||
|
notify: json["notify"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"id": id,
|
||||||
|
"created_at": createdAt.toIso8601String(),
|
||||||
|
"updated_at": updatedAt.toIso8601String(),
|
||||||
|
"deleted_at": deletedAt,
|
||||||
|
"channel_id": channelId,
|
||||||
|
"account_id": accountId,
|
||||||
|
"account": account.toJson(),
|
||||||
|
"notify": notify,
|
||||||
|
};
|
||||||
|
}
|
26
lib/providers/friend.dart
Normal file
26
lib/providers/friend.dart
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:solian/models/friendship.dart';
|
||||||
|
import 'package:solian/providers/auth.dart';
|
||||||
|
import 'package:solian/utils/service_url.dart';
|
||||||
|
|
||||||
|
class FriendProvider extends ChangeNotifier {
|
||||||
|
List<Friendship> friends = List.empty();
|
||||||
|
|
||||||
|
Future<void> fetch(AuthProvider auth) async {
|
||||||
|
if (!await auth.isAuthorized()) return;
|
||||||
|
|
||||||
|
var uri = getRequestUri('passport', '/api/users/me/friends?status=1');
|
||||||
|
|
||||||
|
var res = await auth.client!.get(uri);
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
final result = jsonDecode(utf8.decode(res.bodyBytes)) as List<dynamic>;
|
||||||
|
friends = result.map((x) => Friendship.fromJson(x)).toList();
|
||||||
|
notifyListeners();
|
||||||
|
} else {
|
||||||
|
var message = utf8.decode(res.bodyBytes);
|
||||||
|
throw Exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,8 @@ import 'package:solian/screens/account/friend.dart';
|
|||||||
import 'package:solian/screens/chat/chat.dart';
|
import 'package:solian/screens/chat/chat.dart';
|
||||||
import 'package:solian/screens/chat/index.dart';
|
import 'package:solian/screens/chat/index.dart';
|
||||||
import 'package:solian/screens/chat/manage.dart';
|
import 'package:solian/screens/chat/manage.dart';
|
||||||
import 'package:solian/screens/chat/channel/channel_editor.dart';
|
import 'package:solian/screens/chat/channel/editor.dart';
|
||||||
|
import 'package:solian/screens/chat/channel/member.dart';
|
||||||
import 'package:solian/screens/explore.dart';
|
import 'package:solian/screens/explore.dart';
|
||||||
import 'package:solian/screens/notification.dart';
|
import 'package:solian/screens/notification.dart';
|
||||||
import 'package:solian/screens/posts/comment_editor.dart';
|
import 'package:solian/screens/posts/comment_editor.dart';
|
||||||
@ -46,6 +47,11 @@ final router = GoRouter(
|
|||||||
name: 'chat.channel.manage',
|
name: 'chat.channel.manage',
|
||||||
builder: (context, state) => ChatManageScreen(channel: state.extra as Channel),
|
builder: (context, state) => ChatManageScreen(channel: state.extra as Channel),
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/chat/c/:channel/member',
|
||||||
|
name: 'chat.channel.member',
|
||||||
|
builder: (context, state) => ChatMemberScreen(channel: state.extra as Channel),
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/account',
|
path: '/account',
|
||||||
name: 'account',
|
name: 'account',
|
||||||
|
@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
import 'package:solian/utils/service_url.dart';
|
import 'package:solian/utils/service_url.dart';
|
||||||
|
import 'package:solian/widgets/account/avatar.dart';
|
||||||
import 'package:solian/widgets/common_wrapper.dart';
|
import 'package:solian/widgets/common_wrapper.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
@ -98,7 +99,7 @@ class NameCard extends StatelessWidget {
|
|||||||
Future<Widget> renderAvatar(BuildContext context) async {
|
Future<Widget> renderAvatar(BuildContext context) async {
|
||||||
final auth = context.read<AuthProvider>();
|
final auth = context.read<AuthProvider>();
|
||||||
final profiles = await auth.getProfiles();
|
final profiles = await auth.getProfiles();
|
||||||
return CircleAvatar(backgroundImage: NetworkImage(profiles["picture"]));
|
return AccountAvatar(source: profiles["picture"], direct: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Column> renderLabel(BuildContext context) async {
|
Future<Column> renderLabel(BuildContext context) async {
|
||||||
|
@ -7,6 +7,7 @@ import 'package:solian/models/account.dart';
|
|||||||
import 'package:solian/models/friendship.dart';
|
import 'package:solian/models/friendship.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/utils/service_url.dart';
|
import 'package:solian/utils/service_url.dart';
|
||||||
|
import 'package:solian/widgets/account/avatar.dart';
|
||||||
import 'package:solian/widgets/indent_wrapper.dart';
|
import 'package:solian/widgets/indent_wrapper.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
@ -59,6 +60,9 @@ class _FriendScreenState extends State<FriendScreen> {
|
|||||||
getRequestUri('passport', '/api/users/me/friends?related=$username'),
|
getRequestUri('passport', '/api/users/me/friends?related=$username'),
|
||||||
);
|
);
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text(AppLocalizations.of(context)!.friendAddDone)),
|
||||||
|
);
|
||||||
await fetchFriendships();
|
await fetchFriendships();
|
||||||
} else {
|
} else {
|
||||||
var message = utf8.decode(res.bodyBytes);
|
var message = utf8.decode(res.bodyBytes);
|
||||||
@ -91,9 +95,6 @@ class _FriendScreenState extends State<FriendScreen> {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(content: Text(AppLocalizations.of(context)!.friendAddDone)),
|
|
||||||
);
|
|
||||||
await fetchFriendships();
|
await fetchFriendships();
|
||||||
} else {
|
} else {
|
||||||
var message = utf8.decode(res.bodyBytes);
|
var message = utf8.decode(res.bodyBytes);
|
||||||
@ -172,10 +173,6 @@ class _FriendScreenState extends State<FriendScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getAvatarUrl(String uuid) {
|
|
||||||
return getRequestUri('passport', '/api/avatar/$uuid').toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -211,9 +208,7 @@ class _FriendScreenState extends State<FriendScreen> {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text(otherside.nick),
|
title: Text(otherside.nick),
|
||||||
subtitle: Text(otherside.name),
|
subtitle: Text(otherside.name),
|
||||||
leading: CircleAvatar(
|
leading: AccountAvatar(source: otherside.avatar),
|
||||||
backgroundImage: NetworkImage(getAvatarUrl(otherside.avatar)),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onDismissed: (direction) {
|
onDismissed: (direction) {
|
||||||
if (direction == DismissDirection.startToEnd) {
|
if (direction == DismissDirection.startToEnd) {
|
||||||
|
143
lib/screens/chat/channel/member.dart
Normal file
143
lib/screens/chat/channel/member.dart
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:solian/models/channel.dart';
|
||||||
|
import 'package:solian/providers/auth.dart';
|
||||||
|
import 'package:solian/utils/service_url.dart';
|
||||||
|
import 'package:solian/widgets/account/avatar.dart';
|
||||||
|
import 'package:solian/widgets/indent_wrapper.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
class ChatMemberScreen extends StatefulWidget {
|
||||||
|
final Channel channel;
|
||||||
|
|
||||||
|
const ChatMemberScreen({super.key, required this.channel});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ChatMemberScreen> createState() => _ChatMemberScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ChatMemberScreenState extends State<ChatMemberScreen> {
|
||||||
|
bool _isSubmitting = false;
|
||||||
|
|
||||||
|
List<ChannelMember> _members = List.empty();
|
||||||
|
|
||||||
|
int _selfId = 0;
|
||||||
|
|
||||||
|
Future<void> fetchMemberships() async {
|
||||||
|
final auth = context.read<AuthProvider>();
|
||||||
|
final prof = await auth.getProfiles();
|
||||||
|
if (!await auth.isAuthorized()) return;
|
||||||
|
|
||||||
|
_selfId = prof['id'];
|
||||||
|
|
||||||
|
var uri = getRequestUri('messaging', '/api/channels/${widget.channel.alias}/members');
|
||||||
|
|
||||||
|
var res = await auth.client!.get(uri);
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
final result = jsonDecode(utf8.decode(res.bodyBytes)) as List<dynamic>;
|
||||||
|
setState(() {
|
||||||
|
_members = result.map((x) => ChannelMember.fromJson(x)).toList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var message = utf8.decode(res.bodyBytes);
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text("Something went wrong... $message")),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> kickMember(ChannelMember item) async {
|
||||||
|
setState(() => _isSubmitting = true);
|
||||||
|
|
||||||
|
final auth = context.read<AuthProvider>();
|
||||||
|
if (!await auth.isAuthorized()) {
|
||||||
|
setState(() => _isSubmitting = false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var uri = getRequestUri('messaging', '/api/channels/${widget.channel.alias}/kick');
|
||||||
|
|
||||||
|
var res = await auth.client!.post(
|
||||||
|
uri,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: jsonEncode({
|
||||||
|
'account_name': item.account.name,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
await fetchMemberships();
|
||||||
|
} else {
|
||||||
|
var message = utf8.decode(res.bodyBytes);
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text("Something went wrong... $message")),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() => _isSubmitting = false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getKickable(ChannelMember item) {
|
||||||
|
if (_selfId != widget.channel.account.externalId) return false;
|
||||||
|
if (item.accountId == widget.channel.accountId) return false;
|
||||||
|
if (item.account.externalId == _selfId) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
Future.delayed(Duration.zero, () => fetchMemberships());
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return IndentWrapper(
|
||||||
|
title: AppLocalizations.of(context)!.chatMember,
|
||||||
|
noSafeArea: true,
|
||||||
|
hideDrawer: true,
|
||||||
|
child: RefreshIndicator(
|
||||||
|
onRefresh: () => fetchMemberships(),
|
||||||
|
child: CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _isSubmitting ? const LinearProgressIndicator().animate().scaleX() : Container(),
|
||||||
|
),
|
||||||
|
SliverList.builder(
|
||||||
|
itemCount: _members.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final element = _members[index];
|
||||||
|
|
||||||
|
final randomId = DateTime.now().microsecondsSinceEpoch >> 10;
|
||||||
|
|
||||||
|
return Dismissible(
|
||||||
|
key: Key(randomId.toString()),
|
||||||
|
direction: getKickable(element) ? DismissDirection.startToEnd : DismissDirection.none,
|
||||||
|
background: Container(
|
||||||
|
color: Colors.red,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: const Icon(Icons.remove, color: Colors.white),
|
||||||
|
),
|
||||||
|
child: ListTile(
|
||||||
|
leading: AccountAvatar(source: element.account.avatar, direct: true),
|
||||||
|
title: Text(element.account.nick),
|
||||||
|
subtitle: Text(element.account.name),
|
||||||
|
),
|
||||||
|
onDismissed: (_) {
|
||||||
|
kickMember(element);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -83,7 +83,13 @@ class _ChatManageScreenState extends State<ChatManageScreen> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.supervisor_account),
|
leading: const Icon(Icons.supervisor_account),
|
||||||
title: Text(AppLocalizations.of(context)!.chatMember),
|
title: Text(AppLocalizations.of(context)!.chatMember),
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
router.pushNamed(
|
||||||
|
'chat.channel.member',
|
||||||
|
extra: widget.channel,
|
||||||
|
pathParameters: {'channel': widget.channel.alias},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
...(isOwned ? authorizedItems : List.empty()),
|
...(isOwned ? authorizedItems : List.empty()),
|
||||||
],
|
],
|
||||||
|
@ -9,6 +9,7 @@ import 'package:solian/providers/auth.dart';
|
|||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
import 'package:solian/utils/service_url.dart';
|
import 'package:solian/utils/service_url.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
import 'package:solian/widgets/account/avatar.dart';
|
||||||
import 'package:solian/widgets/indent_wrapper.dart';
|
import 'package:solian/widgets/indent_wrapper.dart';
|
||||||
import 'package:solian/widgets/posts/attachment_editor.dart';
|
import 'package:solian/widgets/posts/attachment_editor.dart';
|
||||||
|
|
||||||
@ -145,8 +146,9 @@ class _CommentEditorScreenState extends State<CommentEditorScreen> {
|
|||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
AppLocalizations.of(context)!.postIdentityNotify,
|
AppLocalizations.of(context)!.postIdentityNotify,
|
||||||
),
|
),
|
||||||
leading: CircleAvatar(
|
leading: AccountAvatar(
|
||||||
backgroundImage: NetworkImage(userinfo["picture"]),
|
source: userinfo["picture"],
|
||||||
|
direct: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,6 +9,7 @@ import 'package:solian/providers/auth.dart';
|
|||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
import 'package:solian/utils/service_url.dart';
|
import 'package:solian/utils/service_url.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
import 'package:solian/widgets/account/avatar.dart';
|
||||||
import 'package:solian/widgets/indent_wrapper.dart';
|
import 'package:solian/widgets/indent_wrapper.dart';
|
||||||
import 'package:solian/widgets/posts/attachment_editor.dart';
|
import 'package:solian/widgets/posts/attachment_editor.dart';
|
||||||
|
|
||||||
@ -135,8 +136,9 @@ class _MomentEditorScreenState extends State<MomentEditorScreen> {
|
|||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
AppLocalizations.of(context)!.postIdentityNotify,
|
AppLocalizations.of(context)!.postIdentityNotify,
|
||||||
),
|
),
|
||||||
leading: CircleAvatar(
|
leading: AccountAvatar(
|
||||||
backgroundImage: NetworkImage(userinfo["picture"]),
|
source: userinfo["picture"],
|
||||||
|
direct: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
44
lib/widgets/account/avatar.dart
Normal file
44
lib/widgets/account/avatar.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:solian/utils/service_url.dart';
|
||||||
|
|
||||||
|
class AccountAvatar extends StatelessWidget {
|
||||||
|
final String source;
|
||||||
|
final double? radius;
|
||||||
|
final bool? direct;
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
|
const AccountAvatar({
|
||||||
|
super.key,
|
||||||
|
required this.source,
|
||||||
|
this.radius,
|
||||||
|
this.direct,
|
||||||
|
this.backgroundColor,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final detectRegex = RegExp(r'https://.*/api/avatar/');
|
||||||
|
|
||||||
|
if (source.isEmpty || source.replaceAll(detectRegex, '').isEmpty) {
|
||||||
|
return CircleAvatar(
|
||||||
|
radius: radius,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
child: const Icon(Icons.account_circle),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (direct == true) {
|
||||||
|
return CircleAvatar(
|
||||||
|
radius: radius,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
backgroundImage: NetworkImage(source),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final url = getRequestUri('passport', '/api/avatar/$source').toString();
|
||||||
|
return CircleAvatar(
|
||||||
|
radius: radius,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
backgroundImage: NetworkImage(url),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:solian/models/message.dart';
|
import 'package:solian/models/message.dart';
|
||||||
|
import 'package:solian/widgets/account/avatar.dart';
|
||||||
import 'package:solian/widgets/chat/content.dart';
|
import 'package:solian/widgets/chat/content.dart';
|
||||||
import 'package:solian/widgets/posts/content/attachment.dart';
|
import 'package:solian/widgets/posts/content/attachment.dart';
|
||||||
import 'package:timeago/timeago.dart' as timeago;
|
import 'package:timeago/timeago.dart' as timeago;
|
||||||
@ -38,9 +39,10 @@ class ChatMessage extends StatelessWidget {
|
|||||||
child: const Icon(Icons.reply, size: 16),
|
child: const Icon(Icons.reply, size: 16),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
CircleAvatar(
|
AccountAvatar(
|
||||||
radius: 10,
|
radius: 10,
|
||||||
backgroundImage: NetworkImage(item.replyTo!.sender.account.avatar),
|
source: item.replyTo!.sender.account.avatar,
|
||||||
|
direct: true,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -102,8 +104,9 @@ class ChatMessage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
AccountAvatar(
|
||||||
backgroundImage: NetworkImage(item.sender.account.avatar),
|
source: item.sender.account.avatar,
|
||||||
|
direct: true,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
|
import 'package:solian/widgets/account/avatar.dart';
|
||||||
import 'package:solian/widgets/posts/comment_list.dart';
|
import 'package:solian/widgets/posts/comment_list.dart';
|
||||||
import 'package:solian/widgets/posts/content/article.dart';
|
import 'package:solian/widgets/posts/content/article.dart';
|
||||||
import 'package:solian/widgets/posts/content/attachment.dart';
|
import 'package:solian/widgets/posts/content/attachment.dart';
|
||||||
@ -166,8 +167,9 @@ class _PostItemState extends State<PostItem> {
|
|||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
AccountAvatar(
|
||||||
backgroundImage: NetworkImage(widget.item.author.avatar),
|
source: widget.item.author.avatar,
|
||||||
|
direct: true,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -196,8 +198,9 @@ class _PostItemState extends State<PostItem> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
AccountAvatar(
|
||||||
backgroundImage: NetworkImage(widget.item.author.avatar),
|
source: widget.item.author.avatar,
|
||||||
|
direct: true,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
Loading…
Reference in New Issue
Block a user