Compare commits

...

5 Commits

Author SHA1 Message Date
153c15e5c9 🚀 Launch 1.2.2+2 2024-09-18 13:05:08 +08:00
6a0f42cdc9 🐛 Fix realm view won't show channels 2024-09-18 13:03:40 +08:00
01aaa5455e 💄 Fix content padding mis-match 2024-09-18 00:14:16 +08:00
f3ceb5f967 🚀 Launch 1.2.2+1 2024-09-17 23:50:49 +08:00
b5e2fa4c25 🐛 Fix post editor alias overflow 2024-09-17 23:08:00 +08:00
6 changed files with 84 additions and 65 deletions

View File

@ -89,13 +89,13 @@ class ChannelProvider extends GetxController {
return resp; return resp;
} }
Future<Response> listAvailableChannel({String realm = 'global'}) async { Future<Response> listAvailableChannel({String scope = 'global'}) async {
final AuthProvider auth = Get.find(); final AuthProvider auth = Get.find();
if (auth.isAuthorized.isFalse) throw const UnauthorizedException(); if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
final client = await auth.configureClient('messaging'); final client = await auth.configureClient('messaging');
final resp = await client.get('/channels/$realm/me/available'); final resp = await client.get('/channels/$scope/me/available');
if (resp.statusCode != 200) { if (resp.statusCode != 200) {
throw RequestException(resp); throw RequestException(resp);
} }

View File

@ -115,6 +115,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
leading: const Icon(Icons.settings), leading: const Icon(Icons.settings),
trailing: const Icon(Icons.chevron_right), trailing: const Icon(Icons.chevron_right),
title: Text('channelSettings'.tr), title: Text('channelSettings'.tr),
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
onTap: () async { onTap: () async {
AppRouter.instance AppRouter.instance
.pushNamed( .pushNamed(
@ -174,6 +175,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
ListTile( ListTile(
leading: const Icon(Icons.notifications_active), leading: const Icon(Icons.notifications_active),
title: Text('channelNotifyLevel'.tr), title: Text('channelNotifyLevel'.tr),
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
trailing: DropdownButtonHideUnderline( trailing: DropdownButtonHideUnderline(
child: DropdownButton2<int>( child: DropdownButton2<int>(
isExpanded: true, isExpanded: true,
@ -206,6 +208,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
), ),
), ),
ListTile( ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: const Icon(Icons.supervisor_account), leading: const Icon(Icons.supervisor_account),
trailing: const Icon(Icons.chevron_right), trailing: const Icon(Icons.chevron_right),
title: Text('channelMembers'.tr), title: Text('channelMembers'.tr),
@ -214,6 +217,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
...(_isOwned ? ownerActions : List.empty()), ...(_isOwned ? ownerActions : List.empty()),
const Divider(thickness: 0.3), const Divider(thickness: 0.3),
ListTile( ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: _isOwned leading: _isOwned
? const Icon(Icons.delete) ? const Icon(Icons.delete)
: const Icon(Icons.exit_to_app), : const Icon(Icons.exit_to_app),

View File

@ -183,18 +183,18 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
children: [ children: [
ListTile( ListTile(
tileColor: Theme.of(context).colorScheme.surfaceContainerLow, tileColor: Theme.of(context).colorScheme.surfaceContainerLow,
title: Row( title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
_editorController.title ?? 'title'.tr, _editorController.title ?? 'title'.tr,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const Gap(6),
if (_editorController.aliasController.text.isNotEmpty) if (_editorController.aliasController.text.isNotEmpty)
Badge( Badge(
label: Text('#${_editorController.aliasController.text}'), label: Text('#${_editorController.aliasController.text}'),
), ).paddingOnly(bottom: 2),
], ],
), ),
subtitle: Text( subtitle: Text(

View File

@ -34,7 +34,7 @@ class _RealmViewScreenState extends State<RealmViewScreen> {
final List<Channel> _channels = List.empty(growable: true); final List<Channel> _channels = List.empty(growable: true);
getRealm({String? overrideAlias}) async { getRealm({String? overrideAlias}) async {
final RealmProvider provider = Get.find(); final RealmProvider realm = Get.find();
setState(() => _isBusy = true); setState(() => _isBusy = true);
@ -43,7 +43,7 @@ class _RealmViewScreenState extends State<RealmViewScreen> {
} }
try { try {
final resp = await provider.getRealm(_overrideAlias ?? widget.alias); final resp = await realm.getRealm(_overrideAlias ?? widget.alias);
setState(() => _realm = Realm.fromJson(resp.body)); setState(() => _realm = Realm.fromJson(resp.body));
} catch (e) { } catch (e) {
context.showErrorDialog(e); context.showErrorDialog(e);
@ -55,14 +55,26 @@ class _RealmViewScreenState extends State<RealmViewScreen> {
getChannels() async { getChannels() async {
setState(() => _isBusy = true); setState(() => _isBusy = true);
final ChannelProvider provider = Get.find(); final ChannelProvider channel = Get.find();
final resp = await provider.listChannel(scope: _realm!.alias); final resp = await channel.listChannel(scope: _realm!.alias);
final availableResp = await channel.listAvailableChannel(
scope: _realm!.alias,
);
final Set<int> channelIdx = {};
setState(() { setState(() {
_channels.clear(); _channels.clear();
_channels.addAll( _channels.addAll(
resp.body.map((e) => Channel.fromJson(e)).toList().cast<Channel>(), resp.body.map((e) => Channel.fromJson(e)).toList().cast<Channel>(),
); );
_channels.addAll(
availableResp.body
.map((e) => Channel.fromJson(e))
.toList()
.cast<Channel>(),
);
_channels.retainWhere((x) => channelIdx.add(x.id));
}); });
setState(() => _isBusy = false); setState(() => _isBusy = false);

View File

@ -341,64 +341,67 @@ class _PostItemState extends State<PostItem> {
if (!snapshot.hasData || snapshot.data!.isEmpty) { if (!snapshot.hasData || snapshot.data!.isEmpty) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
return Card( return Container(
margin: EdgeInsets.zero, constraints: const BoxConstraints(maxWidth: 480),
child: Column( child: Card(
children: snapshot.data! margin: EdgeInsets.zero,
.map( child: Column(
(x) => Row( children: snapshot.data!
mainAxisAlignment: MainAxisAlignment.center, .map(
crossAxisAlignment: CrossAxisAlignment.start, (x) => Row(
children: [ mainAxisAlignment: MainAxisAlignment.center,
AccountAvatar(content: x.author.avatar, radius: 10), crossAxisAlignment: CrossAxisAlignment.start,
const Gap(6), children: [
Text( AccountAvatar(content: x.author.avatar, radius: 10),
x.author.nick, const Gap(6),
style: const TextStyle(fontWeight: FontWeight.bold), Text(
), x.author.nick,
const Gap(6), style: const TextStyle(fontWeight: FontWeight.bold),
Text(
format(
x.publishedAt?.toLocal() ?? DateTime.now(),
locale: 'en_short',
), ),
).paddingOnly(top: 0.5), const Gap(6),
const Gap(8), Text(
Expanded( format(
child: Column( x.publishedAt?.toLocal() ?? DateTime.now(),
crossAxisAlignment: CrossAxisAlignment.start, locale: 'en_short',
children: [ ),
MarkdownTextContent( ).paddingOnly(top: 0.5),
content: x.body['content'], const Gap(8),
parentId: 'p${item.id}-featured-reply${x.id}', Expanded(
), child: Column(
if (x.body['attachments'] is List && crossAxisAlignment: CrossAxisAlignment.start,
x.body['attachments'].length > 0) children: [
Row( MarkdownTextContent(
children: [ content: x.body['content'],
Icon( parentId: 'p${item.id}-featured-reply${x.id}',
Icons.file_copy,
size: 15,
color: unFocusColor,
).paddingOnly(right: 5),
Text(
'attachmentHint'.trParams(
{
'count': x.body['attachments'].length
.toString()
},
),
style: TextStyle(color: unFocusColor),
)
],
), ),
], if (x.body['attachments'] is List &&
x.body['attachments'].length > 0)
Row(
children: [
Icon(
Icons.file_copy,
size: 15,
color: unFocusColor,
).paddingOnly(right: 5),
Text(
'attachmentHint'.trParams(
{
'count': x.body['attachments'].length
.toString()
},
),
style: TextStyle(color: unFocusColor),
)
],
),
],
),
), ),
), ],
], ).paddingSymmetric(horizontal: 12, vertical: 8),
).paddingSymmetric(horizontal: 12, vertical: 8), )
) .toList(),
.toList(), ),
), ),
) )
.animate() .animate()

View File

@ -2,7 +2,7 @@ name: solian
description: "The Solar Network App" description: "The Solar Network App"
publish_to: "none" publish_to: "none"
version: 1.2.1+41 version: 1.2.2+2
environment: environment:
sdk: ">=3.3.4 <4.0.0" sdk: ">=3.3.4 <4.0.0"