Compare commits
14 Commits
2.2.2+52
...
3b1e918117
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b1e918117 | |||
| ed7981fdaf | |||
| 9698ca53e4 | |||
| ddc1dc7daf | |||
| 1625a957f8 | |||
| 2dc50d627e | |||
| 2ffde9a3dd | |||
| 5967a91ae1 | |||
| 32c1effcb5 | |||
| 9d0e19c56f | |||
| acf4e634fe | |||
| 25942c2338 | |||
| a4f81f6ba1 | |||
| c1b9090e51 |
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"sync": {
|
"sync": {
|
||||||
"region": "solian-next",
|
"region": "solian",
|
||||||
"configPath": "roadsign.toml"
|
"configPath": "roadsign.toml"
|
||||||
},
|
},
|
||||||
"deployments": [
|
"deployments": [
|
||||||
{
|
{
|
||||||
"region": "solian-next",
|
"region": "solian",
|
||||||
"site": "solian-next-web",
|
"site": "solian-web",
|
||||||
"path": "build/web"
|
"path": "build/web"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
android:label="Solian"
|
android:label="Solian"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
android:requestLegacyExternalStorage="true">
|
android:requestLegacyExternalStorage="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
|||||||
@@ -294,6 +294,7 @@
|
|||||||
"addAttachmentFromCameraPhoto": "Take photo",
|
"addAttachmentFromCameraPhoto": "Take photo",
|
||||||
"addAttachmentFromCameraVideo": "Take video",
|
"addAttachmentFromCameraVideo": "Take video",
|
||||||
"addAttachmentFromRandomId": "Link via RID",
|
"addAttachmentFromRandomId": "Link via RID",
|
||||||
|
"attachmentDetailInfo": "Attachment details",
|
||||||
"attachmentPastedImage": "Pasted Image",
|
"attachmentPastedImage": "Pasted Image",
|
||||||
"attachmentInsertLink": "Insert Link",
|
"attachmentInsertLink": "Insert Link",
|
||||||
"attachmentSetAsPostThumbnail": "Set as post thumbnail",
|
"attachmentSetAsPostThumbnail": "Set as post thumbnail",
|
||||||
|
|||||||
@@ -292,6 +292,7 @@
|
|||||||
"addAttachmentFromCameraPhoto": "拍摄照片",
|
"addAttachmentFromCameraPhoto": "拍摄照片",
|
||||||
"addAttachmentFromCameraVideo": "拍摄视频",
|
"addAttachmentFromCameraVideo": "拍摄视频",
|
||||||
"addAttachmentFromRandomId": "通过访问 ID 链接",
|
"addAttachmentFromRandomId": "通过访问 ID 链接",
|
||||||
|
"attachmentDetailInfo": "附件详细信息",
|
||||||
"attachmentPastedImage": "粘贴的图片",
|
"attachmentPastedImage": "粘贴的图片",
|
||||||
"attachmentInsertLink": "插入连接",
|
"attachmentInsertLink": "插入连接",
|
||||||
"attachmentSetAsPostThumbnail": "设置为帖子缩略图",
|
"attachmentSetAsPostThumbnail": "设置为帖子缩略图",
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class ChatMessageController extends ChangeNotifier {
|
|||||||
_wsSubscription = _ws.stream.stream.listen((event) {
|
_wsSubscription = _ws.stream.stream.listen((event) {
|
||||||
switch (event.method) {
|
switch (event.method) {
|
||||||
case 'events.new':
|
case 'events.new':
|
||||||
|
if (event.payload?['channel_id'] != channel?.id) break;
|
||||||
final payload = SnChatMessage.fromJson(event.payload!);
|
final payload = SnChatMessage.fromJson(event.payload!);
|
||||||
_addMessage(payload);
|
_addMessage(payload);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:surface/screens/abuse_report.dart';
|
import 'package:surface/screens/abuse_report.dart';
|
||||||
import 'package:surface/screens/account.dart';
|
import 'package:surface/screens/account.dart';
|
||||||
import 'package:surface/screens/account/pfp.dart';
|
import 'package:surface/screens/account/profile_page.dart';
|
||||||
import 'package:surface/screens/account/profile_edit.dart';
|
import 'package:surface/screens/account/profile_edit.dart';
|
||||||
import 'package:surface/screens/account/publishers/publisher_edit.dart';
|
import 'package:surface/screens/account/publishers/publisher_edit.dart';
|
||||||
import 'package:surface/screens/account/publishers/publisher_new.dart';
|
import 'package:surface/screens/account/publishers/publisher_new.dart';
|
||||||
|
|||||||
@@ -217,27 +217,48 @@ class _ExploreScreenState extends State<ExploreScreen> {
|
|||||||
hasReachedMax: _postCount != null && _posts.length >= _postCount!,
|
hasReachedMax: _postCount != null && _posts.length >= _postCount!,
|
||||||
onFetchData: _fetchPosts,
|
onFetchData: _fetchPosts,
|
||||||
itemBuilder: (context, idx) {
|
itemBuilder: (context, idx) {
|
||||||
return GestureDetector(
|
return Center(
|
||||||
child: PostItem(
|
child: Container(
|
||||||
data: _posts[idx],
|
decoration: BoxDecoration(
|
||||||
maxWidth: 640,
|
border: Border(
|
||||||
onChanged: (data) {
|
left: BorderSide(
|
||||||
setState(() => _posts[idx] = data);
|
color: Theme.of(context).dividerColor,
|
||||||
},
|
width: 1 / MediaQuery.of(context).devicePixelRatio,
|
||||||
onDeleted: () {
|
),
|
||||||
_refreshPosts();
|
right: BorderSide(
|
||||||
},
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 1 / MediaQuery.of(context).devicePixelRatio,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
constraints: const BoxConstraints(maxWidth: 640),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
child: PostItem(
|
||||||
|
data: _posts[idx],
|
||||||
|
maxWidth: 640,
|
||||||
|
onChanged: (data) {
|
||||||
|
setState(() => _posts[idx] = data);
|
||||||
|
},
|
||||||
|
onDeleted: () {
|
||||||
|
_refreshPosts();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
GoRouter.of(context).pushNamed(
|
||||||
|
'postDetail',
|
||||||
|
pathParameters: {'slug': _posts[idx].id.toString()},
|
||||||
|
extra: _posts[idx],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Divider(height: 1),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
|
||||||
GoRouter.of(context).pushNamed(
|
|
||||||
'postDetail',
|
|
||||||
pathParameters: {'slug': _posts[idx].id.toString()},
|
|
||||||
extra: _posts[idx],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) => const Divider(height: 1),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -303,19 +303,22 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
// Content Input Area
|
// Content Input Area
|
||||||
TextField(
|
Container(
|
||||||
controller: _writeController.contentController,
|
constraints: const BoxConstraints(maxWidth: 640),
|
||||||
maxLines: null,
|
child: TextField(
|
||||||
decoration: InputDecoration(
|
controller: _writeController.contentController,
|
||||||
hintText: 'fieldPostContent'.tr(),
|
maxLines: null,
|
||||||
hintStyle: TextStyle(fontSize: 14),
|
decoration: InputDecoration(
|
||||||
isCollapsed: true,
|
hintText: 'fieldPostContent'.tr(),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
hintStyle: TextStyle(fontSize: 14),
|
||||||
horizontal: 16,
|
isCollapsed: true,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
|
border: InputBorder.none,
|
||||||
),
|
),
|
||||||
border: InputBorder.none,
|
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
.expandIndexed(
|
.expandIndexed(
|
||||||
@@ -366,6 +369,15 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
LoadingIndicator(isActive: _isLoading),
|
||||||
|
if (_writeController.isBusy && _writeController.progress != null)
|
||||||
|
TweenAnimationBuilder<double>(
|
||||||
|
tween: Tween(begin: 0, end: _writeController.progress),
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
builder: (context, value, _) => LinearProgressIndicator(value: value, minHeight: 2),
|
||||||
|
)
|
||||||
|
else if (_writeController.isBusy)
|
||||||
|
const LinearProgressIndicator(value: null, minHeight: 2),
|
||||||
Container(
|
Container(
|
||||||
child: _writeController.temporaryRestored
|
child: _writeController.temporaryRestored
|
||||||
? Container(
|
? Container(
|
||||||
@@ -396,15 +408,6 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
)
|
)
|
||||||
.height(_writeController.temporaryRestored ? 32 : 0, animate: true)
|
.height(_writeController.temporaryRestored ? 32 : 0, animate: true)
|
||||||
.animate(const Duration(milliseconds: 300), Curves.fastLinearToSlowEaseIn),
|
.animate(const Duration(milliseconds: 300), Curves.fastLinearToSlowEaseIn),
|
||||||
LoadingIndicator(isActive: _isLoading),
|
|
||||||
if (_writeController.isBusy && _writeController.progress != null)
|
|
||||||
TweenAnimationBuilder<double>(
|
|
||||||
tween: Tween(begin: 0, end: _writeController.progress),
|
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
builder: (context, value, _) => LinearProgressIndicator(value: value, minHeight: 2),
|
|
||||||
)
|
|
||||||
else if (_writeController.isBusy)
|
|
||||||
const LinearProgressIndicator(value: null, minHeight: 2),
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
subtitle: Text('settingsThemeMaterial3Description').tr(),
|
subtitle: Text('settingsThemeMaterial3Description').tr(),
|
||||||
contentPadding: const EdgeInsets.only(left: 24, right: 17),
|
contentPadding: const EdgeInsets.only(left: 24, right: 17),
|
||||||
secondary: const Icon(Symbols.new_releases),
|
secondary: const Icon(Symbols.new_releases),
|
||||||
value: _prefs.getBool(kMaterialYouToggleStoreKey) ?? false,
|
value: _prefs.getBool(kMaterialYouToggleStoreKey) ?? true,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_prefs.setBool(
|
_prefs.setBool(
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Future<ThemeData> createAppTheme(
|
|||||||
final hasAppBarBlurry = prefs.getBool(kAppbarTransparentStoreKey) ?? false;
|
final hasAppBarBlurry = prefs.getBool(kAppbarTransparentStoreKey) ?? false;
|
||||||
|
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
useMaterial3: useMaterial3 ?? (prefs.getBool(kMaterialYouToggleStoreKey) ?? false),
|
useMaterial3: useMaterial3 ?? (prefs.getBool(kMaterialYouToggleStoreKey) ?? true),
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
iconTheme: IconThemeData(
|
iconTheme: IconThemeData(
|
||||||
@@ -52,5 +52,15 @@ Future<ThemeData> createAppTheme(
|
|||||||
foregroundColor: hasAppBarBlurry ? colorScheme.onSurface : colorScheme.onPrimary,
|
foregroundColor: hasAppBarBlurry ? colorScheme.onSurface : colorScheme.onPrimary,
|
||||||
),
|
),
|
||||||
scaffoldBackgroundColor: Colors.transparent,
|
scaffoldBackgroundColor: Colors.transparent,
|
||||||
|
pageTransitionsTheme: PageTransitionsTheme(
|
||||||
|
builders: {
|
||||||
|
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.iOS: ZoomPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.macOS: ZoomPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.fuchsia: ZoomPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.linux: ZoomPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.windows: ZoomPageTransitionsBuilder(),
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
164
lib/widgets/account/account_popover.dart
Normal file
164
lib/widgets/account/account_popover.dart
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gap/gap.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:relative_time/relative_time.dart';
|
||||||
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
import 'package:surface/providers/experience.dart';
|
||||||
|
import 'package:surface/providers/sn_network.dart';
|
||||||
|
import 'package:surface/screens/account/profile_page.dart';
|
||||||
|
import 'package:surface/types/account.dart';
|
||||||
|
import 'package:surface/widgets/account/account_image.dart';
|
||||||
|
import 'package:surface/widgets/universal_image.dart';
|
||||||
|
|
||||||
|
class AccountPopoverCard extends StatelessWidget {
|
||||||
|
final SnAccount data;
|
||||||
|
|
||||||
|
const AccountPopoverCard({super.key, required this.data});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final sn = context.read<SnNetworkProvider>();
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (data.banner.isNotEmpty)
|
||||||
|
Container(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 16 / 7,
|
||||||
|
child: AutoResizeUniversalImage(
|
||||||
|
sn.getAttachmentUrl(data.banner),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Top padding
|
||||||
|
Gap(16),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AccountImage(
|
||||||
|
content: data.avatar,
|
||||||
|
radius: 20,
|
||||||
|
),
|
||||||
|
Gap(16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(data.nick).bold(),
|
||||||
|
Text('@${data.name}').fontSize(13).opacity(0.75),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
GoRouter.of(context).pushNamed(
|
||||||
|
'accountProfilePage',
|
||||||
|
pathParameters: {'name': data.name},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Symbols.chevron_right),
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
|
||||||
|
),
|
||||||
|
const Gap(8)
|
||||||
|
],
|
||||||
|
).padding(horizontal: 16),
|
||||||
|
const Gap(16),
|
||||||
|
Wrap(
|
||||||
|
children: data.badges
|
||||||
|
.map(
|
||||||
|
(ele) => Tooltip(
|
||||||
|
richMessage: TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(text: kBadgesMeta[ele.type]?.$1.tr() ?? 'unknown'.tr()),
|
||||||
|
if (ele.metadata['title'] != null)
|
||||||
|
TextSpan(
|
||||||
|
text: '\n${ele.metadata['title']}',
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
TextSpan(text: '\n'),
|
||||||
|
TextSpan(
|
||||||
|
text: DateFormat.yMEd().format(ele.createdAt),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
kBadgesMeta[ele.type]?.$2 ?? Symbols.question_mark,
|
||||||
|
color: kBadgesMeta[ele.type]?.$3,
|
||||||
|
fill: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
).padding(horizontal: 24),
|
||||||
|
const Gap(8),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.star),
|
||||||
|
const Gap(8),
|
||||||
|
Text('Lv${getLevelFromExp(data.profile?.experience ?? 0)}'),
|
||||||
|
const Gap(8),
|
||||||
|
Text(calcLevelUpProgressLevel(data.profile?.experience ?? 0)).fontSize(11).opacity(0.5),
|
||||||
|
const Gap(8),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
constraints: const BoxConstraints(maxWidth: 160),
|
||||||
|
child: LinearProgressIndicator(
|
||||||
|
value: calcLevelUpProgress(data.profile?.experience ?? 0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
).alignment(Alignment.centerLeft),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 24),
|
||||||
|
FutureBuilder(
|
||||||
|
future: sn.client.get('/cgi/id/users/${data.name}/status'),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final SnAccountStatusInfo? status =
|
||||||
|
snapshot.hasData ? SnAccountStatusInfo.fromJson(snapshot.data!.data) : null;
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Symbols.circle,
|
||||||
|
fill: 1,
|
||||||
|
size: 16,
|
||||||
|
color: (status?.isOnline ?? false) ? Colors.green : Colors.grey,
|
||||||
|
).padding(all: 4),
|
||||||
|
const Gap(8),
|
||||||
|
Text(
|
||||||
|
status != null
|
||||||
|
? status.isOnline
|
||||||
|
? 'accountStatusOnline'.tr()
|
||||||
|
: 'accountStatusOffline'.tr()
|
||||||
|
: 'loading'.tr(),
|
||||||
|
),
|
||||||
|
if (status != null && !status.isOnline && status.lastSeenAt != null)
|
||||||
|
Text(
|
||||||
|
'accountStatusLastSeen'.tr(args: [
|
||||||
|
status.lastSeenAt != null
|
||||||
|
? RelativeTime(context).format(
|
||||||
|
status.lastSeenAt!.toLocal(),
|
||||||
|
)
|
||||||
|
: 'unknown',
|
||||||
|
]),
|
||||||
|
).padding(left: 6).opacity(0.75),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 24);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Bottom padding
|
||||||
|
const Gap(16),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -106,6 +106,44 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (widget.gridded) {
|
if (widget.gridded) {
|
||||||
|
final fullOfImage =
|
||||||
|
widget.data.where((ele) => ele?.mediaType == SnMediaType.image).length == widget.data.length;
|
||||||
|
if(!fullOfImage) {
|
||||||
|
return Container(
|
||||||
|
margin: widget.padding ?? EdgeInsets.zero,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: backgroundColor,
|
||||||
|
border: Border(
|
||||||
|
top: borderSide,
|
||||||
|
bottom: borderSide,
|
||||||
|
),
|
||||||
|
borderRadius: AttachmentList.kDefaultRadius,
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: AttachmentList.kDefaultRadius,
|
||||||
|
child: Column(
|
||||||
|
spacing: 4,
|
||||||
|
children: widget.data
|
||||||
|
.mapIndexed(
|
||||||
|
(idx, ele) => GestureDetector(
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: ele?.data['ratio']?.toDouble() ?? 1,
|
||||||
|
child: Container(
|
||||||
|
constraints: constraints,
|
||||||
|
child: AttachmentItem(
|
||||||
|
data: ele,
|
||||||
|
heroTag: heroTags[idx],
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
return Container(
|
return Container(
|
||||||
margin: widget.padding ?? EdgeInsets.zero,
|
margin: widget.padding ?? EdgeInsets.zero,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ class _AttachmentZoomViewState extends State<AttachmentZoomView> {
|
|||||||
|
|
||||||
Color get _unFocusColor => Theme.of(context).colorScheme.onSurface.withOpacity(0.75);
|
Color get _unFocusColor => Theme.of(context).colorScheme.onSurface.withOpacity(0.75);
|
||||||
|
|
||||||
|
bool _showDetail = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final sn = context.read<SnNetworkProvider>();
|
final sn = context.read<SnNetworkProvider>();
|
||||||
@@ -144,218 +146,348 @@ class _AttachmentZoomViewState extends State<AttachmentZoomView> {
|
|||||||
onDismissed: () {
|
onDismissed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
direction: DismissiblePageDismissDirection.down,
|
direction: DismissiblePageDismissDirection.none,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
isFullScreen: true,
|
isFullScreen: true,
|
||||||
child: Scaffold(
|
child: GestureDetector(
|
||||||
body: Stack(
|
behavior: HitTestBehavior.translucent,
|
||||||
children: [
|
child: Scaffold(
|
||||||
Builder(builder: (context) {
|
body: Stack(
|
||||||
if (widget.data.length == 1) {
|
children: [
|
||||||
final heroTag = widget.heroTags?.first ?? uuid.v4();
|
Builder(builder: (context) {
|
||||||
return Hero(
|
if (widget.data.length == 1) {
|
||||||
tag: 'attachment-${widget.data.first.rid}-$heroTag',
|
final heroTag = widget.heroTags?.first ?? uuid.v4();
|
||||||
child: PhotoView(
|
return Hero(
|
||||||
key: Key('attachment-detail-${widget.data.first.rid}-$heroTag'),
|
tag: 'attachment-${widget.data.first.rid}-$heroTag',
|
||||||
backgroundDecoration: BoxDecoration(color: Colors.transparent),
|
child: PhotoView(
|
||||||
imageProvider: UniversalImage.provider(
|
key: Key('attachment-detail-${widget.data.first.rid}-$heroTag'),
|
||||||
sn.getAttachmentUrl(widget.data.first.rid),
|
backgroundDecoration: BoxDecoration(color: Colors.transparent),
|
||||||
),
|
imageProvider: UniversalImage.provider(
|
||||||
),
|
sn.getAttachmentUrl(widget.data.first.rid),
|
||||||
);
|
),
|
||||||
}
|
|
||||||
|
|
||||||
return PhotoViewGallery.builder(
|
|
||||||
pageController: _pageController,
|
|
||||||
scrollPhysics: const BouncingScrollPhysics(),
|
|
||||||
builder: (context, idx) {
|
|
||||||
final heroTag = widget.heroTags?.elementAt(idx) ?? uuid.v4();
|
|
||||||
return PhotoViewGalleryPageOptions(
|
|
||||||
imageProvider: UniversalImage.provider(
|
|
||||||
sn.getAttachmentUrl(widget.data.elementAt(idx).rid),
|
|
||||||
),
|
|
||||||
heroAttributes: PhotoViewHeroAttributes(
|
|
||||||
tag: 'attachment-${widget.data.first.rid}-$heroTag',
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
itemCount: widget.data.length,
|
|
||||||
loadingBuilder: (context, event) => Center(
|
return PhotoViewGallery.builder(
|
||||||
child: SizedBox(
|
pageController: _pageController,
|
||||||
width: 20.0,
|
scrollPhysics: const BouncingScrollPhysics(),
|
||||||
height: 20.0,
|
builder: (context, idx) {
|
||||||
child: CircularProgressIndicator(
|
final heroTag = widget.heroTags?.elementAt(idx) ?? uuid.v4();
|
||||||
value: event == null ? 0 : event.cumulativeBytesLoaded / (event.expectedTotalBytes ?? 1),
|
return PhotoViewGalleryPageOptions(
|
||||||
|
imageProvider: UniversalImage.provider(
|
||||||
|
sn.getAttachmentUrl(widget.data.elementAt(idx).rid),
|
||||||
|
),
|
||||||
|
heroAttributes: PhotoViewHeroAttributes(
|
||||||
|
tag: 'attachment-${widget.data.first.rid}-$heroTag',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: widget.data.length,
|
||||||
|
loadingBuilder: (context, event) => Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 20.0,
|
||||||
|
height: 20.0,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
value: event == null ? 0 : event.cumulativeBytesLoaded / (event.expectedTotalBytes ?? 1),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
backgroundDecoration: BoxDecoration(color: Colors.transparent),
|
||||||
backgroundDecoration: BoxDecoration(color: Colors.transparent),
|
);
|
||||||
);
|
}),
|
||||||
}),
|
Align(
|
||||||
Align(
|
alignment: Alignment.bottomCenter,
|
||||||
alignment: Alignment.bottomCenter,
|
child: IgnorePointer(
|
||||||
child: IgnorePointer(
|
child: Container(
|
||||||
child: Container(
|
height: 300,
|
||||||
height: 300,
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
gradient: LinearGradient(
|
||||||
gradient: LinearGradient(
|
begin: Alignment.bottomCenter,
|
||||||
begin: Alignment.bottomCenter,
|
end: Alignment.topCenter,
|
||||||
end: Alignment.topCenter,
|
colors: [
|
||||||
colors: [
|
Theme.of(context).colorScheme.surface,
|
||||||
Theme.of(context).colorScheme.surface,
|
Colors.transparent,
|
||||||
Colors.transparent,
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
Positioned(
|
left: 16,
|
||||||
left: 16,
|
right: 16,
|
||||||
right: 16,
|
bottom: 16 + MediaQuery.of(context).padding.bottom,
|
||||||
bottom: 16 + MediaQuery.of(context).padding.bottom,
|
child: Material(
|
||||||
child: Material(
|
color: Colors.transparent,
|
||||||
color: Colors.transparent,
|
child: Builder(builder: (context) {
|
||||||
child: Builder(builder: (context) {
|
final ud = context.read<UserDirectoryProvider>();
|
||||||
final ud = context.read<UserDirectoryProvider>();
|
final item = widget.data.elementAt(
|
||||||
final item = widget.data.elementAt(
|
widget.data.length > 1 ? _pageController.page?.round() ?? 0 : 0,
|
||||||
widget.data.length > 1 ? _pageController.page?.round() ?? 0 : 0,
|
);
|
||||||
);
|
final account = ud.getAccountFromCache(item.accountId);
|
||||||
final account = ud.getAccountFromCache(item.accountId);
|
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (item.accountId > 0)
|
if (item.accountId > 0)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
IgnorePointer(
|
IgnorePointer(
|
||||||
child: AccountImage(
|
child: AccountImage(
|
||||||
content: account?.avatar,
|
content: account?.avatar,
|
||||||
radius: 19,
|
radius: 19,
|
||||||
),
|
|
||||||
),
|
|
||||||
const Gap(8),
|
|
||||||
Expanded(
|
|
||||||
child: IgnorePointer(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'attachmentUploadBy'.tr(),
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
account?.nick ?? 'unknown'.tr(),
|
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const Gap(8),
|
||||||
if (widget.data.length > 1)
|
Expanded(
|
||||||
IgnorePointer(
|
child: IgnorePointer(
|
||||||
child: Text(
|
child: Column(
|
||||||
'${(_pageController.page?.round() ?? 0) + 1}/${widget.data.length}',
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
style: GoogleFonts.robotoMono(fontSize: 13),
|
children: [
|
||||||
).padding(right: 8),
|
Text(
|
||||||
),
|
'attachmentUploadBy'.tr(),
|
||||||
InkWell(
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
|
||||||
onTap: _isDownloading
|
|
||||||
? null
|
|
||||||
: () => _saveToAlbum(widget.data.length > 1 ? _pageController.page?.round() ?? 0 : 0),
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(6),
|
|
||||||
child: !_isDownloading
|
|
||||||
? !_isCompletedDownload
|
|
||||||
? const Icon(Symbols.save_alt)
|
|
||||||
: const Icon(Symbols.download_done)
|
|
||||||
: SizedBox(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
value: _progressOfDownload,
|
|
||||||
strokeWidth: 3,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
account?.nick ?? 'unknown'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
if (widget.data.length > 1)
|
||||||
|
IgnorePointer(
|
||||||
|
child: Text(
|
||||||
|
'${(_pageController.page?.round() ?? 0) + 1}/${widget.data.length}',
|
||||||
|
style: GoogleFonts.robotoMono(fontSize: 13),
|
||||||
|
).padding(right: 8),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
|
onTap: _isDownloading
|
||||||
|
? null
|
||||||
|
: () =>
|
||||||
|
_saveToAlbum(widget.data.length > 1 ? _pageController.page?.round() ?? 0 : 0),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(6),
|
||||||
|
child: !_isDownloading
|
||||||
|
? !_isCompletedDownload
|
||||||
|
? const Icon(Symbols.save_alt)
|
||||||
|
: const Icon(Symbols.download_done)
|
||||||
|
: SizedBox(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
value: _progressOfDownload,
|
||||||
|
strokeWidth: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Gap(4),
|
||||||
|
IgnorePointer(
|
||||||
|
child: Text(
|
||||||
|
item.alt,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
const Gap(4),
|
|
||||||
IgnorePointer(
|
|
||||||
child: Text(
|
|
||||||
item.alt,
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const Gap(2),
|
||||||
const Gap(2),
|
IgnorePointer(
|
||||||
IgnorePointer(
|
child: Wrap(
|
||||||
child: Wrap(
|
spacing: 6,
|
||||||
spacing: 6,
|
children: [
|
||||||
children: [
|
if (item.metadata['exif'] == null)
|
||||||
if (item.metadata['exif'] == null)
|
Text(
|
||||||
|
'#${item.rid}',
|
||||||
|
style: metaTextStyle,
|
||||||
|
),
|
||||||
|
if (item.metadata['exif']?['Model'] != null)
|
||||||
|
Text(
|
||||||
|
'attachmentShotOn'.tr(args: [
|
||||||
|
item.metadata['exif']?['Model'],
|
||||||
|
]),
|
||||||
|
style: metaTextStyle,
|
||||||
|
).padding(right: 2),
|
||||||
|
if (item.metadata['exif']?['ISO'] != null)
|
||||||
|
Text(
|
||||||
|
'ISO${item.metadata['exif']?['ISO']}',
|
||||||
|
style: metaTextStyle,
|
||||||
|
).padding(right: 2),
|
||||||
|
if (item.metadata['exif']?['Aperture'] != null)
|
||||||
|
Text(
|
||||||
|
'f/${item.metadata['exif']?['Aperture']}',
|
||||||
|
style: metaTextStyle,
|
||||||
|
).padding(right: 2),
|
||||||
|
if (item.metadata['exif']?['Megapixels'] != null &&
|
||||||
|
item.metadata['exif']?['Model'] != null)
|
||||||
|
Text(
|
||||||
|
'${item.metadata['exif']?['Megapixels']}MP',
|
||||||
|
style: metaTextStyle,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Text(
|
||||||
|
item.size.formatBytes(),
|
||||||
|
style: metaTextStyle,
|
||||||
|
),
|
||||||
|
if (item.metadata['width'] != null && item.metadata['height'] != null)
|
||||||
|
Text(
|
||||||
|
'${item.metadata['width']}x${item.metadata['height']}',
|
||||||
|
style: metaTextStyle,
|
||||||
|
),
|
||||||
|
if (item.metadata['ratio'] != null)
|
||||||
|
Text(
|
||||||
|
(item.metadata['ratio'] as num).toStringAsFixed(2),
|
||||||
|
style: metaTextStyle,
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
'#${item.rid}',
|
item.mimetype,
|
||||||
style: metaTextStyle,
|
style: metaTextStyle,
|
||||||
),
|
),
|
||||||
if (item.metadata['exif']?['Model'] != null)
|
],
|
||||||
Text(
|
),
|
||||||
'attachmentShotOn'.tr(args: [
|
|
||||||
item.metadata['exif']?['Model'],
|
|
||||||
]),
|
|
||||||
style: metaTextStyle,
|
|
||||||
).padding(right: 2),
|
|
||||||
if (item.metadata['exif']?['ISO'] != null)
|
|
||||||
Text(
|
|
||||||
'ISO${item.metadata['exif']?['ISO']}',
|
|
||||||
style: metaTextStyle,
|
|
||||||
).padding(right: 2),
|
|
||||||
if (item.metadata['exif']?['Aperture'] != null)
|
|
||||||
Text(
|
|
||||||
'f/${item.metadata['exif']?['Aperture']}',
|
|
||||||
style: metaTextStyle,
|
|
||||||
).padding(right: 2),
|
|
||||||
if (item.metadata['exif']?['Megapixels'] != null && item.metadata['exif']?['Model'] != null)
|
|
||||||
Text(
|
|
||||||
'${item.metadata['exif']?['Megapixels']}MP',
|
|
||||||
style: metaTextStyle,
|
|
||||||
)
|
|
||||||
else
|
|
||||||
Text(
|
|
||||||
item.size.formatBytes(),
|
|
||||||
style: metaTextStyle,
|
|
||||||
),
|
|
||||||
if (item.metadata['width'] != null && item.metadata['height'] != null)
|
|
||||||
Text(
|
|
||||||
'${item.metadata['width']}x${item.metadata['height']}',
|
|
||||||
style: metaTextStyle,
|
|
||||||
),
|
|
||||||
if (item.metadata['ratio'] != null)
|
|
||||||
Text(
|
|
||||||
(item.metadata['ratio'] as num).toStringAsFixed(2),
|
|
||||||
style: metaTextStyle,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.mimetype,
|
|
||||||
style: metaTextStyle,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
);
|
}),
|
||||||
}),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
|
onVerticalDragUpdate: (details) {
|
||||||
|
if (_showDetail) return;
|
||||||
|
if (details.delta.dy < 0) {
|
||||||
|
_showDetail = true;
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => _AttachmentZoomDetailPopup(
|
||||||
|
data: widget.data.elementAt(widget.data.length > 1 ? _pageController.page?.round() ?? 0 : 0),
|
||||||
|
),
|
||||||
|
).then((_) {
|
||||||
|
_showDetail = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AttachmentZoomDetailPopup extends StatelessWidget {
|
||||||
|
final SnAttachment data;
|
||||||
|
|
||||||
|
const _AttachmentZoomDetailPopup({required this.data});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final ud = context.read<UserDirectoryProvider>();
|
||||||
|
final account = ud.getAccountFromCache(data.accountId);
|
||||||
|
|
||||||
|
const tableGap = TableRow(
|
||||||
|
children: [
|
||||||
|
TableCell(child: SizedBox(height: 16)),
|
||||||
|
TableCell(child: SizedBox(height: 16)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
return SizedBox(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.info, size: 24),
|
||||||
|
const Gap(16),
|
||||||
|
Text('attachmentDetailInfo').tr().textStyle(Theme.of(context).textTheme.titleLarge!),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 20, top: 16, bottom: 12),
|
||||||
|
Expanded(
|
||||||
|
child: Table(
|
||||||
|
columnWidths: {
|
||||||
|
0: IntrinsicColumnWidth(),
|
||||||
|
1: FlexColumnWidth(),
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
TableCell(
|
||||||
|
child: Text('attachmentUploadBy').tr().padding(right: 16),
|
||||||
|
),
|
||||||
|
TableCell(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (data.accountId > 0)
|
||||||
|
AccountImage(
|
||||||
|
content: account?.avatar,
|
||||||
|
radius: 8,
|
||||||
|
),
|
||||||
|
const Gap(8),
|
||||||
|
Text(data.accountId > 0 ? account?.nick ?? 'unknown'.tr() : 'unknown'.tr()),
|
||||||
|
const Gap(8),
|
||||||
|
Text('#${data.accountId}', style: GoogleFonts.robotoMono()).opacity(0.75),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
tableGap,
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
TableCell(child: Text('Mimetype').padding(right: 16)),
|
||||||
|
TableCell(child: Text(data.mimetype)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
TableCell(child: Text('Size').padding(right: 16)),
|
||||||
|
TableCell(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(data.size.formatBytes()),
|
||||||
|
const Gap(12),
|
||||||
|
Text('${data.size} Bytes', style: GoogleFonts.robotoMono()).opacity(0.75),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
TableCell(child: Text('Name').padding(right: 16)),
|
||||||
|
TableCell(child: Text(data.name)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (data.hash.isNotEmpty)
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
TableCell(child: Text('Hash').padding(right: 16)),
|
||||||
|
TableCell(child: Text(data.hash, style: GoogleFonts.robotoMono(fontSize: 11)).opacity(0.9)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
tableGap,
|
||||||
|
...(data.metadata['exif']?.keys.map((k) => TableRow(
|
||||||
|
children: [
|
||||||
|
TableCell(child: Text(k).padding(right: 16)),
|
||||||
|
TableCell(child: Text(data.metadata['exif'][k].toString())),
|
||||||
|
],
|
||||||
|
)) ??
|
||||||
|
[]),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 20, vertical: 8),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_context_menu/flutter_context_menu.dart';
|
import 'package:flutter_context_menu/flutter_context_menu.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
|
import 'package:popover/popover.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:surface/providers/user_directory.dart';
|
import 'package:surface/providers/user_directory.dart';
|
||||||
import 'package:surface/providers/userinfo.dart';
|
import 'package:surface/providers/userinfo.dart';
|
||||||
import 'package:surface/types/chat.dart';
|
import 'package:surface/types/chat.dart';
|
||||||
import 'package:surface/widgets/account/account_image.dart';
|
import 'package:surface/widgets/account/account_image.dart';
|
||||||
|
import 'package:surface/widgets/account/account_popover.dart';
|
||||||
import 'package:surface/widgets/attachment/attachment_list.dart';
|
import 'package:surface/widgets/attachment/attachment_list.dart';
|
||||||
import 'package:surface/widgets/context_menu.dart';
|
import 'package:surface/widgets/context_menu.dart';
|
||||||
import 'package:surface/widgets/link_preview.dart';
|
import 'package:surface/widgets/link_preview.dart';
|
||||||
@@ -95,8 +99,28 @@ class ChatMessage extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (!isMerged && !isCompact)
|
if (!isMerged && !isCompact)
|
||||||
AccountImage(
|
GestureDetector(
|
||||||
content: user?.avatar,
|
child: AccountImage(
|
||||||
|
content: user?.avatar,
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
if (user == null) return;
|
||||||
|
showPopover(
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
context: context,
|
||||||
|
transition: PopoverTransition.other,
|
||||||
|
bodyBuilder: (context) => SizedBox(
|
||||||
|
width: math.min(400, MediaQuery.of(context).size.width - 10),
|
||||||
|
child: AccountPopoverCard(
|
||||||
|
data: user,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
direction: PopoverDirection.bottom,
|
||||||
|
arrowHeight: 5,
|
||||||
|
arrowWidth: 15,
|
||||||
|
arrowDxOffset: -190,
|
||||||
|
);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
else if (isMerged)
|
else if (isMerged)
|
||||||
const Gap(40),
|
const Gap(40),
|
||||||
@@ -251,9 +275,12 @@ class _ChatMessageText extends StatelessWidget {
|
|||||||
buttonItems: items,
|
buttonItems: items,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: MarkdownTextContent(
|
child: Container(
|
||||||
content: data.body['text'],
|
constraints: const BoxConstraints(maxWidth: 480),
|
||||||
isAutoWarp: true,
|
child: MarkdownTextContent(
|
||||||
|
content: data.body['text'],
|
||||||
|
isAutoWarp: true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (data.updatedAt != data.createdAt)
|
if (data.updatedAt != data.createdAt)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
// Send the message
|
// Send the message
|
||||||
// NOTICE This future should not be awaited, so that the message can be sent in the background and the user can continue to type
|
// NOTICE This future should not be awaited, so that the message can be sent in the background and the user can continue to type
|
||||||
widget.controller.sendMessage(
|
widget.controller.sendMessage(
|
||||||
'messages.new',
|
_editingMessage != null ? 'messages.edit' : 'messages.new',
|
||||||
_contentController.text,
|
_contentController.text,
|
||||||
attachments: _attachments.where((e) => e.attachment != null).map((e) => e.attachment!.rid).toList(),
|
attachments: _attachments.where((e) => e.attachment != null).map((e) => e.attachment!.rid).toList(),
|
||||||
relatedId: _editingMessage?.id,
|
relatedId: _editingMessage?.id,
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ class _AppRailNavigationState extends State<AppRailNavigation> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
context
|
context.read<NavigationProvider>().autoDetectIndex(GoRouter.maybeOf(context));
|
||||||
.read<NavigationProvider>()
|
|
||||||
.autoDetectIndex(GoRouter.maybeOf(context));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,11 +29,11 @@ class _AppRailNavigationState extends State<AppRailNavigation> {
|
|||||||
return ListenableBuilder(
|
return ListenableBuilder(
|
||||||
listenable: nav,
|
listenable: nav,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
final destinations =
|
final destinations = nav.destinations.where((ele) => ele.isPinned).toList();
|
||||||
nav.destinations.where((ele) => ele.isPinned).toList();
|
|
||||||
|
|
||||||
return NavigationRail(
|
return NavigationRail(
|
||||||
selectedIndex: nav.currentIndex,
|
selectedIndex:
|
||||||
|
nav.currentIndex != null && nav.currentIndex! < nav.pinnedDestinationCount ? nav.currentIndex : null,
|
||||||
destinations: [
|
destinations: [
|
||||||
...destinations.where((ele) => ele.isPinned).map((ele) {
|
...destinations.where((ele) => ele.isPinned).map((ele) {
|
||||||
return NavigationRailDestination(
|
return NavigationRailDestination(
|
||||||
|
|||||||
@@ -880,6 +880,7 @@ class _PostContentBody extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (data.body['content'] == null) return const SizedBox.shrink();
|
if (data.body['content'] == null) return const SizedBox.shrink();
|
||||||
final content = MarkdownTextContent(
|
final content = MarkdownTextContent(
|
||||||
|
isAutoWarp: data.type == 'story',
|
||||||
isEnlargeSticker: true,
|
isEnlargeSticker: true,
|
||||||
textScaler: isEnlarge ? TextScaler.linear(1.1) : null,
|
textScaler: isEnlarge ? TextScaler.linear(1.1) : null,
|
||||||
content: data.body['content'],
|
content: data.body['content'],
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 2.2.2+52
|
version: 2.2.2+53
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
id = "solian-next"
|
id = "solian"
|
||||||
|
|
||||||
[[locations]]
|
[[locations]]
|
||||||
id = "solian-next"
|
id = "solian"
|
||||||
host = ["sn-next.solsynth.dev"]
|
hosts = ["sn.solsynth.dev"]
|
||||||
path = ["/"]
|
paths = ["/"]
|
||||||
[[locations.destinations]]
|
[[locations.destinations]]
|
||||||
id = "solian-next-web"
|
id = "solian-web"
|
||||||
uri = "files:///workdir/solian-next?fallback=index.html&index=index.html"
|
uri = "files:///workdir/solian?fallback=index.html&index=index.html"
|
||||||
|
|||||||
Reference in New Issue
Block a user