Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
7c0c1ec94f | |||
272044a77e | |||
39c22b1cf6 | |||
98c3bb912d | |||
035b92d9b8 | |||
0bfc0bd61b | |||
de00a20eee | |||
73982f48d6 | |||
1d36b30361 | |||
dea743a307 | |||
c48bd3e758 | |||
56bbf73b5e | |||
4f6c5aa053 | |||
d8e79fb4f9 | |||
06e0fa465b | |||
895a257f50 | |||
d9804ba00b | |||
62ff1c2f1c | |||
a157596a2e | |||
12102bf527 | |||
c00a018380 | |||
53b3cac4ca | |||
19eabfaba1 | |||
ec2eadad6d | |||
54e176e75d | |||
0a7ccaeefa | |||
a5f093e185 | |||
a4f68dd175 | |||
8067c35c70 | |||
ebe381053e | |||
03f2470dae | |||
ea434815cf | |||
bbea4b4359 | |||
e0b485cc81 | |||
87bb37ac01 | |||
989b5babd9 |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 406 KiB |
BIN
assets/icon.png
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 360 KiB |
BIN
assets/logo.png
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 360 KiB |
@ -71,6 +71,8 @@ PODS:
|
|||||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
|
- flutter_keyboard_visibility (0.0.1):
|
||||||
|
- Flutter
|
||||||
- flutter_secure_storage (6.0.0):
|
- flutter_secure_storage (6.0.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_webrtc (0.11.3):
|
- flutter_webrtc (0.11.3):
|
||||||
@ -136,6 +138,8 @@ PODS:
|
|||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- permission_handler_apple (9.3.0):
|
- permission_handler_apple (9.3.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- pointer_interceptor_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
- PromisesObjC (2.4.0)
|
- PromisesObjC (2.4.0)
|
||||||
- protocol_handler_ios (0.0.1):
|
- protocol_handler_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
@ -174,6 +178,7 @@ DEPENDENCIES:
|
|||||||
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||||
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
|
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||||
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
|
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
|
||||||
- gal (from `.symlinks/plugins/gal/darwin`)
|
- gal (from `.symlinks/plugins/gal/darwin`)
|
||||||
@ -187,6 +192,7 @@ DEPENDENCIES:
|
|||||||
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
|
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
|
||||||
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
||||||
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
|
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
|
||||||
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
|
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
|
||||||
@ -229,6 +235,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/firebase_messaging/ios"
|
:path: ".symlinks/plugins/firebase_messaging/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
|
flutter_keyboard_visibility:
|
||||||
|
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
||||||
flutter_secure_storage:
|
flutter_secure_storage:
|
||||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||||
flutter_webrtc:
|
flutter_webrtc:
|
||||||
@ -255,6 +263,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
permission_handler_apple:
|
permission_handler_apple:
|
||||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
|
pointer_interceptor_ios:
|
||||||
|
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
|
||||||
protocol_handler_ios:
|
protocol_handler_ios:
|
||||||
:path: ".symlinks/plugins/protocol_handler_ios/ios"
|
:path: ".symlinks/plugins/protocol_handler_ios/ios"
|
||||||
screen_brightness_ios:
|
screen_brightness_ios:
|
||||||
@ -288,6 +298,7 @@ SPEC CHECKSUMS:
|
|||||||
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
|
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
|
||||||
FirebaseMessaging: 7b5d8033e183ab59eb5b852a53201559e976d366
|
FirebaseMessaging: 7b5d8033e183ab59eb5b852a53201559e976d366
|
||||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||||
|
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||||
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
||||||
flutter_webrtc: 75b868e4f9e817c7a9a42ca4b6169063de4eec9f
|
flutter_webrtc: 75b868e4f9e817c7a9a42ca4b6169063de4eec9f
|
||||||
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
|
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
|
||||||
@ -304,6 +315,7 @@ SPEC CHECKSUMS:
|
|||||||
pasteboard: 982969ebaa7c78af3e6cc7761e8f5e77565d9ce0
|
pasteboard: 982969ebaa7c78af3e6cc7761e8f5e77565d9ce0
|
||||||
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
||||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
|
pointer_interceptor_ios: 508241697ff0947f853c061945a8b822463947c1
|
||||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||||
protocol_handler_ios: a5db8abc38526ee326988b808be621e5fd568990
|
protocol_handler_ios: a5db8abc38526ee326988b808be621e5fd568990
|
||||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||||
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 320 KiB |
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 822 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 20 KiB |
@ -1,12 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:solian/exts.dart';
|
import 'package:solian/exts.dart';
|
||||||
|
import 'package:solian/platform.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/providers/content/channel.dart';
|
import 'package:solian/providers/content/channel.dart';
|
||||||
import 'package:solian/providers/content/realm.dart';
|
import 'package:solian/providers/content/realm.dart';
|
||||||
import 'package:solian/providers/relation.dart';
|
import 'package:solian/providers/relation.dart';
|
||||||
|
import 'package:solian/providers/stickers.dart';
|
||||||
import 'package:solian/providers/theme_switcher.dart';
|
import 'package:solian/providers/theme_switcher.dart';
|
||||||
import 'package:solian/providers/websocket.dart';
|
import 'package:solian/providers/websocket.dart';
|
||||||
import 'package:solian/services.dart';
|
import 'package:solian/services.dart';
|
||||||
@ -24,6 +26,7 @@ class BootstrapperShell extends StatefulWidget {
|
|||||||
class _BootstrapperShellState extends State<BootstrapperShell> {
|
class _BootstrapperShellState extends State<BootstrapperShell> {
|
||||||
bool _isBusy = true;
|
bool _isBusy = true;
|
||||||
bool _isErrored = false;
|
bool _isErrored = false;
|
||||||
|
bool _isDismissable = true;
|
||||||
String? _subtitle;
|
String? _subtitle;
|
||||||
|
|
||||||
Color get _unFocusColor =>
|
Color get _unFocusColor =>
|
||||||
@ -38,6 +41,32 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
await context.read<ThemeSwitcher>().restoreTheme();
|
await context.read<ThemeSwitcher>().restoreTheme();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
label: 'bsCheckForUpdate',
|
||||||
|
action: () async {
|
||||||
|
if (PlatformInfo.isWeb) return;
|
||||||
|
try {
|
||||||
|
final info = await PackageInfo.fromPlatform();
|
||||||
|
final localVersionString = '${info.version}+${info.buildNumber}';
|
||||||
|
final resp = await GetConnect().get(
|
||||||
|
'https://git.solsynth.dev/api/v1/repos/hydrogen/solian/tags?limit=1',
|
||||||
|
);
|
||||||
|
if (resp.body[0]['name'] != localVersionString) {
|
||||||
|
setState(() {
|
||||||
|
_isErrored = true;
|
||||||
|
_subtitle = PlatformInfo.isIOS || PlatformInfo.isMacOS
|
||||||
|
? 'bsCheckForUpdateDescApple'.tr
|
||||||
|
: 'bsCheckForUpdateDescCommon'.tr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_isErrored = true;
|
||||||
|
_subtitle = 'bsCheckForUpdateFailed'.tr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
(
|
(
|
||||||
label: 'bsCheckingServer',
|
label: 'bsCheckingServer',
|
||||||
action: () async {
|
action: () async {
|
||||||
@ -47,12 +76,14 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_isErrored = true;
|
_isErrored = true;
|
||||||
_subtitle = 'bsCheckingServerDown'.tr;
|
_subtitle = 'bsCheckingServerDown'.tr;
|
||||||
|
_isDismissable = false;
|
||||||
});
|
});
|
||||||
throw Exception('unable connect to server');
|
throw Exception('unable connect to server');
|
||||||
} else if (resp.statusCode == null) {
|
} else if (resp.statusCode == null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isErrored = true;
|
_isErrored = true;
|
||||||
_subtitle = 'bsCheckingServerFail'.tr;
|
_subtitle = 'bsCheckingServerFail'.tr;
|
||||||
|
_isDismissable = false;
|
||||||
});
|
});
|
||||||
throw Exception('unable connect to server');
|
throw Exception('unable connect to server');
|
||||||
}
|
}
|
||||||
@ -81,13 +112,15 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
label: 'bsPreparingData',
|
label: 'bsPreparingData',
|
||||||
action: () async {
|
action: () async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isTrue) {
|
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
Get.find<RealmProvider>().refreshAvailableRealms(),
|
Get.find<StickerProvider>().refreshAvailableStickers(),
|
||||||
|
if (auth.isAuthorized.isTrue)
|
||||||
Get.find<ChannelProvider>().refreshAvailableChannel(),
|
Get.find<ChannelProvider>().refreshAvailableChannel(),
|
||||||
|
if (auth.isAuthorized.isTrue)
|
||||||
Get.find<RelationshipProvider>().refreshRelativeList(),
|
Get.find<RelationshipProvider>().refreshRelativeList(),
|
||||||
|
if (auth.isAuthorized.isTrue)
|
||||||
|
Get.find<RealmProvider>().refreshAvailableRealms(),
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -111,7 +144,7 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
try {
|
try {
|
||||||
for (var idx = 0; idx < _periods.length; idx++) {
|
for (var idx = 0; idx < _periods.length; idx++) {
|
||||||
await _periods[idx].action();
|
await _periods[idx].action();
|
||||||
if (_isErrored) break;
|
if (_isErrored && !_isDismissable) break;
|
||||||
if (_periodCursor < _periods.length - 1) {
|
if (_periodCursor < _periods.length - 1) {
|
||||||
setState(() => _periodCursor++);
|
setState(() => _periodCursor++);
|
||||||
}
|
}
|
||||||
@ -130,7 +163,8 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_isBusy || _isErrored) {
|
if (_isBusy || _isErrored) {
|
||||||
return Material(
|
return GestureDetector(
|
||||||
|
child: Material(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
@ -140,17 +174,20 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
height: 280,
|
height: 280,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: Image.asset('assets/logo.png', width: 80, height: 80)
|
child: ClipRRect(
|
||||||
.animate(onPlay: (c) => c.repeat())
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
.rotate(duration: 850.ms, curve: Curves.easeInOut),
|
child:
|
||||||
|
Image.asset('assets/logo.png', width: 80, height: 80),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
),
|
||||||
child: Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
if (_isErrored)
|
if (_isErrored && !_isDismissable && !_isBusy)
|
||||||
const Icon(Icons.cancel, size: 24)
|
const Icon(Icons.cancel, size: 24),
|
||||||
else
|
if (_isErrored && _isDismissable && !_isBusy)
|
||||||
|
const Icon(Icons.warning, size: 24),
|
||||||
|
if ((_isErrored && _isDismissable && _isBusy) || _isBusy)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
@ -161,8 +198,8 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
maxWidth: 280,
|
maxWidth: 280,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
if (_subtitle == null)
|
||||||
Text(
|
Text(
|
||||||
_subtitle ??
|
|
||||||
'${_periods[_periodCursor].label.tr} (${_periodCursor + 1}/${_periods.length})',
|
'${_periods[_periodCursor].label.tr} (${_periodCursor + 1}/${_periods.length})',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -170,6 +207,24 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
color: _unFocusColor,
|
color: _unFocusColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (_subtitle != null)
|
||||||
|
Text(
|
||||||
|
_subtitle!,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: _unFocusColor,
|
||||||
|
),
|
||||||
|
).paddingOnly(bottom: 4),
|
||||||
|
if (!_isBusy && _isErrored && _isDismissable)
|
||||||
|
Text(
|
||||||
|
'bsDismissibleErrorHint'.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: _unFocusColor,
|
||||||
|
),
|
||||||
|
).paddingOnly(bottom: 5),
|
||||||
Text(
|
Text(
|
||||||
'2024 © Solsynth LLC',
|
'2024 © Solsynth LLC',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -183,18 +238,25 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (_isBusy) return;
|
if (_isBusy) return;
|
||||||
|
if (_isDismissable) {
|
||||||
|
setState(() {
|
||||||
|
_isBusy = false;
|
||||||
|
_isErrored = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isBusy = true;
|
_isBusy = true;
|
||||||
_isErrored = false;
|
_isErrored = false;
|
||||||
_periodCursor = 0;
|
_periodCursor = 0;
|
||||||
});
|
});
|
||||||
_runPeriods();
|
_runPeriods();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,23 @@ extension SolianExtenions on BuildContext {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> showInfoDialog(String title, body) {
|
||||||
|
return showDialog<void>(
|
||||||
|
useRootNavigator: true,
|
||||||
|
context: this,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
title: Text(title),
|
||||||
|
content: Text(body),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(ctx),
|
||||||
|
child: Text('okay'.tr),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> showErrorDialog(dynamic exception) {
|
Future<void> showErrorDialog(dynamic exception) {
|
||||||
var stack = StackTrace.current;
|
var stack = StackTrace.current;
|
||||||
var stackTrace = '$stack';
|
var stackTrace = '$stack';
|
||||||
|
@ -11,6 +11,7 @@ import 'package:solian/bootstrapper.dart';
|
|||||||
import 'package:solian/firebase_options.dart';
|
import 'package:solian/firebase_options.dart';
|
||||||
import 'package:solian/platform.dart';
|
import 'package:solian/platform.dart';
|
||||||
import 'package:solian/providers/attachment_uploader.dart';
|
import 'package:solian/providers/attachment_uploader.dart';
|
||||||
|
import 'package:solian/providers/stickers.dart';
|
||||||
import 'package:solian/providers/theme_switcher.dart';
|
import 'package:solian/providers/theme_switcher.dart';
|
||||||
import 'package:solian/providers/websocket.dart';
|
import 'package:solian/providers/websocket.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
@ -120,6 +121,7 @@ class SolianApp extends StatelessWidget {
|
|||||||
Get.lazyPut(() => AuthProvider());
|
Get.lazyPut(() => AuthProvider());
|
||||||
Get.lazyPut(() => RelationshipProvider());
|
Get.lazyPut(() => RelationshipProvider());
|
||||||
Get.lazyPut(() => PostProvider());
|
Get.lazyPut(() => PostProvider());
|
||||||
|
Get.lazyPut(() => StickerProvider());
|
||||||
Get.lazyPut(() => AttachmentProvider());
|
Get.lazyPut(() => AttachmentProvider());
|
||||||
Get.lazyPut(() => WebSocketProvider());
|
Get.lazyPut(() => WebSocketProvider());
|
||||||
Get.lazyPut(() => StatusProvider());
|
Get.lazyPut(() => StatusProvider());
|
||||||
|
132
lib/models/stickers.dart
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/models/account.dart';
|
||||||
|
import 'package:solian/models/attachment.dart';
|
||||||
|
import 'package:solian/services.dart';
|
||||||
|
|
||||||
|
class Sticker {
|
||||||
|
int id;
|
||||||
|
DateTime createdAt;
|
||||||
|
DateTime updatedAt;
|
||||||
|
DateTime? deletedAt;
|
||||||
|
String alias;
|
||||||
|
String name;
|
||||||
|
int attachmentId;
|
||||||
|
Attachment attachment;
|
||||||
|
int packId;
|
||||||
|
StickerPack? pack;
|
||||||
|
int accountId;
|
||||||
|
Account account;
|
||||||
|
|
||||||
|
Sticker({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
required this.deletedAt,
|
||||||
|
required this.alias,
|
||||||
|
required this.name,
|
||||||
|
required this.attachmentId,
|
||||||
|
required this.attachment,
|
||||||
|
required this.packId,
|
||||||
|
required this.pack,
|
||||||
|
required this.accountId,
|
||||||
|
required this.account,
|
||||||
|
});
|
||||||
|
|
||||||
|
String get textPlaceholder => '${pack?.prefix}$alias'.camelCase!;
|
||||||
|
String get textWarpedPlaceholder => ':$textPlaceholder:';
|
||||||
|
|
||||||
|
String get imageUrl => ServiceFinder.buildUrl(
|
||||||
|
'files',
|
||||||
|
'/attachments/$attachmentId',
|
||||||
|
);
|
||||||
|
|
||||||
|
factory Sticker.fromJson(Map<String, dynamic> json) => Sticker(
|
||||||
|
id: json['id'],
|
||||||
|
createdAt: DateTime.parse(json['created_at']),
|
||||||
|
updatedAt: DateTime.parse(json['updated_at']),
|
||||||
|
deletedAt: json['deleted_at'] != null
|
||||||
|
? DateTime.parse(json['deleted_at'])
|
||||||
|
: json['deleted_at'],
|
||||||
|
alias: json['alias'],
|
||||||
|
name: json['name'],
|
||||||
|
attachmentId: json['attachment_id'],
|
||||||
|
attachment: Attachment.fromJson(json['attachment']),
|
||||||
|
packId: json['pack_id'],
|
||||||
|
pack: json['pack'] != null ? StickerPack.fromJson(json['pack']) : null,
|
||||||
|
accountId: json['account_id'],
|
||||||
|
account: Account.fromJson(json['account']),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'created_at': createdAt.toIso8601String(),
|
||||||
|
'updated_at': updatedAt.toIso8601String(),
|
||||||
|
'deleted_at': deletedAt?.toIso8601String(),
|
||||||
|
'alias': alias,
|
||||||
|
'name': name,
|
||||||
|
'attachment_id': attachmentId,
|
||||||
|
'attachment': attachment.toJson(),
|
||||||
|
'pack_id': packId,
|
||||||
|
'account_id': accountId,
|
||||||
|
'account': account.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class StickerPack {
|
||||||
|
int id;
|
||||||
|
DateTime createdAt;
|
||||||
|
DateTime updatedAt;
|
||||||
|
DateTime? deletedAt;
|
||||||
|
String prefix;
|
||||||
|
String name;
|
||||||
|
String description;
|
||||||
|
List<Sticker>? stickers;
|
||||||
|
int accountId;
|
||||||
|
Account account;
|
||||||
|
|
||||||
|
StickerPack({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
required this.deletedAt,
|
||||||
|
required this.prefix,
|
||||||
|
required this.name,
|
||||||
|
required this.description,
|
||||||
|
required this.stickers,
|
||||||
|
required this.accountId,
|
||||||
|
required this.account,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory StickerPack.fromJson(Map<String, dynamic> json) => StickerPack(
|
||||||
|
id: json['id'],
|
||||||
|
createdAt: DateTime.parse(json['created_at']),
|
||||||
|
updatedAt: DateTime.parse(json['updated_at']),
|
||||||
|
deletedAt: json['deleted_at'] != null
|
||||||
|
? DateTime.parse(json['deleted_at'])
|
||||||
|
: json['deleted_at'],
|
||||||
|
prefix: json['prefix'],
|
||||||
|
name: json['name'],
|
||||||
|
description: json['description'],
|
||||||
|
stickers: json['stickers'] == null
|
||||||
|
? []
|
||||||
|
: List<Sticker>.from(
|
||||||
|
json['stickers']!.map((x) => Sticker.fromJson(x))),
|
||||||
|
accountId: json['account_id'],
|
||||||
|
account: Account.fromJson(json['account']),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'created_at': createdAt.toIso8601String(),
|
||||||
|
'updated_at': updatedAt.toIso8601String(),
|
||||||
|
'deleted_at': deletedAt?.toIso8601String(),
|
||||||
|
'prefix': prefix,
|
||||||
|
'name': name,
|
||||||
|
'description': description,
|
||||||
|
'stickers': stickers == null
|
||||||
|
? []
|
||||||
|
: List<dynamic>.from(stickers!.map((x) => x.toJson())),
|
||||||
|
'account_id': accountId,
|
||||||
|
'account': account.toJson(),
|
||||||
|
};
|
||||||
|
}
|
@ -14,6 +14,7 @@ class AttachmentUploadTask {
|
|||||||
double progress = 0;
|
double progress = 0;
|
||||||
bool isUploading = false;
|
bool isUploading = false;
|
||||||
bool isCompleted = false;
|
bool isCompleted = false;
|
||||||
|
dynamic error;
|
||||||
|
|
||||||
AttachmentUploadTask({
|
AttachmentUploadTask({
|
||||||
required this.file,
|
required this.file,
|
||||||
@ -66,7 +67,7 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
queueOfUpload.remove(task);
|
queueOfUpload.remove(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Attachment> performSingleTask(int queueIndex) async {
|
Future<Attachment?> performSingleTask(int queueIndex) async {
|
||||||
isUploading.value = true;
|
isUploading.value = true;
|
||||||
progressOfUpload.value = 0;
|
progressOfUpload.value = 0;
|
||||||
|
|
||||||
@ -83,9 +84,15 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
queueOfUpload[queueIndex].progress = value;
|
queueOfUpload[queueIndex].progress = value;
|
||||||
_progressOfUpload = value;
|
_progressOfUpload = value;
|
||||||
},
|
},
|
||||||
|
onError: (err) {
|
||||||
|
queueOfUpload[queueIndex].error = err;
|
||||||
|
queueOfUpload[queueIndex].isUploading = false;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (queueOfUpload[queueIndex].error == null) {
|
||||||
queueOfUpload.removeAt(queueIndex);
|
queueOfUpload.removeAt(queueIndex);
|
||||||
|
}
|
||||||
_stopProgressSyncTimer();
|
_stopProgressSyncTimer();
|
||||||
_syncProgress();
|
_syncProgress();
|
||||||
|
|
||||||
@ -103,6 +110,10 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
_startProgressSyncTimer();
|
_startProgressSyncTimer();
|
||||||
|
|
||||||
for (var idx = 0; idx < queueOfUpload.length; idx++) {
|
for (var idx = 0; idx < queueOfUpload.length; idx++) {
|
||||||
|
if (queueOfUpload[idx].isUploading || queueOfUpload[idx].error != null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
queueOfUpload[idx].isUploading = true;
|
queueOfUpload[idx].isUploading = true;
|
||||||
|
|
||||||
final task = queueOfUpload[idx];
|
final task = queueOfUpload[idx];
|
||||||
@ -115,15 +126,21 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
queueOfUpload[idx].progress = value;
|
queueOfUpload[idx].progress = value;
|
||||||
_progressOfUpload = (idx + value) / queueOfUpload.length;
|
_progressOfUpload = (idx + value) / queueOfUpload.length;
|
||||||
},
|
},
|
||||||
|
onError: (err) {
|
||||||
|
queueOfUpload[idx].error = err;
|
||||||
|
queueOfUpload[idx].isUploading = false;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
_progressOfUpload = (idx + 1) / queueOfUpload.length;
|
_progressOfUpload = (idx + 1) / queueOfUpload.length;
|
||||||
onData(result);
|
if (result != null) onData(result);
|
||||||
|
|
||||||
queueOfUpload[idx].isUploading = false;
|
queueOfUpload[idx].isUploading = false;
|
||||||
queueOfUpload[idx].isCompleted = false;
|
queueOfUpload[idx].isCompleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
queueOfUpload.clear();
|
queueOfUpload.value = queueOfUpload
|
||||||
|
.where((x) => x.error == null && x.isCompleted)
|
||||||
|
.toList(growable: true);
|
||||||
_stopProgressSyncTimer();
|
_stopProgressSyncTimer();
|
||||||
_syncProgress();
|
_syncProgress();
|
||||||
|
|
||||||
@ -135,7 +152,7 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
String path,
|
String path,
|
||||||
String usage,
|
String usage,
|
||||||
Map<String, dynamic>? metadata,
|
Map<String, dynamic>? metadata,
|
||||||
Function(Attachment) callback,
|
Function(Attachment?) callback,
|
||||||
) async {
|
) async {
|
||||||
if (isUploading.value) throw Exception('uploading blocked');
|
if (isUploading.value) throw Exception('uploading blocked');
|
||||||
|
|
||||||
@ -153,7 +170,7 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
callback(result);
|
callback(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Attachment> uploadAttachment(
|
Future<Attachment?> uploadAttachment(
|
||||||
Uint8List data,
|
Uint8List data,
|
||||||
String path,
|
String path,
|
||||||
String usage,
|
String usage,
|
||||||
@ -175,9 +192,9 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Attachment> _rawUploadAttachment(
|
Future<Attachment?> _rawUploadAttachment(
|
||||||
Uint8List data, String path, String usage, Map<String, dynamic>? metadata,
|
Uint8List data, String path, String usage, Map<String, dynamic>? metadata,
|
||||||
{Function(double)? onProgress}) async {
|
{Function(double)? onProgress, Function(dynamic err)? onError}) async {
|
||||||
final AttachmentProvider provider = Get.find();
|
final AttachmentProvider provider = Get.find();
|
||||||
try {
|
try {
|
||||||
final result = await provider.createAttachment(
|
final result = await provider.createAttachment(
|
||||||
@ -189,7 +206,10 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
rethrow;
|
if (onError != null) {
|
||||||
|
onError(err);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ class AttachmentProvider extends GetConnect {
|
|||||||
List<int> id, {
|
List<int> id, {
|
||||||
noCache = false,
|
noCache = false,
|
||||||
}) async {
|
}) async {
|
||||||
|
if (id.isEmpty) return List.empty();
|
||||||
|
|
||||||
List<Attachment?> result = List.filled(id.length, null);
|
List<Attachment?> result = List.filled(id.length, null);
|
||||||
List<int> pendingQuery = List.empty(growable: true);
|
List<int> pendingQuery = List.empty(growable: true);
|
||||||
if (!noCache) {
|
if (!noCache) {
|
||||||
@ -87,6 +89,8 @@ class AttachmentProvider extends GetConnect {
|
|||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
||||||
|
|
||||||
|
await auth.ensureCredentials();
|
||||||
|
|
||||||
final filePayload =
|
final filePayload =
|
||||||
dio.MultipartFile.fromBytes(data, filename: basename(path));
|
dio.MultipartFile.fromBytes(data, filename: basename(path));
|
||||||
final fileAlt = basename(path).contains('.')
|
final fileAlt = basename(path).contains('.')
|
||||||
|
31
lib/providers/stickers.dart
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/models/pagination.dart';
|
||||||
|
import 'package:solian/models/stickers.dart';
|
||||||
|
import 'package:solian/services.dart';
|
||||||
|
|
||||||
|
class StickerProvider extends GetxController {
|
||||||
|
final RxMap<String, String> aliasImageMapping = RxMap();
|
||||||
|
final RxList<Sticker> availableStickers = RxList.empty(growable: true);
|
||||||
|
|
||||||
|
Future<void> refreshAvailableStickers() async {
|
||||||
|
final client = ServiceFinder.configureClient('files');
|
||||||
|
final resp = await client.get(
|
||||||
|
'/stickers/manifest?take=100',
|
||||||
|
);
|
||||||
|
if (resp.statusCode == 200) {
|
||||||
|
final result = PaginationResult.fromJson(resp.body);
|
||||||
|
final out = result.data?.map((e) => StickerPack.fromJson(e)).toList();
|
||||||
|
if (out == null) return;
|
||||||
|
|
||||||
|
for (final pack in out) {
|
||||||
|
for (final sticker in (pack.stickers ?? List<Sticker>.empty())) {
|
||||||
|
sticker.pack = pack;
|
||||||
|
aliasImageMapping['${pack.prefix}${sticker.alias}'.camelCase!] =
|
||||||
|
sticker.imageUrl;
|
||||||
|
availableStickers.add(sticker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
availableStickers.refresh();
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ import 'package:solian/screens/account.dart';
|
|||||||
import 'package:solian/screens/account/friend.dart';
|
import 'package:solian/screens/account/friend.dart';
|
||||||
import 'package:solian/screens/account/personalize.dart';
|
import 'package:solian/screens/account/personalize.dart';
|
||||||
import 'package:solian/screens/account/profile_page.dart';
|
import 'package:solian/screens/account/profile_page.dart';
|
||||||
|
import 'package:solian/screens/account/stickers.dart';
|
||||||
import 'package:solian/screens/channel/channel_chat.dart';
|
import 'package:solian/screens/channel/channel_chat.dart';
|
||||||
import 'package:solian/screens/channel/channel_detail.dart';
|
import 'package:solian/screens/channel/channel_detail.dart';
|
||||||
import 'package:solian/screens/channel/channel_organize.dart';
|
import 'package:solian/screens/channel/channel_organize.dart';
|
||||||
@ -103,7 +104,6 @@ abstract class AppRouter {
|
|||||||
reply: arguments?.reply,
|
reply: arguments?.reply,
|
||||||
repost: arguments?.repost,
|
repost: arguments?.repost,
|
||||||
realm: arguments?.realm,
|
realm: arguments?.realm,
|
||||||
postListController: arguments?.postListController,
|
|
||||||
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
|
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
|
||||||
),
|
),
|
||||||
transitionsBuilder:
|
transitionsBuilder:
|
||||||
@ -226,6 +226,14 @@ abstract class AppRouter {
|
|||||||
name: 'accountFriend',
|
name: 'accountFriend',
|
||||||
builder: (context, state) => const FriendScreen(),
|
builder: (context, state) => const FriendScreen(),
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/account/stickers',
|
||||||
|
name: 'accountStickers',
|
||||||
|
builder: (context, state) => TitleShell(
|
||||||
|
state: state,
|
||||||
|
child: const StickerScreen(),
|
||||||
|
),
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/account/personalize',
|
path: '/account/personalize',
|
||||||
name: 'accountPersonalize',
|
name: 'accountPersonalize',
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
@ -18,9 +17,11 @@ class AboutScreen extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Image.asset('assets/logo.png', width: 64, height: 64)
|
ClipRRect(
|
||||||
.animate(onPlay: (c) => c.repeat())
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
.rotate(duration: 1000.ms),
|
child: Image.asset('assets/logo.png', width: 120, height: 120),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
'Solian',
|
'Solian',
|
||||||
style: Theme.of(context).textTheme.headlineMedium,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
@ -56,10 +57,9 @@ class AboutScreen extends StatelessWidget {
|
|||||||
applicationVersion: '${info.version} (${info.buildNumber})',
|
applicationVersion: '${info.version} (${info.buildNumber})',
|
||||||
applicationLegalese:
|
applicationLegalese:
|
||||||
'The Solar Network App is an intuitive and self-hostable social network and computing platform. Experience the freedom of a user-friendly design that empowers you to create and connect with communities on your own terms. Embrace the future of social networking with a platform that prioritizes your independence and privacy.',
|
'The Solar Network App is an intuitive and self-hostable social network and computing platform. Experience the freedom of a user-friendly design that empowers you to create and connect with communities on your own terms. Embrace the future of social networking with a platform that prioritizes your independence and privacy.',
|
||||||
applicationIcon: Image.asset(
|
applicationIcon: ClipRRect(
|
||||||
'assets/logo.png',
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
width: 56,
|
child: Image.asset('assets/logo.png', width: 60, height: 60),
|
||||||
height: 56,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -46,6 +46,11 @@ class _AccountScreenState extends State<AccountScreen> {
|
|||||||
'accountFriend'.tr,
|
'accountFriend'.tr,
|
||||||
'accountFriend',
|
'accountFriend',
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
const Icon(Icons.emoji_symbols),
|
||||||
|
'accountStickers'.tr,
|
||||||
|
'accountStickers',
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
|
@ -43,7 +43,7 @@ class _FriendScreenState extends State<FriendScreen>
|
|||||||
_relations.where((x) => x.status == 0).length;
|
_relations.where((x) => x.status == 0).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void promptAddFriend() async {
|
void _promptAddFriend() async {
|
||||||
final RelationshipProvider provider = Get.find();
|
final RelationshipProvider provider = Get.find();
|
||||||
|
|
||||||
final controller = TextEditingController();
|
final controller = TextEditingController();
|
||||||
@ -146,7 +146,7 @@ class _FriendScreenState extends State<FriendScreen>
|
|||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.add),
|
child: const Icon(Icons.add),
|
||||||
onPressed: () => promptAddFriend(),
|
onPressed: () => _promptAddFriend(),
|
||||||
),
|
),
|
||||||
body: TabBarView(
|
body: TabBarView(
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
|
@ -86,11 +86,17 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
|||||||
toolbarTitle: 'cropImage'.tr,
|
toolbarTitle: 'cropImage'.tr,
|
||||||
toolbarColor: Theme.of(context).colorScheme.primary,
|
toolbarColor: Theme.of(context).colorScheme.primary,
|
||||||
toolbarWidgetColor: Theme.of(context).colorScheme.onPrimary,
|
toolbarWidgetColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
aspectRatioPresets: [CropAspectRatioPreset.square],
|
aspectRatioPresets: [
|
||||||
|
if (position == 'avatar') CropAspectRatioPreset.square,
|
||||||
|
if (position == 'banner') _BannerCropAspectRatioPreset(),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
IOSUiSettings(
|
IOSUiSettings(
|
||||||
title: 'cropImage'.tr,
|
title: 'cropImage'.tr,
|
||||||
aspectRatioPresets: [CropAspectRatioPreset.square],
|
aspectRatioPresets: [
|
||||||
|
if (position == 'avatar') CropAspectRatioPreset.square,
|
||||||
|
if (position == 'banner') _BannerCropAspectRatioPreset(),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
WebUiSettings(
|
WebUiSettings(
|
||||||
context: context,
|
context: context,
|
||||||
@ -346,3 +352,11 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _BannerCropAspectRatioPreset extends CropAspectRatioPresetData {
|
||||||
|
@override
|
||||||
|
(int, int)? get data => (16, 7);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get name => '16x7';
|
||||||
|
}
|
||||||
|
@ -40,7 +40,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
List<Post> _pinnedPosts = List.empty();
|
List<Post> _pinnedPosts = List.empty();
|
||||||
int _totalUpvote = 0, _totalDownvote = 0;
|
int _totalUpvote = 0, _totalDownvote = 0;
|
||||||
|
|
||||||
Future<void> getUserinfo() async {
|
Future<void> _getUserinfo() async {
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
var client = ServiceFinder.configureClient('auth');
|
var client = ServiceFinder.configureClient('auth');
|
||||||
@ -114,7 +114,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getUserinfo();
|
_getUserinfo();
|
||||||
getPinnedPosts();
|
getPinnedPosts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,8 +189,11 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
: () async {
|
: () async {
|
||||||
setState(() => _isMakingFriend = true);
|
setState(() => _isMakingFriend = true);
|
||||||
try {
|
try {
|
||||||
await _relationshipProvider.makeFriend(widget.name);
|
await _relationshipProvider
|
||||||
context.showSnackbar('accountFriendRequestSent'.tr);
|
.makeFriend(widget.name);
|
||||||
|
context.showSnackbar(
|
||||||
|
'accountFriendRequestSent'.tr,
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
context.showErrorDialog(e);
|
context.showErrorDialog(e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -274,6 +277,8 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
color:
|
color:
|
||||||
Theme.of(context).colorScheme.surfaceContainerLow,
|
Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
child: PostListEntryWidget(
|
child: PostListEntryWidget(
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
item: element,
|
item: element,
|
||||||
isClickable: true,
|
isClickable: true,
|
||||||
isNestedClickable: true,
|
isNestedClickable: true,
|
||||||
@ -295,6 +300,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
PostWarpedListWidget(
|
PostWarpedListWidget(
|
||||||
isPinned: false,
|
isPinned: false,
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
190
lib/screens/account/stickers.dart
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
|
import 'package:solian/models/pagination.dart';
|
||||||
|
import 'package:solian/models/stickers.dart';
|
||||||
|
import 'package:solian/platform.dart';
|
||||||
|
import 'package:solian/providers/auth.dart';
|
||||||
|
import 'package:solian/providers/stickers.dart';
|
||||||
|
import 'package:solian/services.dart';
|
||||||
|
import 'package:solian/widgets/stickers/sticker_uploader.dart';
|
||||||
|
|
||||||
|
class StickerScreen extends StatefulWidget {
|
||||||
|
const StickerScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StickerScreen> createState() => _StickerScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StickerScreenState extends State<StickerScreen> {
|
||||||
|
final PagingController<int, StickerPack> _pagingController =
|
||||||
|
PagingController(firstPageKey: 0);
|
||||||
|
|
||||||
|
Future<bool> _promptDelete(Sticker item, String prefix) async {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
if (auth.isAuthorized.isFalse) return false;
|
||||||
|
|
||||||
|
final confirm = await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: Text('stickerDeletionConfirm'.tr),
|
||||||
|
content: Text(
|
||||||
|
'stickerDeletionConfirmCaption'.trParams({
|
||||||
|
'name': ':${'$prefix${item.alias}'.camelCase}:',
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
child: Text('cancel'.tr),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context, true),
|
||||||
|
child: Text('confirm'.tr),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (confirm != true) return false;
|
||||||
|
|
||||||
|
final client = auth.configureClient('files');
|
||||||
|
final resp = await client.delete('/stickers/${item.id}');
|
||||||
|
|
||||||
|
return resp.statusCode == 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool?> _promptUploadSticker({Sticker? edit}) {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => StickerUploadDialog(
|
||||||
|
edit: edit,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmoteEntry(Sticker item, String prefix) {
|
||||||
|
final imageUrl = ServiceFinder.buildUrl(
|
||||||
|
'files',
|
||||||
|
'/attachments/${item.attachmentId}',
|
||||||
|
);
|
||||||
|
return ListTile(
|
||||||
|
title: Text(item.name),
|
||||||
|
subtitle: Text(':${'$prefix${item.alias}'.camelCase}:'),
|
||||||
|
contentPadding: const EdgeInsets.only(left: 16, right: 14),
|
||||||
|
trailing: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.edit_square),
|
||||||
|
onPressed: () {
|
||||||
|
_promptUploadSticker(edit: item).then((value) {
|
||||||
|
if (value == true) _pagingController.refresh();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.delete),
|
||||||
|
onPressed: () {
|
||||||
|
_promptDelete(item, prefix).then((value) {
|
||||||
|
if (value == true) _pagingController.refresh();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
leading: PlatformInfo.canCacheImage
|
||||||
|
? CachedNetworkImage(
|
||||||
|
imageUrl: imageUrl,
|
||||||
|
width: 28,
|
||||||
|
height: 28,
|
||||||
|
)
|
||||||
|
: Image.network(
|
||||||
|
imageUrl,
|
||||||
|
width: 28,
|
||||||
|
height: 28,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
final name = auth.userProfile.value!['name'];
|
||||||
|
_pagingController.addPageRequestListener((pageKey) async {
|
||||||
|
final client = ServiceFinder.configureClient('files');
|
||||||
|
final resp = await client.get(
|
||||||
|
'/stickers/manifest?take=10&offset=$pageKey&author=$name',
|
||||||
|
);
|
||||||
|
if (resp.statusCode == 200) {
|
||||||
|
final result = PaginationResult.fromJson(resp.body);
|
||||||
|
final out = result.data?.map((e) => StickerPack.fromJson(e)).toList();
|
||||||
|
if (out != null && result.data!.length >= 10) {
|
||||||
|
_pagingController.appendPage(out, pageKey + out.length);
|
||||||
|
} else if (out != null) {
|
||||||
|
_pagingController.appendLastPage(out);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_pagingController.error = resp.bodyString;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
final StickerProvider sticker = Get.find();
|
||||||
|
sticker.refreshAvailableStickers();
|
||||||
|
_pagingController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
child: const Icon(Icons.add),
|
||||||
|
onPressed: () {
|
||||||
|
_promptUploadSticker().then((value) {
|
||||||
|
if (value == true) _pagingController.refresh();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
body: RefreshIndicator(
|
||||||
|
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
||||||
|
child: CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
PagedSliverList<int, StickerPack>(
|
||||||
|
pagingController: _pagingController,
|
||||||
|
builderDelegate: PagedChildBuilderDelegate(
|
||||||
|
itemBuilder: (BuildContext context, item, int index) {
|
||||||
|
return ExpansionTile(
|
||||||
|
title: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(item.name),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Badge(
|
||||||
|
label: Text('#${item.id}'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
item.description,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
children: item.stickers
|
||||||
|
?.map((x) => _buildEmoteEntry(x, item.prefix))
|
||||||
|
.toList() ??
|
||||||
|
List.empty(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -136,8 +136,10 @@ class _SignInPopupState extends State<SignInPopup> with ProtocolListener {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Image.asset('assets/logo.png', width: 64, height: 64)
|
ClipRRect(
|
||||||
.paddingOnly(bottom: 4),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
|
child: Image.asset('assets/logo.png', width: 64, height: 64),
|
||||||
|
).paddingOnly(bottom: 4),
|
||||||
Text(
|
Text(
|
||||||
'signinGreeting'.tr,
|
'signinGreeting'.tr,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -70,8 +70,10 @@ class _SignUpPopupState extends State<SignUpPopup> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Image.asset('assets/logo.png', width: 64, height: 64)
|
ClipRRect(
|
||||||
.paddingOnly(bottom: 4),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
|
child: Image.asset('assets/logo.png', width: 64, height: 64),
|
||||||
|
).paddingOnly(bottom: 4),
|
||||||
Text(
|
Text(
|
||||||
'signupGreeting'.tr,
|
'signupGreeting'.tr,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -9,6 +9,7 @@ import 'package:solian/theme.dart';
|
|||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/chat/call/call_controls.dart';
|
import 'package:solian/widgets/chat/call/call_controls.dart';
|
||||||
import 'package:solian/widgets/chat/call/call_participant.dart';
|
import 'package:solian/widgets/chat/call/call_participant.dart';
|
||||||
|
import 'package:livekit_client/livekit_client.dart' as livekit;
|
||||||
|
|
||||||
class CallScreen extends StatefulWidget {
|
class CallScreen extends StatefulWidget {
|
||||||
const CallScreen({super.key});
|
const CallScreen({super.key});
|
||||||
@ -161,13 +162,13 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: columns,
|
crossAxisCount: columns,
|
||||||
childAspectRatio: tileWidth / tileHeight,
|
childAspectRatio: tileWidth / tileHeight,
|
||||||
|
crossAxisSpacing: 8,
|
||||||
|
mainAxisSpacing: 8,
|
||||||
),
|
),
|
||||||
itemCount: math.max(0, call.participantTracks.length),
|
itemCount: math.max(0, call.participantTracks.length),
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final track = call.participantTracks[index];
|
final track = call.participantTracks[index];
|
||||||
return Padding(
|
return Card(
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Card(
|
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
child: InteractiveParticipantWidget(
|
child: InteractiveParticipantWidget(
|
||||||
@ -181,11 +182,10 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
).paddingAll(8);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,8 +246,77 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: 64,
|
height: 64,
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Expanded(child: SizedBox()),
|
Builder(builder: (context) {
|
||||||
|
final call = Get.find<ChatCallProvider>();
|
||||||
|
final connectionQuality =
|
||||||
|
call.room.localParticipant?.connectionQuality ??
|
||||||
|
livekit.ConnectionQuality.unknown;
|
||||||
|
return Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(call.room.serverRegion ?? 'unknown'),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(call.room.serverVersion ?? 'unknown')
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
{
|
||||||
|
livekit.ConnectionState.disconnected:
|
||||||
|
'callStatusDisconnected'.tr,
|
||||||
|
livekit.ConnectionState.connected:
|
||||||
|
'callStatusConnected'.tr,
|
||||||
|
livekit.ConnectionState.connecting:
|
||||||
|
'callStatusConnecting'.tr,
|
||||||
|
livekit.ConnectionState.reconnecting:
|
||||||
|
'callStatusReconnecting'.tr,
|
||||||
|
}[call.room.connectionState]!,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
if (connectionQuality !=
|
||||||
|
livekit.ConnectionQuality.unknown)
|
||||||
|
Icon(
|
||||||
|
{
|
||||||
|
livekit.ConnectionQuality.excellent:
|
||||||
|
Icons.signal_cellular_alt,
|
||||||
|
livekit.ConnectionQuality.good:
|
||||||
|
Icons.signal_cellular_alt_2_bar,
|
||||||
|
livekit.ConnectionQuality.poor:
|
||||||
|
Icons.signal_cellular_alt_1_bar,
|
||||||
|
}[connectionQuality],
|
||||||
|
color: {
|
||||||
|
livekit.ConnectionQuality.excellent:
|
||||||
|
Colors.green,
|
||||||
|
livekit.ConnectionQuality.good:
|
||||||
|
Colors.orange,
|
||||||
|
livekit.ConnectionQuality.poor:
|
||||||
|
Colors.red,
|
||||||
|
}[connectionQuality],
|
||||||
|
size: 16,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
height: 12,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.white,
|
||||||
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
).paddingAll(3),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: _layoutMode == 0
|
icon: _layoutMode == 0
|
||||||
? const Icon(Icons.view_list)
|
? const Icon(Icons.view_list)
|
||||||
@ -257,7 +326,7 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 10),
|
).paddingOnly(left: 20, right: 16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -21,7 +21,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
final PagingController<int, Post> _pagingController =
|
final PagingController<int, Post> _pagingController =
|
||||||
PagingController(firstPageKey: 0);
|
PagingController(firstPageKey: 0);
|
||||||
|
|
||||||
getPosts(int pageKey) async {
|
_getPosts(int pageKey) async {
|
||||||
final PostProvider provider = Get.find();
|
final PostProvider provider = Get.find();
|
||||||
|
|
||||||
Response resp;
|
Response resp;
|
||||||
@ -49,7 +49,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_pagingController.addPageRequestListener(getPosts);
|
_pagingController.addPageRequestListener(_getPosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -76,6 +76,9 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
itemBuilder: (context, item, index) {
|
itemBuilder: (context, item, index) {
|
||||||
return PostOwnedListEntry(
|
return PostOwnedListEntry(
|
||||||
item: item,
|
item: item,
|
||||||
|
isFullContent: true,
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
@ -85,7 +88,13 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
noReact: true,
|
noReact: true,
|
||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) _pagingController.refresh();
|
if (value is Future) {
|
||||||
|
value.then((_) {
|
||||||
|
_pagingController.refresh();
|
||||||
|
});
|
||||||
|
} else if (value != null) {
|
||||||
|
_pagingController.refresh();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
).paddingOnly(left: 12, right: 12, bottom: 4);
|
).paddingOnly(left: 12, right: 12, bottom: 4);
|
||||||
|
@ -77,7 +77,10 @@ class _FeedSearchScreenState extends State<FeedSearchScreen> {
|
|||||||
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
PostWarpedListWidget(controller: _pagingController),
|
PostWarpedListWidget(
|
||||||
|
controller: _pagingController,
|
||||||
|
onUpdate: () => _pagingController.refresh(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -4,7 +4,6 @@ import 'package:solian/controllers/post_list_controller.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/screens/account/notification.dart';
|
import 'package:solian/screens/account/notification.dart';
|
||||||
import 'package:solian/screens/posts/post_editor.dart';
|
|
||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
import 'package:solian/widgets/app_bar_title.dart';
|
import 'package:solian/widgets/app_bar_title.dart';
|
||||||
import 'package:solian/widgets/current_state_action.dart';
|
import 'package:solian/widgets/current_state_action.dart';
|
||||||
@ -47,15 +46,20 @@ class _HomeScreenState extends State<HomeScreen>
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.add),
|
child: const Icon(Icons.add),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
showModalBottomSheet(
|
final value = await showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => PostCreatePopup(
|
builder: (context) => const PostCreatePopup(),
|
||||||
controller: _postController,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
if (value is Future) {
|
||||||
|
value.then((_) {
|
||||||
|
_postController.reloadAllOver();
|
||||||
|
});
|
||||||
|
} else if (value != null) {
|
||||||
|
_postController.reloadAllOver();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: NestedScrollView(
|
body: NestedScrollView(
|
||||||
@ -100,6 +104,7 @@ class _HomeScreenState extends State<HomeScreen>
|
|||||||
child: CustomScrollView(slivers: [
|
child: CustomScrollView(slivers: [
|
||||||
PostWarpedListWidget(
|
PostWarpedListWidget(
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
@ -121,12 +126,10 @@ class _HomeScreenState extends State<HomeScreen>
|
|||||||
|
|
||||||
class PostCreatePopup extends StatelessWidget {
|
class PostCreatePopup extends StatelessWidget {
|
||||||
final bool hideDraftBox;
|
final bool hideDraftBox;
|
||||||
final PostListController controller;
|
|
||||||
|
|
||||||
const PostCreatePopup({
|
const PostCreatePopup({
|
||||||
super.key,
|
super.key,
|
||||||
this.hideDraftBox = false,
|
this.hideDraftBox = false,
|
||||||
required this.controller,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -142,13 +145,14 @@ class PostCreatePopup extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.post_add),
|
icon: const Icon(Icons.post_add),
|
||||||
label: 'postEditorModeStory'.tr,
|
label: 'postEditorModeStory'.tr,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
|
context,
|
||||||
AppRouter.instance.pushNamed(
|
AppRouter.instance.pushNamed(
|
||||||
'postEditor',
|
'postEditor',
|
||||||
extra: PostPublishArguments(postListController: controller),
|
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'mode': 0.toString(),
|
'mode': 0.toString(),
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -156,13 +160,14 @@ class PostCreatePopup extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.description),
|
icon: const Icon(Icons.description),
|
||||||
label: 'postEditorModeArticle'.tr,
|
label: 'postEditorModeArticle'.tr,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
|
context,
|
||||||
AppRouter.instance.pushNamed(
|
AppRouter.instance.pushNamed(
|
||||||
'postEditor',
|
'postEditor',
|
||||||
extra: PostPublishArguments(postListController: controller),
|
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'mode': 1.toString(),
|
'mode': 1.toString(),
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -170,8 +175,10 @@ class PostCreatePopup extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.drafts),
|
icon: const Icon(Icons.drafts),
|
||||||
label: 'draftBoxOpen'.tr,
|
label: 'draftBoxOpen'.tr,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
AppRouter.instance.pushNamed('draftBox');
|
context,
|
||||||
|
AppRouter.instance.pushNamed('draftBox'),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -59,8 +59,10 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
|||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: PostItem(
|
child: PostItem(
|
||||||
item: item!,
|
item: item!,
|
||||||
isClickable: true,
|
isClickable: false,
|
||||||
|
isOverrideEmbedClickable: true,
|
||||||
isFullDate: true,
|
isFullDate: true,
|
||||||
|
isFullContent: true,
|
||||||
isShowReply: false,
|
isShowReply: false,
|
||||||
isContentSelectable: true,
|
isContentSelectable: true,
|
||||||
),
|
),
|
||||||
|
@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:markdown_toolbar/markdown_toolbar.dart';
|
import 'package:markdown_toolbar/markdown_toolbar.dart';
|
||||||
import 'package:solian/controllers/post_editor_controller.dart';
|
import 'package:solian/controllers/post_editor_controller.dart';
|
||||||
import 'package:solian/controllers/post_list_controller.dart';
|
|
||||||
import 'package:solian/exts.dart';
|
import 'package:solian/exts.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
import 'package:solian/models/realm.dart';
|
import 'package:solian/models/realm.dart';
|
||||||
@ -23,14 +22,12 @@ class PostPublishArguments {
|
|||||||
final Post? reply;
|
final Post? reply;
|
||||||
final Post? repost;
|
final Post? repost;
|
||||||
final Realm? realm;
|
final Realm? realm;
|
||||||
final PostListController? postListController;
|
|
||||||
|
|
||||||
PostPublishArguments({
|
PostPublishArguments({
|
||||||
this.edit,
|
this.edit,
|
||||||
this.reply,
|
this.reply,
|
||||||
this.repost,
|
this.repost,
|
||||||
this.realm,
|
this.realm,
|
||||||
this.postListController,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +36,6 @@ class PostPublishScreen extends StatefulWidget {
|
|||||||
final Post? reply;
|
final Post? reply;
|
||||||
final Post? repost;
|
final Post? repost;
|
||||||
final Realm? realm;
|
final Realm? realm;
|
||||||
final PostListController? postListController;
|
|
||||||
final int mode;
|
final int mode;
|
||||||
|
|
||||||
const PostPublishScreen({
|
const PostPublishScreen({
|
||||||
@ -48,7 +44,6 @@ class PostPublishScreen extends StatefulWidget {
|
|||||||
this.reply,
|
this.reply,
|
||||||
this.repost,
|
this.repost,
|
||||||
this.realm,
|
this.realm,
|
||||||
this.postListController,
|
|
||||||
required this.mode,
|
required this.mode,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -95,9 +90,6 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
context.showErrorDialog(resp.bodyString);
|
context.showErrorDialog(resp.bodyString);
|
||||||
} else {
|
} else {
|
||||||
_editorController.localClear();
|
_editorController.localClear();
|
||||||
if (widget.postListController != null) {
|
|
||||||
widget.postListController!.reloadAllOver();
|
|
||||||
}
|
|
||||||
AppRouter.instance.pop(resp.body);
|
AppRouter.instance.pop(resp.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +120,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (widget.edit == null) _editorController.localRead();
|
if (widget.edit == null && widget.reply == null && widget.repost == null) {
|
||||||
|
_editorController.localRead();
|
||||||
|
}
|
||||||
|
if (widget.reply != null) {
|
||||||
|
_editorController.replyTo.value = widget.reply;
|
||||||
|
}
|
||||||
|
if (widget.repost != null) {
|
||||||
|
_editorController.repostTo.value = widget.repost;
|
||||||
|
}
|
||||||
_editorController.contentController.addListener(() => setState(() {}));
|
_editorController.contentController.addListener(() => setState(() {}));
|
||||||
_syncWidget();
|
_syncWidget();
|
||||||
}
|
}
|
||||||
@ -219,10 +219,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
collapsedBackgroundColor:
|
collapsedBackgroundColor:
|
||||||
Theme.of(context).colorScheme.surfaceContainer,
|
Theme.of(context).colorScheme.surfaceContainer,
|
||||||
children: [
|
children: [
|
||||||
PostItem(
|
Container(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 280),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: PostItem(
|
||||||
item: _replyTo!,
|
item: _replyTo!,
|
||||||
isReactable: false,
|
isReactable: false,
|
||||||
).paddingOnly(bottom: 8),
|
).paddingOnly(bottom: 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (_repostTo != null)
|
if (_repostTo != null)
|
||||||
@ -237,10 +242,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
collapsedBackgroundColor:
|
collapsedBackgroundColor:
|
||||||
Theme.of(context).colorScheme.surfaceContainer,
|
Theme.of(context).colorScheme.surfaceContainer,
|
||||||
children: [
|
children: [
|
||||||
PostItem(
|
Container(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 280),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: PostItem(
|
||||||
item: _repostTo!,
|
item: _repostTo!,
|
||||||
isReactable: false,
|
isReactable: false,
|
||||||
).paddingOnly(bottom: 8),
|
).paddingOnly(bottom: 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -12,6 +12,7 @@ const i18nEnglish = {
|
|||||||
'draftBox': 'Draft Box',
|
'draftBox': 'Draft Box',
|
||||||
'more': 'More',
|
'more': 'More',
|
||||||
'share': 'Share',
|
'share': 'Share',
|
||||||
|
'shareNoUri': 'Share text content',
|
||||||
'feed': 'Feed',
|
'feed': 'Feed',
|
||||||
'unlink': 'Unlink',
|
'unlink': 'Unlink',
|
||||||
'feedSearch': 'Search Feed',
|
'feedSearch': 'Search Feed',
|
||||||
@ -52,6 +53,7 @@ const i18nEnglish = {
|
|||||||
'account': 'Account',
|
'account': 'Account',
|
||||||
'accountPersonalize': 'Personalize',
|
'accountPersonalize': 'Personalize',
|
||||||
'accountPersonalizeApplied': 'Account personalize settings has been saved.',
|
'accountPersonalizeApplied': 'Account personalize settings has been saved.',
|
||||||
|
'accountStickers': 'Stickers',
|
||||||
'accountFriend': 'Friend',
|
'accountFriend': 'Friend',
|
||||||
'accountFriendNew': 'New friend',
|
'accountFriendNew': 'New friend',
|
||||||
'accountFriendNewHint':
|
'accountFriendNewHint':
|
||||||
@ -162,9 +164,11 @@ const i18nEnglish = {
|
|||||||
'attachmentAutoUpload': 'Auto Upload',
|
'attachmentAutoUpload': 'Auto Upload',
|
||||||
'attachmentUploadQueue': 'Upload Queue',
|
'attachmentUploadQueue': 'Upload Queue',
|
||||||
'attachmentUploadQueueStart': 'Start All',
|
'attachmentUploadQueueStart': 'Start All',
|
||||||
'attachmentUploadInProgress': 'There are attachments being uploaded. Please wait until all attachments have been uploaded before proceeding...',
|
'attachmentUploadInProgress':
|
||||||
|
'There are attachments being uploaded. Please wait until all attachments have been uploaded before proceeding...',
|
||||||
'attachmentAttached': 'Exists Files',
|
'attachmentAttached': 'Exists Files',
|
||||||
'attachmentUploadBlocked': 'Upload blocked, there is currently a task in progress...',
|
'attachmentUploadBlocked':
|
||||||
|
'Upload blocked, there is currently a task in progress...',
|
||||||
'attachmentAdd': 'Attach attachments',
|
'attachmentAdd': 'Attach attachments',
|
||||||
'attachmentAddGalleryPhoto': 'Gallery photo',
|
'attachmentAddGalleryPhoto': 'Gallery photo',
|
||||||
'attachmentAddGalleryVideo': 'Gallery video',
|
'attachmentAddGalleryVideo': 'Gallery video',
|
||||||
@ -173,7 +177,8 @@ const i18nEnglish = {
|
|||||||
'attachmentAddClipboard': 'Paste file',
|
'attachmentAddClipboard': 'Paste file',
|
||||||
'attachmentAddFile': 'Attach file',
|
'attachmentAddFile': 'Attach file',
|
||||||
'attachmentAddLink': 'Link attachments',
|
'attachmentAddLink': 'Link attachments',
|
||||||
'attachmentAddLinkHint': 'Enter attachment serial number to link that attachment',
|
'attachmentAddLinkHint':
|
||||||
|
'Enter attachment serial number to link that attachment',
|
||||||
'attachmentAddLinkInput': 'Serial number',
|
'attachmentAddLinkInput': 'Serial number',
|
||||||
'attachmentSetting': 'Adjust attachment',
|
'attachmentSetting': 'Adjust attachment',
|
||||||
'attachmentAlt': 'Alternative text',
|
'attachmentAlt': 'Alternative text',
|
||||||
@ -314,6 +319,13 @@ const i18nEnglish = {
|
|||||||
'accountStatusNeutral': 'Neutral',
|
'accountStatusNeutral': 'Neutral',
|
||||||
'accountStatusPositive': 'Positive',
|
'accountStatusPositive': 'Positive',
|
||||||
'bsLoadingTheme': 'Loading Theme',
|
'bsLoadingTheme': 'Loading Theme',
|
||||||
|
'bsCheckForUpdate': 'Checking For Updates',
|
||||||
|
'bsCheckForUpdateFailed': 'Unable to Check Updates',
|
||||||
|
'bsCheckForUpdateNew': 'Found New Version',
|
||||||
|
'bsCheckForUpdateDescApple':
|
||||||
|
'Please head to TestFlight and update your app to latest version to prevent error happens and get latest functions.',
|
||||||
|
'bsCheckForUpdateDescCommon':
|
||||||
|
'Please head to our website download and install latest version of application to prevent error happens and get latest functions.',
|
||||||
'bsCheckingServer': 'Checking Server Status',
|
'bsCheckingServer': 'Checking Server Status',
|
||||||
'bsCheckingServerFail':
|
'bsCheckingServerFail':
|
||||||
'Unable connect to server, check your network connection',
|
'Unable connect to server, check your network connection',
|
||||||
@ -322,6 +334,7 @@ const i18nEnglish = {
|
|||||||
'bsEstablishingConn': 'Establishing Connection',
|
'bsEstablishingConn': 'Establishing Connection',
|
||||||
'bsPreparingData': 'Preparing User Data',
|
'bsPreparingData': 'Preparing User Data',
|
||||||
'bsRegisteringPushNotify': 'Enabling Push Notifications',
|
'bsRegisteringPushNotify': 'Enabling Push Notifications',
|
||||||
|
'bsDismissibleErrorHint': 'Click anywhere to ignore this error',
|
||||||
'postShareContent':
|
'postShareContent':
|
||||||
'@content\n\n@username on the Solar Network\nCheck it out: @link',
|
'@content\n\n@username on the Solar Network\nCheck it out: @link',
|
||||||
'postShareSubject': '@username posted a post on the Solar Network',
|
'postShareSubject': '@username posted a post on the Solar Network',
|
||||||
@ -331,7 +344,30 @@ const i18nEnglish = {
|
|||||||
'themeColorMiku': 'Miku Blue',
|
'themeColorMiku': 'Miku Blue',
|
||||||
'themeColorKagamine': 'Kagamine Yellow',
|
'themeColorKagamine': 'Kagamine Yellow',
|
||||||
'themeColorLuka': 'Luka Pink',
|
'themeColorLuka': 'Luka Pink',
|
||||||
|
'stickerDeletionConfirm': 'Confirm sticker delete',
|
||||||
|
'stickerDeletionConfirmCaption':
|
||||||
|
'Are you sure to delete sticker @name? This action cannot be undo.',
|
||||||
'themeColorApplied': 'Global theme color has been applied.',
|
'themeColorApplied': 'Global theme color has been applied.',
|
||||||
'attachmentSaved': 'Attachment saved to your system album.',
|
'attachmentSaved': 'Attachment saved to your system album.',
|
||||||
'cropImage': 'Crop Image',
|
'cropImage': 'Crop Image',
|
||||||
|
'stickerUploader': 'Upload sticker',
|
||||||
|
'stickerUploaderAttachmentNew': 'Upload new attachment',
|
||||||
|
'stickerUploaderAttachment': 'Attachment serial number',
|
||||||
|
'stickerUploaderPack': 'Sticker pack serial number',
|
||||||
|
'stickerUploaderPackHint':
|
||||||
|
'Don\'t have pack id? Head to creator platform and create one!',
|
||||||
|
'stickerUploaderAlias': 'Alias',
|
||||||
|
'stickerUploaderAliasHint':
|
||||||
|
'Will be used as a placeholder with the sticker pack prefix when entered.',
|
||||||
|
'stickerUploaderName': 'Name',
|
||||||
|
'stickerUploaderNameHint':
|
||||||
|
'A human-friendly name given to the user in the sticker selection interface.',
|
||||||
|
'readMore': 'Read more',
|
||||||
|
'attachmentUnload': 'Not Loaded',
|
||||||
|
'attachmentUnloadCaption':
|
||||||
|
'In order to save traffic, this attachment is not loaded automatically. Click it to start loading.',
|
||||||
|
'callStatusConnected': 'Connected',
|
||||||
|
'callStatusDisconnected': 'Disconnected',
|
||||||
|
'callStatusConnecting': 'Connecting',
|
||||||
|
'callStatusReconnected': 'Reconnecting',
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,7 @@ const i18nSimplifiedChinese = {
|
|||||||
'draftBox': '草稿箱',
|
'draftBox': '草稿箱',
|
||||||
'more': '更多',
|
'more': '更多',
|
||||||
'share': '分享',
|
'share': '分享',
|
||||||
|
'shareNoUri': '分享文字内容',
|
||||||
'feed': '资讯',
|
'feed': '资讯',
|
||||||
'unlink': '移除链接',
|
'unlink': '移除链接',
|
||||||
'feedSearch': '搜索资讯',
|
'feedSearch': '搜索资讯',
|
||||||
@ -52,6 +53,7 @@ const i18nSimplifiedChinese = {
|
|||||||
'account': '账号',
|
'account': '账号',
|
||||||
'accountPersonalize': '个性化',
|
'accountPersonalize': '个性化',
|
||||||
'accountPersonalizeApplied': '账户的个性化设置已保存。',
|
'accountPersonalizeApplied': '账户的个性化设置已保存。',
|
||||||
|
'accountStickers': '贴图',
|
||||||
'accountFriend': '好友',
|
'accountFriend': '好友',
|
||||||
'accountFriendNew': '添加好友',
|
'accountFriendNew': '添加好友',
|
||||||
'accountFriendNewHint': '使用他人的用户名来发送一个好友请求吧!',
|
'accountFriendNewHint': '使用他人的用户名来发送一个好友请求吧!',
|
||||||
@ -293,6 +295,11 @@ const i18nSimplifiedChinese = {
|
|||||||
'accountStatusNeutral': '中性',
|
'accountStatusNeutral': '中性',
|
||||||
'accountStatusPositive': '积极',
|
'accountStatusPositive': '积极',
|
||||||
'bsLoadingTheme': '正在装载主题',
|
'bsLoadingTheme': '正在装载主题',
|
||||||
|
'bsCheckForUpdate': '正在检查更新',
|
||||||
|
'bsCheckForUpdateFailed': '无法检查更新',
|
||||||
|
'bsCheckForUpdateNew': '发现新版本',
|
||||||
|
'bsCheckForUpdateDescApple': '请前往 TestFlight 并将您的应用程序更新到最新版本,以防止出现错误并获取最新功能。',
|
||||||
|
'bsCheckForUpdateDescCommon': '请前往我们的网站下载并安装最新版本的应用程序,以防止出现错误并获取最新功能。',
|
||||||
'bsCheckingServer': '检查服务器状态中',
|
'bsCheckingServer': '检查服务器状态中',
|
||||||
'bsCheckingServerFail': '无法连接至服务器,请检查你的网络连接状态',
|
'bsCheckingServerFail': '无法连接至服务器,请检查你的网络连接状态',
|
||||||
'bsCheckingServerDown': '当前服务器不可用,请稍后重试',
|
'bsCheckingServerDown': '当前服务器不可用,请稍后重试',
|
||||||
@ -300,6 +307,7 @@ const i18nSimplifiedChinese = {
|
|||||||
'bsEstablishingConn': '部署连接中',
|
'bsEstablishingConn': '部署连接中',
|
||||||
'bsPreparingData': '正在准备用户资料',
|
'bsPreparingData': '正在准备用户资料',
|
||||||
'bsRegisteringPushNotify': '正在启用推送通知',
|
'bsRegisteringPushNotify': '正在启用推送通知',
|
||||||
|
'bsDismissibleErrorHint': '点击任意地方忽略此错误',
|
||||||
'postShareContent': '@content\n\n@username 在 Solar Network\n原帖地址:@link',
|
'postShareContent': '@content\n\n@username 在 Solar Network\n原帖地址:@link',
|
||||||
'postShareSubject': '@username 在 Solar Network 上发布了一篇帖子',
|
'postShareSubject': '@username 在 Solar Network 上发布了一篇帖子',
|
||||||
'themeColor': '全局主题色',
|
'themeColor': '全局主题色',
|
||||||
@ -309,6 +317,24 @@ const i18nSimplifiedChinese = {
|
|||||||
'themeColorKagamine': '镜音黄',
|
'themeColorKagamine': '镜音黄',
|
||||||
'themeColorLuka': '流音粉',
|
'themeColorLuka': '流音粉',
|
||||||
'themeColorApplied': '全局主题颜色已应用',
|
'themeColorApplied': '全局主题颜色已应用',
|
||||||
|
'stickerDeletionConfirm': '确认删除贴图',
|
||||||
|
'stickerDeletionConfirmCaption': '你确认要删除贴图 @name 吗?该操作不可撤销。',
|
||||||
'attachmentSaved': '附件已保存到系统相册',
|
'attachmentSaved': '附件已保存到系统相册',
|
||||||
'cropImage': '裁剪图片',
|
'cropImage': '裁剪图片',
|
||||||
|
'stickerUploader': '上传贴图',
|
||||||
|
'stickerUploaderAttachmentNew': '上传附件',
|
||||||
|
'stickerUploaderAttachment': '附件序列号',
|
||||||
|
'stickerUploaderPack': '贴图包序号',
|
||||||
|
'stickerUploaderPackHint': '没有该序号?请转到我们的创作者平台创建一个贴图包。',
|
||||||
|
'stickerUploaderAlias': '贴图别名',
|
||||||
|
'stickerUploaderAliasHint': '将会在输入时使用和贴图包前缀组成占位符。',
|
||||||
|
'stickerUploaderName': '贴图名称',
|
||||||
|
'stickerUploaderNameHint': '在贴图选择界面提供给用户的人类友好名称。',
|
||||||
|
'readMore': '阅读更多',
|
||||||
|
'attachmentUnload': '附件未加载',
|
||||||
|
'attachmentUnloadCaption': '为了节省流量,本附件未自动加载,点一下来开始加载。',
|
||||||
|
'callStatusConnected': '已连接',
|
||||||
|
'callStatusDisconnected': '已断开',
|
||||||
|
'callStatusConnecting': '连接中',
|
||||||
|
'callStatusReconnected': '重连中',
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:solian/exts.dart';
|
|
||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
import 'package:solian/providers/account_status.dart';
|
import 'package:solian/providers/account_status.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
@ -8,9 +7,9 @@ import 'package:solian/services.dart';
|
|||||||
import 'package:solian/widgets/account/account_heading.dart';
|
import 'package:solian/widgets/account/account_heading.dart';
|
||||||
|
|
||||||
class AccountProfilePopup extends StatefulWidget {
|
class AccountProfilePopup extends StatefulWidget {
|
||||||
final Account account;
|
final String name;
|
||||||
|
|
||||||
const AccountProfilePopup({super.key, required this.account});
|
const AccountProfilePopup({super.key, required this.name});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AccountProfilePopup> createState() => _AccountProfilePopupState();
|
State<AccountProfilePopup> createState() => _AccountProfilePopupState();
|
||||||
@ -18,38 +17,75 @@ class AccountProfilePopup extends StatefulWidget {
|
|||||||
|
|
||||||
class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
||||||
bool _isBusy = true;
|
bool _isBusy = true;
|
||||||
|
dynamic _hasError;
|
||||||
|
|
||||||
Account? _userinfo;
|
Account? _userinfo;
|
||||||
|
|
||||||
void getUserinfo() async {
|
void _getUserinfo() async {
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
|
try {
|
||||||
final client = ServiceFinder.configureClient('auth');
|
final client = ServiceFinder.configureClient('auth');
|
||||||
final resp = await client.get('/users/${widget.account.name}');
|
final resp = await client.get('/users/${widget.name}');
|
||||||
if (resp.statusCode == 200) {
|
if (resp.statusCode == 200) {
|
||||||
|
setState(() {
|
||||||
_userinfo = Account.fromJson(resp.body);
|
_userinfo = Account.fromJson(resp.body);
|
||||||
setState(() => _isBusy = false);
|
_isBusy = false;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
context.showErrorDialog(resp.bodyString);
|
setState(() {
|
||||||
Navigator.pop(context);
|
_hasError = resp.bodyString;
|
||||||
|
_isBusy = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_hasError = e;
|
||||||
|
_isBusy = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color get _unFocusColor =>
|
||||||
|
Theme.of(context).colorScheme.onSurface.withOpacity(0.75);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
getUserinfo();
|
_getUserinfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_isBusy || _userinfo == null) {
|
if (_isBusy) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.75,
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
child: const Center(child: CircularProgressIndicator()),
|
child: const Center(child: CircularProgressIndicator()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_hasError != null) {
|
||||||
|
return SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
|
width: double.infinity,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.cancel, size: 24),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Text(
|
||||||
|
_hasError.toString(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: _unFocusColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.75,
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -226,7 +226,7 @@ class _AccountStatusEditorDialogState extends State<AccountStatusEditorDialog> {
|
|||||||
onTapOutside: (_) =>
|
onTapOutside: (_) =>
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 8),
|
||||||
TextField(
|
TextField(
|
||||||
controller: _clearAtController,
|
controller: _clearAtController,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
@ -238,7 +238,7 @@ class _AccountStatusEditorDialogState extends State<AccountStatusEditorDialog> {
|
|||||||
),
|
),
|
||||||
onTap: () => selectClearAt(),
|
onTap: () => selectClearAt(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 8),
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
@ -281,7 +281,7 @@ class _AccountStatusEditorDialogState extends State<AccountStatusEditorDialog> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 8),
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
|
@ -35,7 +35,7 @@ class SilverRelativeList extends StatelessWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
AccountProfilePopup(
|
AccountProfilePopup(
|
||||||
account: element.related,
|
name: element.related.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -23,16 +23,26 @@ import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
|||||||
|
|
||||||
class AttachmentEditorPopup extends StatefulWidget {
|
class AttachmentEditorPopup extends StatefulWidget {
|
||||||
final String usage;
|
final String usage;
|
||||||
final List<int> initialAttachments;
|
final bool singleMode;
|
||||||
|
final bool imageOnly;
|
||||||
|
final bool autoUpload;
|
||||||
|
final double? imageMaxWidth;
|
||||||
|
final double? imageMaxHeight;
|
||||||
|
final List<int>? initialAttachments;
|
||||||
final void Function(int) onAdd;
|
final void Function(int) onAdd;
|
||||||
final void Function(int) onRemove;
|
final void Function(int) onRemove;
|
||||||
|
|
||||||
const AttachmentEditorPopup({
|
const AttachmentEditorPopup({
|
||||||
super.key,
|
super.key,
|
||||||
required this.usage,
|
required this.usage,
|
||||||
required this.initialAttachments,
|
|
||||||
required this.onAdd,
|
required this.onAdd,
|
||||||
required this.onRemove,
|
required this.onRemove,
|
||||||
|
this.singleMode = false,
|
||||||
|
this.imageOnly = false,
|
||||||
|
this.autoUpload = false,
|
||||||
|
this.imageMaxWidth,
|
||||||
|
this.imageMaxHeight,
|
||||||
|
this.initialAttachments,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -43,7 +53,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
final _imagePicker = ImagePicker();
|
final _imagePicker = ImagePicker();
|
||||||
final AttachmentUploaderController _uploadController = Get.find();
|
final AttachmentUploaderController _uploadController = Get.find();
|
||||||
|
|
||||||
bool _isAutoUpload = false;
|
late bool _isAutoUpload = widget.autoUpload;
|
||||||
|
|
||||||
bool _isBusy = false;
|
bool _isBusy = false;
|
||||||
bool _isFirstTimeBusy = true;
|
bool _isFirstTimeBusy = true;
|
||||||
@ -54,13 +64,28 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) return;
|
if (auth.isAuthorized.isFalse) return;
|
||||||
|
|
||||||
final medias = await _imagePicker.pickMultiImage();
|
if (widget.singleMode) {
|
||||||
|
final medias = await _imagePicker.pickMultiImage(
|
||||||
|
maxWidth: widget.imageMaxWidth,
|
||||||
|
maxHeight: widget.imageMaxHeight,
|
||||||
|
);
|
||||||
if (medias.isEmpty) return;
|
if (medias.isEmpty) return;
|
||||||
|
|
||||||
_enqueueTaskBatch(medias.map((x) {
|
_enqueueTaskBatch(medias.map((x) {
|
||||||
final file = File(x.path);
|
final file = File(x.path);
|
||||||
return AttachmentUploadTask(file: file, usage: widget.usage);
|
return AttachmentUploadTask(file: file, usage: widget.usage);
|
||||||
}));
|
}));
|
||||||
|
} else {
|
||||||
|
final media = await _imagePicker.pickMedia(
|
||||||
|
maxWidth: widget.imageMaxWidth,
|
||||||
|
maxHeight: widget.imageMaxHeight,
|
||||||
|
);
|
||||||
|
if (media == null) return;
|
||||||
|
|
||||||
|
_enqueueTask(
|
||||||
|
AttachmentUploadTask(file: File(media.path), usage: widget.usage),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _pickVideoToUpload() async {
|
Future<void> _pickVideoToUpload() async {
|
||||||
@ -164,6 +189,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
widget.onAdd(result.id);
|
widget.onAdd(result.id);
|
||||||
setState(() => _attachments.add(result));
|
setState(() => _attachments.add(result));
|
||||||
|
if (widget.singleMode) Navigator.pop(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,9 +205,11 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
widget.usage,
|
widget.usage,
|
||||||
null,
|
null,
|
||||||
(item) {
|
(item) {
|
||||||
|
if (item == null) return;
|
||||||
widget.onAdd(item.id);
|
widget.onAdd(item.id);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() => _attachments.add(item));
|
setState(() => _attachments.add(item));
|
||||||
|
if (widget.singleMode) Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -209,12 +237,12 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
void _revertMetadataList() {
|
void _revertMetadataList() {
|
||||||
final AttachmentProvider attach = Get.find();
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
if (widget.initialAttachments.isEmpty) {
|
if (widget.initialAttachments?.isEmpty ?? true) {
|
||||||
_isFirstTimeBusy = false;
|
_isFirstTimeBusy = false;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
_attachments = List.filled(
|
_attachments = List.filled(
|
||||||
widget.initialAttachments.length,
|
widget.initialAttachments!.length,
|
||||||
null,
|
null,
|
||||||
growable: true,
|
growable: true,
|
||||||
);
|
);
|
||||||
@ -222,7 +250,9 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
|
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
attach.listMetadata(widget.initialAttachments).then((result) {
|
attach
|
||||||
|
.listMetadata(widget.initialAttachments ?? List.empty())
|
||||||
|
.then((result) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_attachments = result;
|
_attachments = result;
|
||||||
_isBusy = false;
|
_isBusy = false;
|
||||||
@ -349,7 +379,15 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
child: Icon(Icons.check),
|
child: Icon(Icons.check),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!element.isCompleted && canBeCrop)
|
if (element.error != null)
|
||||||
|
IconButton(
|
||||||
|
tooltip: element.error!.toString(),
|
||||||
|
icon: const Icon(Icons.warning),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
if (!element.isCompleted &&
|
||||||
|
element.error == null &&
|
||||||
|
canBeCrop)
|
||||||
Obx(
|
Obx(
|
||||||
() => IconButton(
|
() => IconButton(
|
||||||
color: Colors.teal,
|
color: Colors.teal,
|
||||||
@ -362,7 +400,9 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!element.isCompleted && !element.isUploading)
|
if (!element.isCompleted &&
|
||||||
|
!element.isUploading &&
|
||||||
|
element.error == null)
|
||||||
Obx(
|
Obx(
|
||||||
() => IconButton(
|
() => IconButton(
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
@ -374,9 +414,13 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
_uploadController
|
_uploadController
|
||||||
.performSingleTask(index)
|
.performSingleTask(index)
|
||||||
.then((r) {
|
.then((r) {
|
||||||
|
if (r == null) return;
|
||||||
widget.onAdd(r.id);
|
widget.onAdd(r.id);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() => _attachments.add(r));
|
setState(() => _attachments.add(r));
|
||||||
|
if (widget.singleMode) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -519,6 +563,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
widget.onAdd(r.id);
|
widget.onAdd(r.id);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() => _attachments.add(r));
|
setState(() => _attachments.add(r));
|
||||||
|
if (widget.singleMode) Navigator.pop(context);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -551,9 +596,17 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
'attachmentAdd'.tr,
|
'attachmentAdd'.tr,
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
style:
|
||||||
|
Theme.of(context).textTheme.headlineSmall,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
@ -563,7 +616,8 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
height: 18,
|
height: 18,
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
strokeWidth: 2.5,
|
strokeWidth: 2.5,
|
||||||
value: _uploadController.progressOfUpload.value,
|
value: _uploadController
|
||||||
|
.progressOfUpload.value,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -572,6 +626,10 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
Text('attachmentAutoUpload'.tr),
|
Text('attachmentAutoUpload'.tr),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Switch(
|
Switch(
|
||||||
@ -670,6 +728,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
ignoring: _uploadController.isUploading.value,
|
ignoring: _uploadController.isUploading.value,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 64,
|
height: 64,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
top: BorderSide(
|
top: BorderSide(
|
||||||
@ -686,9 +745,10 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
alignment: WrapAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
runAlignment: WrapAlignment.center,
|
runAlignment: WrapAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
if (PlatformInfo.isDesktop ||
|
if ((PlatformInfo.isDesktop ||
|
||||||
PlatformInfo.isIOS ||
|
PlatformInfo.isIOS ||
|
||||||
PlatformInfo.isWeb)
|
PlatformInfo.isWeb) &&
|
||||||
|
!widget.imageOnly)
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: const Icon(Icons.paste),
|
icon: const Icon(Icons.paste),
|
||||||
label: Text('attachmentAddClipboard'.tr),
|
label: Text('attachmentAddClipboard'.tr),
|
||||||
@ -701,6 +761,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
style: const ButtonStyle(visualDensity: density),
|
style: const ButtonStyle(visualDensity: density),
|
||||||
onPressed: () => _pickPhotoToUpload(),
|
onPressed: () => _pickPhotoToUpload(),
|
||||||
),
|
),
|
||||||
|
if (!widget.imageOnly)
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: const Icon(Icons.add_road),
|
icon: const Icon(Icons.add_road),
|
||||||
label: Text('attachmentAddGalleryVideo'.tr),
|
label: Text('attachmentAddGalleryVideo'.tr),
|
||||||
@ -713,18 +774,21 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
style: const ButtonStyle(visualDensity: density),
|
style: const ButtonStyle(visualDensity: density),
|
||||||
onPressed: () => _takeMediaToUpload(false),
|
onPressed: () => _takeMediaToUpload(false),
|
||||||
),
|
),
|
||||||
|
if (!widget.imageOnly)
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: const Icon(Icons.video_camera_back_outlined),
|
icon: const Icon(Icons.video_camera_back_outlined),
|
||||||
label: Text('attachmentAddCameraVideo'.tr),
|
label: Text('attachmentAddCameraVideo'.tr),
|
||||||
style: const ButtonStyle(visualDensity: density),
|
style: const ButtonStyle(visualDensity: density),
|
||||||
onPressed: () => _takeMediaToUpload(true),
|
onPressed: () => _takeMediaToUpload(true),
|
||||||
),
|
),
|
||||||
|
if (!widget.imageOnly)
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: const Icon(Icons.file_present_rounded),
|
icon: const Icon(Icons.file_present_rounded),
|
||||||
label: Text('attachmentAddFile'.tr),
|
label: Text('attachmentAddFile'.tr),
|
||||||
style: const ButtonStyle(visualDensity: density),
|
style: const ButtonStyle(visualDensity: density),
|
||||||
onPressed: () => _pickFileToUpload(),
|
onPressed: () => _pickFileToUpload(),
|
||||||
),
|
),
|
||||||
|
if (!widget.imageOnly)
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: const Icon(Icons.link),
|
icon: const Icon(Icons.link),
|
||||||
label: Text('attachmentAddFile'.tr),
|
label: Text('attachmentAddFile'.tr),
|
||||||
|
@ -257,6 +257,10 @@ class _AttachmentFullScreenState extends State<AttachmentFullScreen> {
|
|||||||
child: Wrap(
|
child: Wrap(
|
||||||
spacing: 6,
|
spacing: 6,
|
||||||
children: [
|
children: [
|
||||||
|
Text(
|
||||||
|
'#${widget.item.id}',
|
||||||
|
style: metaTextStyle,
|
||||||
|
),
|
||||||
if (widget.item.metadata?['width'] != null &&
|
if (widget.item.metadata?['width'] != null &&
|
||||||
widget.item.metadata?['height'] != null)
|
widget.item.metadata?['height'] != null)
|
||||||
Text(
|
Text(
|
||||||
|
@ -7,6 +7,7 @@ import 'package:media_kit_video/media_kit_video.dart';
|
|||||||
import 'package:solian/models/attachment.dart';
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/platform.dart';
|
import 'package:solian/platform.dart';
|
||||||
import 'package:solian/services.dart';
|
import 'package:solian/services.dart';
|
||||||
|
import 'package:solian/widgets/sized_container.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
class AttachmentItem extends StatefulWidget {
|
class AttachmentItem extends StatefulWidget {
|
||||||
@ -213,8 +214,12 @@ class _AttachmentItemImage extends StatelessWidget {
|
|||||||
|
|
||||||
class _AttachmentItemVideo extends StatefulWidget {
|
class _AttachmentItemVideo extends StatefulWidget {
|
||||||
final Attachment item;
|
final Attachment item;
|
||||||
|
final bool autoload;
|
||||||
|
|
||||||
const _AttachmentItemVideo({required this.item});
|
const _AttachmentItemVideo({
|
||||||
|
required this.item,
|
||||||
|
this.autoload = false,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_AttachmentItemVideo> createState() => _AttachmentItemVideoState();
|
State<_AttachmentItemVideo> createState() => _AttachmentItemVideoState();
|
||||||
@ -226,21 +231,64 @@ class _AttachmentItemVideoState extends State<_AttachmentItemVideo> {
|
|||||||
);
|
);
|
||||||
late final _controller = VideoController(_player);
|
late final _controller = VideoController(_player);
|
||||||
|
|
||||||
|
bool _showContent = false;
|
||||||
|
|
||||||
|
void _startLoad() {
|
||||||
|
_player.open(
|
||||||
|
Media(ServiceFinder.buildUrl('files', '/attachments/${widget.item.id}')),
|
||||||
|
play: false,
|
||||||
|
);
|
||||||
|
setState(() => _showContent = true);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_player.open(
|
|
||||||
Media(
|
|
||||||
ServiceFinder.buildUrl('files', '/attachments/${widget.item.id}'),
|
|
||||||
),
|
|
||||||
play: false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final ratio = widget.item.metadata?['ratio'] ?? 16 / 9;
|
||||||
|
if (!_showContent) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: ratio,
|
||||||
|
child: CenteredContainer(
|
||||||
|
maxWidth: 280,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.not_started,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 32,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'attachmentUnload'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'attachmentUnloadCaption'.tr,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
_startLoad();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Video(
|
return Video(
|
||||||
aspectRatio: widget.item.metadata?['ratio'] ?? 16 / 9,
|
aspectRatio: ratio,
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import 'package:solian/models/attachment.dart';
|
|||||||
import 'package:solian/widgets/attachments/attachment_item.dart';
|
import 'package:solian/widgets/attachments/attachment_item.dart';
|
||||||
import 'package:solian/providers/content/attachment.dart';
|
import 'package:solian/providers/content/attachment.dart';
|
||||||
import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
||||||
|
import 'package:solian/widgets/sized_container.dart';
|
||||||
|
|
||||||
class AttachmentList extends StatefulWidget {
|
class AttachmentList extends StatefulWidget {
|
||||||
final String parentId;
|
final String parentId;
|
||||||
@ -272,9 +273,8 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (item!.isMature && !showMature)
|
if (item!.isMature && !showMature)
|
||||||
Center(
|
CenteredContainer(
|
||||||
child: Container(
|
maxWidth: 280,
|
||||||
constraints: const BoxConstraints(maxWidth: 280),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@ -302,7 +302,6 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -322,3 +321,50 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AttachmentSelfContainedEntry extends StatefulWidget {
|
||||||
|
final int id;
|
||||||
|
final String parentId;
|
||||||
|
final bool isDense;
|
||||||
|
|
||||||
|
const AttachmentSelfContainedEntry({
|
||||||
|
super.key,
|
||||||
|
required this.id,
|
||||||
|
required this.parentId,
|
||||||
|
this.isDense = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AttachmentSelfContainedEntry> createState() =>
|
||||||
|
_AttachmentSelfContainedEntryState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AttachmentSelfContainedEntryState
|
||||||
|
extends State<AttachmentSelfContainedEntry> {
|
||||||
|
bool _showMature = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final AttachmentProvider attachments = Get.find();
|
||||||
|
|
||||||
|
return FutureBuilder(
|
||||||
|
future: attachments.getMetadata(widget.id),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) {
|
||||||
|
return const Text('Loading...');
|
||||||
|
}
|
||||||
|
|
||||||
|
return AttachmentListEntry(
|
||||||
|
item: snapshot.data,
|
||||||
|
isDense: widget.isDense,
|
||||||
|
parentId: widget.parentId,
|
||||||
|
showMature: _showMature,
|
||||||
|
showBorder: true,
|
||||||
|
onReveal: (value) {
|
||||||
|
setState(() => _showMature = value);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -57,7 +57,7 @@ class _ChannelMemberListPopupState extends State<ChannelMemberListPopup> {
|
|||||||
setState(() => _isBusy = false);
|
setState(() => _isBusy = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void promptAddMember() async {
|
void _promptAddMember() async {
|
||||||
final input = await showModalBottomSheet(
|
final input = await showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
@ -141,7 +141,7 @@ class _ChannelMemberListPopupState extends State<ChannelMemberListPopup> {
|
|||||||
'channelMembersAddHint'
|
'channelMembersAddHint'
|
||||||
.trParams({'channel': '#${widget.channel.alias}'}),
|
.trParams({'channel': '#${widget.channel.alias}'}),
|
||||||
),
|
),
|
||||||
onTap: () => promptAddMember(),
|
onTap: () => _promptAddMember(),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
@ -160,7 +160,7 @@ class _ChannelMemberListPopupState extends State<ChannelMemberListPopup> {
|
|||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AccountProfilePopup(
|
builder: (context) => AccountProfilePopup(
|
||||||
account: element.account,
|
name: element.account.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -50,10 +50,10 @@ class ChatEvent extends StatelessWidget {
|
|||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.attachment,
|
Icons.file_copy,
|
||||||
size: 18,
|
size: 15,
|
||||||
color: unFocusColor,
|
color: unFocusColor,
|
||||||
).paddingOnly(right: 6),
|
).paddingOnly(right: 5),
|
||||||
Text(
|
Text(
|
||||||
'attachmentHint'.trParams(
|
'attachmentHint'.trParams(
|
||||||
{'count': attachments.length.toString()},
|
{'count': attachments.length.toString()},
|
||||||
@ -221,6 +221,8 @@ class ChatEvent extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
_buildContent().paddingOnly(left: 0.5),
|
_buildContent().paddingOnly(left: 0.5),
|
||||||
|
_buildAttachment(context, isMinimal: true)
|
||||||
|
.paddingOnly(left: 0),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -243,7 +245,7 @@ class ChatEvent extends StatelessWidget {
|
|||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AccountProfilePopup(
|
builder: (context) => AccountProfilePopup(
|
||||||
account: item.sender.account,
|
name: item.sender.account.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -31,7 +31,11 @@ class ChatEventMessageActionLog extends StatelessWidget {
|
|||||||
).paddingOnly(
|
).paddingOnly(
|
||||||
left: isQuote ? 0 : (isMerged ? 64 : 12),
|
left: isQuote ? 0 : (isMerged ? 64 : 12),
|
||||||
top: 2,
|
top: 2,
|
||||||
bottom: isHasMerged ? 2 : 0,
|
bottom: isQuote
|
||||||
|
? 0
|
||||||
|
: isHasMerged
|
||||||
|
? 2
|
||||||
|
: 0,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,11 @@ class ChatEventMessage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MarkdownTextContent(content: body.text);
|
return MarkdownTextContent(
|
||||||
|
parentId: 'm${item.id}',
|
||||||
|
isSelectable: true,
|
||||||
|
content: body.text,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody(BuildContext context) {
|
Widget _buildBody(BuildContext context) {
|
||||||
@ -63,7 +67,9 @@ class ChatEventMessage extends StatelessWidget {
|
|||||||
left: isQuote ? 0 : 12,
|
left: isQuote ? 0 : 12,
|
||||||
right: isQuote ? 0 : 12,
|
right: isQuote ? 0 : 12,
|
||||||
top: body.quoteEvent == null ? 2 : 0,
|
top: body.quoteEvent == null ? 2 : 0,
|
||||||
bottom: hasAttachment && !isContentPreviewing ? 4 : (isHasMerged ? 2 : 0),
|
bottom: hasAttachment && !isContentPreviewing && !isQuote
|
||||||
|
? 4
|
||||||
|
: (isHasMerged ? 2 : 0),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,36 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:solian/exts.dart';
|
import 'package:solian/exts.dart';
|
||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
import 'package:solian/models/channel.dart';
|
import 'package:solian/models/channel.dart';
|
||||||
import 'package:solian/models/event.dart';
|
import 'package:solian/models/event.dart';
|
||||||
|
import 'package:solian/platform.dart';
|
||||||
import 'package:solian/providers/attachment_uploader.dart';
|
import 'package:solian/providers/attachment_uploader.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
|
import 'package:solian/providers/stickers.dart';
|
||||||
|
import 'package:solian/widgets/account/account_avatar.dart';
|
||||||
import 'package:solian/widgets/attachments/attachment_editor.dart';
|
import 'package:solian/widgets/attachments/attachment_editor.dart';
|
||||||
import 'package:solian/widgets/chat/chat_event.dart';
|
import 'package:solian/widgets/chat/chat_event.dart';
|
||||||
import 'package:badges/badges.dart' as badges;
|
import 'package:badges/badges.dart' as badges;
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
|
class ChatMessageSuggestion {
|
||||||
|
final String type;
|
||||||
|
final Widget leading;
|
||||||
|
final String display;
|
||||||
|
final String content;
|
||||||
|
|
||||||
|
ChatMessageSuggestion({
|
||||||
|
required this.type,
|
||||||
|
required this.leading,
|
||||||
|
required this.display,
|
||||||
|
required this.content,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
class ChatMessageInput extends StatefulWidget {
|
class ChatMessageInput extends StatefulWidget {
|
||||||
final Event? edit;
|
final Event? edit;
|
||||||
final Event? reply;
|
final Event? reply;
|
||||||
@ -156,7 +175,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
widget.onSent(message);
|
widget.onSent(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetInput();
|
_resetInput();
|
||||||
|
|
||||||
if (_editTo != null) {
|
if (_editTo != null) {
|
||||||
resp = await client.put(
|
resp = await client.put(
|
||||||
@ -175,7 +194,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetInput() {
|
void _resetInput() {
|
||||||
if (widget.onReset != null) widget.onReset!();
|
if (widget.onReset != null) widget.onReset!();
|
||||||
_editTo = null;
|
_editTo = null;
|
||||||
_replyTo = null;
|
_replyTo = null;
|
||||||
@ -184,11 +203,13 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void syncWidget() {
|
void _syncWidget() {
|
||||||
if (widget.edit != null && widget.edit!.type.startsWith('messages')) {
|
if (widget.edit != null && widget.edit!.type.startsWith('messages')) {
|
||||||
final body = EventMessageBody.fromJson(widget.edit!.body);
|
final body = EventMessageBody.fromJson(widget.edit!.body);
|
||||||
_editTo = widget.edit!;
|
_editTo = widget.edit!;
|
||||||
_textController.text = body.text;
|
_textController.text = body.text;
|
||||||
|
_attachments.addAll(
|
||||||
|
widget.edit!.body['attachments']?.cast<int>() ?? List.empty());
|
||||||
}
|
}
|
||||||
if (widget.reply != null) {
|
if (widget.reply != null) {
|
||||||
_replyTo = widget.reply!;
|
_replyTo = widget.reply!;
|
||||||
@ -197,9 +218,52 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildSuggestion(ChatMessageSuggestion suggestion) {
|
||||||
|
return ListTile(
|
||||||
|
leading: suggestion.leading,
|
||||||
|
title: Text(suggestion.display),
|
||||||
|
subtitle: Text(suggestion.content),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _insertSuggestion(ChatMessageSuggestion suggestion) {
|
||||||
|
final replaceText =
|
||||||
|
_textController.text.substring(0, _textController.selection.baseOffset);
|
||||||
|
var startText = '';
|
||||||
|
final afterText = replaceText == _textController.text
|
||||||
|
? ''
|
||||||
|
: _textController.text
|
||||||
|
.substring(_textController.selection.baseOffset + 1);
|
||||||
|
var insertText = '';
|
||||||
|
|
||||||
|
if (suggestion.type == 'emotes') {
|
||||||
|
insertText = suggestion.content;
|
||||||
|
startText = replaceText.replaceFirstMapped(
|
||||||
|
RegExp(r':(?:([a-z0-9_+-]+)~)?([a-z0-9_+-]+)$'),
|
||||||
|
(Match m) => insertText,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suggestion.type == 'users') {
|
||||||
|
insertText = suggestion.content;
|
||||||
|
startText = replaceText.replaceFirstMapped(
|
||||||
|
RegExp(r'(?:\s|^)@([a-z0-9_+-]+)$'),
|
||||||
|
(Match m) => insertText,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insertText.isNotEmpty && startText.isNotEmpty) {
|
||||||
|
_textController.text = startText + afterText;
|
||||||
|
_textController.selection = TextSelection(
|
||||||
|
baseOffset: startText.length,
|
||||||
|
extentOffset: startText.length,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(covariant ChatMessageInput oldWidget) {
|
void didUpdateWidget(covariant ChatMessageInput oldWidget) {
|
||||||
syncWidget();
|
_syncWidget();
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +271,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final notifyBannerActions = [
|
final notifyBannerActions = [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: resetInput,
|
onPressed: _resetInput,
|
||||||
child: Text('cancel'.tr),
|
child: Text('cancel'.tr),
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
@ -251,7 +315,20 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TypeAheadField<ChatMessageSuggestion>(
|
||||||
|
direction: VerticalDirection.up,
|
||||||
|
hideOnEmpty: true,
|
||||||
|
hideOnLoading: true,
|
||||||
|
controller: _textController,
|
||||||
|
focusNode: _focusNode,
|
||||||
|
hideOnSelect: false,
|
||||||
|
debounceDuration: const Duration(milliseconds: 500),
|
||||||
|
onSelected: (value) {
|
||||||
|
_insertSuggestion(value);
|
||||||
|
},
|
||||||
|
itemBuilder: (context, item) => _buildSuggestion(item),
|
||||||
|
builder: (context, controller, focusNode) {
|
||||||
|
return TextField(
|
||||||
controller: _textController,
|
controller: _textController,
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
@ -259,13 +336,78 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
decoration: InputDecoration.collapsed(
|
decoration: InputDecoration.collapsed(
|
||||||
hintText: widget.placeholder ??
|
hintText: widget.placeholder ??
|
||||||
'messageInputPlaceholder'.trParams(
|
'messageInputPlaceholder'.trParams({
|
||||||
{'channel': '#${widget.channel.alias}'},
|
'channel': '#${widget.channel.alias}',
|
||||||
),
|
}),
|
||||||
),
|
),
|
||||||
onSubmitted: (_) => _sendMessage(),
|
onSubmitted: (_) => _sendMessage(),
|
||||||
onTapOutside: (_) =>
|
onTapOutside: (_) =>
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
suggestionsCallback: (search) async {
|
||||||
|
final searchText = _textController.text
|
||||||
|
.substring(0, _textController.selection.baseOffset);
|
||||||
|
|
||||||
|
final emojiMatch =
|
||||||
|
RegExp(r':(?:([a-z0-9_+-]+)~)?([a-z0-9_+-]+)$')
|
||||||
|
.firstMatch(searchText);
|
||||||
|
if (emojiMatch != null) {
|
||||||
|
final StickerProvider stickers = Get.find();
|
||||||
|
final emoteSearch = emojiMatch[2]!;
|
||||||
|
return stickers.availableStickers
|
||||||
|
.where((x) =>
|
||||||
|
x.textWarpedPlaceholder.contains(emoteSearch))
|
||||||
|
.map(
|
||||||
|
(x) => ChatMessageSuggestion(
|
||||||
|
type: 'emotes',
|
||||||
|
leading: PlatformInfo.canCacheImage
|
||||||
|
? CachedNetworkImage(
|
||||||
|
imageUrl: x.imageUrl,
|
||||||
|
width: 28,
|
||||||
|
height: 28,
|
||||||
|
)
|
||||||
|
: Image.network(
|
||||||
|
x.imageUrl,
|
||||||
|
width: 28,
|
||||||
|
height: 28,
|
||||||
|
),
|
||||||
|
display: x.name,
|
||||||
|
content: x.textWarpedPlaceholder,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
final userMatch = RegExp(r'(?:\s|^)@([a-z0-9_+-]+)$')
|
||||||
|
.firstMatch(searchText);
|
||||||
|
if (userMatch != null) {
|
||||||
|
final userSearch = userMatch[1]!.toLowerCase();
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
|
||||||
|
final client = auth.configureClient('auth');
|
||||||
|
final resp = await client.get(
|
||||||
|
'/users/search?probe=$userSearch',
|
||||||
|
);
|
||||||
|
|
||||||
|
final List<Account> result = resp.body
|
||||||
|
.map((x) => Account.fromJson(x))
|
||||||
|
.toList()
|
||||||
|
.cast<Account>();
|
||||||
|
return result
|
||||||
|
.map(
|
||||||
|
(x) => ChatMessageSuggestion(
|
||||||
|
type: 'users',
|
||||||
|
leading: AccountAvatar(content: x.avatar),
|
||||||
|
display: x.nick,
|
||||||
|
content: '@${x.name}',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
@ -1,19 +1,33 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_markdown_selectionarea/flutter_markdown.dart';
|
import 'package:flutter_markdown_selectionarea/flutter_markdown.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:markdown/markdown.dart' as markdown;
|
import 'package:markdown/markdown.dart' as markdown;
|
||||||
|
import 'package:markdown/markdown.dart';
|
||||||
|
import 'package:solian/platform.dart';
|
||||||
|
import 'package:solian/providers/stickers.dart';
|
||||||
|
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
|
import 'account/account_profile_popup.dart';
|
||||||
|
|
||||||
class MarkdownTextContent extends StatelessWidget {
|
class MarkdownTextContent extends StatelessWidget {
|
||||||
final String content;
|
final String content;
|
||||||
|
final String parentId;
|
||||||
final bool isSelectable;
|
final bool isSelectable;
|
||||||
|
|
||||||
const MarkdownTextContent({
|
const MarkdownTextContent({
|
||||||
super.key,
|
super.key,
|
||||||
required this.content,
|
required this.content,
|
||||||
|
required this.parentId,
|
||||||
this.isSelectable = false,
|
this.isSelectable = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
Widget _buildContent(BuildContext context) {
|
Widget _buildContent(BuildContext context) {
|
||||||
|
final emojiMatch = RegExp(r':([a-z0-9_+-]+):').allMatches(content);
|
||||||
|
final isOnlyEmoji =
|
||||||
|
content.replaceAll(RegExp(r':([a-z0-9_+-]+):'), '').trim().isEmpty;
|
||||||
|
|
||||||
return Markdown(
|
return Markdown(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
@ -34,18 +48,90 @@ class MarkdownTextContent extends StatelessWidget {
|
|||||||
extensionSet: markdown.ExtensionSet(
|
extensionSet: markdown.ExtensionSet(
|
||||||
markdown.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
markdown.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
||||||
<markdown.InlineSyntax>[
|
<markdown.InlineSyntax>[
|
||||||
|
_UserNameCardInlineSyntax(),
|
||||||
|
_CustomEmoteInlineSyntax(),
|
||||||
markdown.EmojiSyntax(),
|
markdown.EmojiSyntax(),
|
||||||
|
markdown.AutolinkSyntax(),
|
||||||
markdown.AutolinkExtensionSyntax(),
|
markdown.AutolinkExtensionSyntax(),
|
||||||
...markdown.ExtensionSet.gitHubFlavored.inlineSyntaxes
|
...markdown.ExtensionSet.gitHubFlavored.inlineSyntaxes
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTapLink: (text, href, title) async {
|
onTapLink: (text, href, title) async {
|
||||||
if (href == null) return;
|
if (href == null) return;
|
||||||
|
if (href.startsWith('solink://')) {
|
||||||
|
final segments = href.replaceFirst('solink://', '').split('/');
|
||||||
|
switch (segments[0]) {
|
||||||
|
case 'users':
|
||||||
|
showModalBottomSheet(
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AccountProfilePopup(
|
||||||
|
name: segments[1],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await launchUrlString(
|
await launchUrlString(
|
||||||
href,
|
href,
|
||||||
mode: LaunchMode.externalApplication,
|
mode: LaunchMode.externalApplication,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
imageBuilder: (uri, title, alt) {
|
||||||
|
var url = uri.toString();
|
||||||
|
double? width, height;
|
||||||
|
BoxFit? fit;
|
||||||
|
if (url.startsWith('solink://')) {
|
||||||
|
final segments = url.replaceFirst('solink://', '').split('/');
|
||||||
|
switch (segments[0]) {
|
||||||
|
case 'stickers':
|
||||||
|
final StickerProvider sticker = Get.find();
|
||||||
|
url = sticker.aliasImageMapping[segments[1]]!;
|
||||||
|
if (emojiMatch.length <= 1 && isOnlyEmoji) {
|
||||||
|
width = 112;
|
||||||
|
height = 112;
|
||||||
|
} else if (emojiMatch.length <= 3 && isOnlyEmoji) {
|
||||||
|
width = 56;
|
||||||
|
height = 56;
|
||||||
|
} else {
|
||||||
|
width = 28;
|
||||||
|
height = 28;
|
||||||
|
}
|
||||||
|
fit = BoxFit.contain;
|
||||||
|
break;
|
||||||
|
case 'attachments':
|
||||||
|
const radius = BorderRadius.all(Radius.circular(8));
|
||||||
|
return LimitedBox(
|
||||||
|
maxHeight: MediaQuery.of(context).size.width,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: radius,
|
||||||
|
child: AttachmentSelfContainedEntry(
|
||||||
|
isDense: true,
|
||||||
|
parentId: parentId,
|
||||||
|
id: int.parse(segments[1]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).paddingSymmetric(vertical: 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PlatformInfo.canCacheImage
|
||||||
|
? CachedNetworkImage(
|
||||||
|
imageUrl: url,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
fit: fit,
|
||||||
|
)
|
||||||
|
: Image.network(
|
||||||
|
url,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
fit: fit,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,3 +143,39 @@ class MarkdownTextContent extends StatelessWidget {
|
|||||||
return _buildContent(context);
|
return _buildContent(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _UserNameCardInlineSyntax extends InlineSyntax {
|
||||||
|
_UserNameCardInlineSyntax() : super(r'@[a-zA-Z0-9_]+');
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool onMatch(markdown.InlineParser parser, Match match) {
|
||||||
|
final alias = match[0]!;
|
||||||
|
final anchor = markdown.Element.text('a', alias)
|
||||||
|
..attributes['href'] = Uri.encodeFull(
|
||||||
|
'solink://users/${alias.substring(1)}',
|
||||||
|
);
|
||||||
|
parser.addNode(anchor);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomEmoteInlineSyntax extends InlineSyntax {
|
||||||
|
_CustomEmoteInlineSyntax() : super(r':([a-z0-9_+-]+):');
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool onMatch(markdown.InlineParser parser, Match match) {
|
||||||
|
final StickerProvider sticker = Get.find();
|
||||||
|
final alias = match[1]!;
|
||||||
|
if (sticker.aliasImageMapping[alias] == null) {
|
||||||
|
parser.advanceBy(1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final element = markdown.Element.empty('img');
|
||||||
|
element.attributes['src'] = 'solink://stickers/$alias';
|
||||||
|
parser.addNode(element);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:solian/exts.dart';
|
import 'package:solian/exts.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
|
import 'package:solian/platform.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/screens/posts/post_editor.dart';
|
import 'package:solian/screens/posts/post_editor.dart';
|
||||||
@ -38,12 +39,24 @@ class _PostActionState extends State<PostAction> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _doShare() async {
|
Future<void> _doShare({bool noUri = false}) async {
|
||||||
final box = context.findRenderObject() as RenderBox?;
|
final box = context.findRenderObject() as RenderBox?;
|
||||||
|
if ((PlatformInfo.isAndroid || PlatformInfo.isIOS) && !noUri) {
|
||||||
|
await Share.shareUri(
|
||||||
|
Uri.parse('https://sn.solsynth.dev/posts/view/${widget.item.id}'),
|
||||||
|
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final extraContent = [
|
||||||
|
widget.item.body['title'],
|
||||||
|
widget.item.body['description'],
|
||||||
|
];
|
||||||
|
final isExtraNotEmpty = extraContent.any((x) => x != null);
|
||||||
await Share.share(
|
await Share.share(
|
||||||
'postShareContent'.trParams({
|
'postShareContent'.trParams({
|
||||||
'username': widget.item.author.nick,
|
'username': widget.item.author.nick,
|
||||||
'content': widget.item.body['content'] ?? 'no content',
|
'content':
|
||||||
|
'${extraContent.join('\n')}${isExtraNotEmpty ? '\n\n' : ''}${widget.item.body['content'] ?? 'no content'}',
|
||||||
'link': 'https://sn.solsynth.dev/posts/view/${widget.item.id}',
|
'link': 'https://sn.solsynth.dev/posts/view/${widget.item.id}',
|
||||||
}),
|
}),
|
||||||
subject: 'postShareSubject'.trParams({
|
subject: 'postShareSubject'.trParams({
|
||||||
@ -52,6 +65,7 @@ class _PostActionState extends State<PostAction> {
|
|||||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -86,6 +100,16 @@ class _PostActionState extends State<PostAction> {
|
|||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
leading: const Icon(Icons.share),
|
leading: const Icon(Icons.share),
|
||||||
title: Text('share'.tr),
|
title: Text('share'.tr),
|
||||||
|
trailing: PlatformInfo.isIOS || PlatformInfo.isAndroid
|
||||||
|
? IconButton(
|
||||||
|
icon: const Icon(Icons.link_off),
|
||||||
|
tooltip: 'shareNoUri'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
await _doShare(noUri: true);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: null,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _doShare();
|
await _doShare();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@ -97,13 +121,13 @@ class _PostActionState extends State<PostAction> {
|
|||||||
leading: const FaIcon(FontAwesomeIcons.reply, size: 20),
|
leading: const FaIcon(FontAwesomeIcons.reply, size: 20),
|
||||||
title: Text('reply'.tr),
|
title: Text('reply'.tr),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final value = await AppRouter.instance.pushNamed(
|
Navigator.pop(
|
||||||
|
context,
|
||||||
|
AppRouter.instance.pushNamed(
|
||||||
'postEditor',
|
'postEditor',
|
||||||
extra: PostPublishArguments(reply: widget.item),
|
extra: PostPublishArguments(reply: widget.item),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (value != null) {
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (!widget.noReact)
|
if (!widget.noReact)
|
||||||
@ -112,13 +136,13 @@ class _PostActionState extends State<PostAction> {
|
|||||||
leading: const FaIcon(FontAwesomeIcons.retweet, size: 20),
|
leading: const FaIcon(FontAwesomeIcons.retweet, size: 20),
|
||||||
title: Text('repost'.tr),
|
title: Text('repost'.tr),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final value = await AppRouter.instance.pushNamed(
|
Navigator.pop(
|
||||||
|
context,
|
||||||
|
AppRouter.instance.pushNamed(
|
||||||
'postEditor',
|
'postEditor',
|
||||||
extra: PostPublishArguments(repost: widget.item),
|
extra: PostPublishArguments(repost: widget.item),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (value != null) {
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (_canModifyContent && !widget.noReact)
|
if (_canModifyContent && !widget.noReact)
|
||||||
@ -146,13 +170,13 @@ class _PostActionState extends State<PostAction> {
|
|||||||
leading: const Icon(Icons.edit),
|
leading: const Icon(Icons.edit),
|
||||||
title: Text('edit'.tr),
|
title: Text('edit'.tr),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final value = await AppRouter.instance.pushNamed(
|
Navigator.pop(
|
||||||
|
context,
|
||||||
|
AppRouter.instance.pushNamed(
|
||||||
'postEditor',
|
'postEditor',
|
||||||
extra: PostPublishArguments(edit: widget.item),
|
extra: PostPublishArguments(edit: widget.item),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (value != null) {
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (_canModifyContent)
|
if (_canModifyContent)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:animations/animations.dart';
|
import 'package:animations/animations.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get_utils/get_utils.dart';
|
import 'package:get/get_utils/get_utils.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@ -22,7 +23,9 @@ class PostItem extends StatefulWidget {
|
|||||||
final bool isReactable;
|
final bool isReactable;
|
||||||
final bool isShowReply;
|
final bool isShowReply;
|
||||||
final bool isShowEmbed;
|
final bool isShowEmbed;
|
||||||
|
final bool isOverrideEmbedClickable;
|
||||||
final bool isFullDate;
|
final bool isFullDate;
|
||||||
|
final bool isFullContent;
|
||||||
final bool isContentSelectable;
|
final bool isContentSelectable;
|
||||||
final String? attachmentParent;
|
final String? attachmentParent;
|
||||||
final Color? backgroundColor;
|
final Color? backgroundColor;
|
||||||
@ -35,7 +38,9 @@ class PostItem extends StatefulWidget {
|
|||||||
this.isReactable = true,
|
this.isReactable = true,
|
||||||
this.isShowReply = true,
|
this.isShowReply = true,
|
||||||
this.isShowEmbed = true,
|
this.isShowEmbed = true,
|
||||||
|
this.isOverrideEmbedClickable = false,
|
||||||
this.isFullDate = false,
|
this.isFullDate = false,
|
||||||
|
this.isFullContent = false,
|
||||||
this.isContentSelectable = false,
|
this.isContentSelectable = false,
|
||||||
this.attachmentParent,
|
this.attachmentParent,
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
@ -73,12 +78,13 @@ class _PostItemState extends State<PostItem> {
|
|||||||
|
|
||||||
Widget _buildHeader() {
|
Widget _buildHeader() {
|
||||||
return Row(
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (widget.isCompact)
|
if (widget.isCompact)
|
||||||
AccountAvatar(
|
AccountAvatar(
|
||||||
content: item.author.avatar.toString(),
|
content: item.author.avatar.toString(),
|
||||||
radius: 10,
|
radius: 10,
|
||||||
).paddingOnly(left: 2),
|
).paddingOnly(left: 2, top: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -105,18 +111,26 @@ class _PostItemState extends State<PostItem> {
|
|||||||
item.body['description'],
|
item.body['description'],
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
if (item.body['description'] != null ||
|
|
||||||
item.body['title'] != null)
|
|
||||||
const Divider(thickness: 0.3, height: 1).paddingSymmetric(
|
|
||||||
vertical: 8,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
).paddingOnly(left: widget.isCompact ? 6 : 12),
|
).paddingOnly(left: widget.isCompact ? 6 : 12),
|
||||||
),
|
),
|
||||||
|
if (widget.item.type == 'article')
|
||||||
|
Badge(
|
||||||
|
label: Text('article'.tr),
|
||||||
|
).paddingOnly(top: 3),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildHeaderDivider() {
|
||||||
|
if (item.body['description'] != null || item.body['title'] != null) {
|
||||||
|
return const Divider(thickness: 0.3, height: 1).paddingSymmetric(
|
||||||
|
vertical: 8,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildFooter() {
|
Widget _buildFooter() {
|
||||||
List<String> labels = List.empty(growable: true);
|
List<String> labels = List.empty(growable: true);
|
||||||
if (widget.item.editedAt != null) {
|
if (widget.item.editedAt != null) {
|
||||||
@ -164,6 +178,7 @@ class _PostItemState extends State<PostItem> {
|
|||||||
|
|
||||||
Widget _buildReply(BuildContext context) {
|
Widget _buildReply(BuildContext context) {
|
||||||
return OpenContainer(
|
return OpenContainer(
|
||||||
|
tappable: widget.isClickable || widget.isOverrideEmbedClickable,
|
||||||
closedBuilder: (_, openContainer) => Column(
|
closedBuilder: (_, openContainer) => Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
@ -202,13 +217,15 @@ class _PostItemState extends State<PostItem> {
|
|||||||
),
|
),
|
||||||
closedElevation: 0,
|
closedElevation: 0,
|
||||||
openElevation: 0,
|
openElevation: 0,
|
||||||
closedColor: widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
closedColor:
|
||||||
|
widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
||||||
openColor: Theme.of(context).colorScheme.surface,
|
openColor: Theme.of(context).colorScheme.surface,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRepost(BuildContext context) {
|
Widget _buildRepost(BuildContext context) {
|
||||||
return OpenContainer(
|
return OpenContainer(
|
||||||
|
tappable: widget.isClickable || widget.isOverrideEmbedClickable,
|
||||||
closedBuilder: (_, openContainer) => Column(
|
closedBuilder: (_, openContainer) => Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
@ -247,11 +264,14 @@ class _PostItemState extends State<PostItem> {
|
|||||||
),
|
),
|
||||||
closedElevation: 0,
|
closedElevation: 0,
|
||||||
openElevation: 0,
|
openElevation: 0,
|
||||||
closedColor: widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
closedColor:
|
||||||
|
widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
||||||
openColor: Theme.of(context).colorScheme.surface,
|
openColor: Theme.of(context).colorScheme.surface,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _contentHeight = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final List<int> attachments = item.body['attachments'] is List
|
final List<int> attachments = item.body['attachments'] is List
|
||||||
@ -264,7 +284,18 @@ class _PostItemState extends State<PostItem> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildHeader().paddingSymmetric(horizontal: 12),
|
_buildHeader().paddingSymmetric(horizontal: 12),
|
||||||
MarkdownTextContent(
|
_buildHeaderDivider().paddingSymmetric(horizontal: 12),
|
||||||
|
Stack(
|
||||||
|
children: [
|
||||||
|
SizedContainer(
|
||||||
|
maxWidth: 640,
|
||||||
|
maxHeight: widget.isFullContent ? double.infinity : 80,
|
||||||
|
child: _MeasureSize(
|
||||||
|
onChange: (size) {
|
||||||
|
setState(() => _contentHeight = size.height);
|
||||||
|
},
|
||||||
|
child: MarkdownTextContent(
|
||||||
|
parentId: 'p${item.id}',
|
||||||
content: item.body['content'],
|
content: item.body['content'],
|
||||||
isSelectable: widget.isContentSelectable,
|
isSelectable: widget.isContentSelectable,
|
||||||
).paddingOnly(
|
).paddingOnly(
|
||||||
@ -273,15 +304,41 @@ class _PostItemState extends State<PostItem> {
|
|||||||
top: 2,
|
top: 2,
|
||||||
bottom: hasAttachment ? 4 : 0,
|
bottom: hasAttachment ? 4 : 0,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (_contentHeight >= 80 && !widget.isFullContent)
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: Container(
|
||||||
|
height: 80,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.bottomCenter,
|
||||||
|
end: Alignment.topCenter,
|
||||||
|
colors: [
|
||||||
|
Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
|
Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surface
|
||||||
|
.withOpacity(0),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
_buildFooter().paddingOnly(left: 16),
|
_buildFooter().paddingOnly(left: 16),
|
||||||
if (attachments.isNotEmpty)
|
if (attachments.isNotEmpty)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.attachment,
|
Icons.file_copy,
|
||||||
size: 18,
|
size: 15,
|
||||||
color: _unFocusColor,
|
color: _unFocusColor,
|
||||||
).paddingOnly(right: 6),
|
).paddingOnly(right: 5),
|
||||||
Text(
|
Text(
|
||||||
'attachmentHint'.trParams(
|
'attachmentHint'.trParams(
|
||||||
{'count': attachments.length.toString()},
|
{'count': attachments.length.toString()},
|
||||||
@ -295,6 +352,7 @@ class _PostItemState extends State<PostItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return OpenContainer(
|
return OpenContainer(
|
||||||
|
tappable: widget.isClickable,
|
||||||
closedBuilder: (_, openContainer) => Column(
|
closedBuilder: (_, openContainer) => Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -310,7 +368,7 @@ class _PostItemState extends State<PostItem> {
|
|||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AccountProfilePopup(
|
builder: (context) => AccountProfilePopup(
|
||||||
account: item.author,
|
name: item.author.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -320,13 +378,48 @@ class _PostItemState extends State<PostItem> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildHeader(),
|
_buildHeader(),
|
||||||
|
_buildHeaderDivider(),
|
||||||
|
Stack(
|
||||||
|
children: [
|
||||||
SizedContainer(
|
SizedContainer(
|
||||||
maxWidth: 640,
|
maxWidth: 640,
|
||||||
|
maxHeight:
|
||||||
|
widget.isFullContent ? double.infinity : 320,
|
||||||
|
child: _MeasureSize(
|
||||||
|
onChange: (size) {
|
||||||
|
setState(() => _contentHeight = size.height);
|
||||||
|
},
|
||||||
child: MarkdownTextContent(
|
child: MarkdownTextContent(
|
||||||
|
parentId: 'p${item.id}',
|
||||||
content: item.body['content'],
|
content: item.body['content'],
|
||||||
isSelectable: widget.isContentSelectable,
|
isSelectable: widget.isContentSelectable,
|
||||||
).paddingOnly(left: 12, right: 8),
|
).paddingOnly(left: 12, right: 8),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
if (_contentHeight >= 320 && !widget.isFullContent)
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: Container(
|
||||||
|
height: 320,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.bottomCenter,
|
||||||
|
end: Alignment.topCenter,
|
||||||
|
colors: [
|
||||||
|
Theme.of(context).colorScheme.surface,
|
||||||
|
Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surface
|
||||||
|
.withOpacity(0),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
if (widget.item.replyTo != null && widget.isShowEmbed)
|
if (widget.item.replyTo != null && widget.isShowEmbed)
|
||||||
_buildReply(context).paddingOnly(top: 4),
|
_buildReply(context).paddingOnly(top: 4),
|
||||||
if (widget.item.repostTo != null && widget.isShowEmbed)
|
if (widget.item.repostTo != null && widget.isShowEmbed)
|
||||||
@ -347,7 +440,7 @@ class _PostItemState extends State<PostItem> {
|
|||||||
attachmentsId: attachments,
|
attachmentsId: attachments,
|
||||||
isGrid: attachments.length > 1,
|
isGrid: attachments.length > 1,
|
||||||
),
|
),
|
||||||
if (widget.isShowReply && widget.isReactable)
|
if (widget.isShowReply || widget.isReactable)
|
||||||
PostQuickAction(
|
PostQuickAction(
|
||||||
isShowReply: widget.isShowReply,
|
isShowReply: widget.isShowReply,
|
||||||
isReactable: widget.isReactable,
|
isReactable: widget.isReactable,
|
||||||
@ -377,8 +470,51 @@ class _PostItemState extends State<PostItem> {
|
|||||||
),
|
),
|
||||||
closedElevation: 0,
|
closedElevation: 0,
|
||||||
openElevation: 0,
|
openElevation: 0,
|
||||||
closedColor: widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
closedColor:
|
||||||
|
widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
|
||||||
openColor: Theme.of(context).colorScheme.surface,
|
openColor: Theme.of(context).colorScheme.surface,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef _OnWidgetSizeChange = void Function(Size size);
|
||||||
|
|
||||||
|
class _MeasureSizeRenderObject extends RenderProxyBox {
|
||||||
|
Size? oldSize;
|
||||||
|
_OnWidgetSizeChange onChange;
|
||||||
|
|
||||||
|
_MeasureSizeRenderObject(this.onChange);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void performLayout() {
|
||||||
|
super.performLayout();
|
||||||
|
|
||||||
|
Size newSize = child!.size;
|
||||||
|
if (oldSize == newSize) return;
|
||||||
|
|
||||||
|
oldSize = newSize;
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
onChange(newSize);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MeasureSize extends SingleChildRenderObjectWidget {
|
||||||
|
final _OnWidgetSizeChange onChange;
|
||||||
|
|
||||||
|
const _MeasureSize({
|
||||||
|
required this.onChange,
|
||||||
|
required Widget super.child,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
RenderObject createRenderObject(BuildContext context) {
|
||||||
|
return _MeasureSizeRenderObject(onChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void updateRenderObject(
|
||||||
|
BuildContext context, covariant _MeasureSizeRenderObject renderObject) {
|
||||||
|
renderObject.onChange = onChange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -85,7 +85,13 @@ class PostListEntryWidget extends StatelessWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => PostAction(item: item),
|
builder: (context) => PostAction(item: item),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) onUpdate();
|
if (value is Future) {
|
||||||
|
value.then((_) {
|
||||||
|
onUpdate();
|
||||||
|
});
|
||||||
|
} else if (value != null) {
|
||||||
|
onUpdate();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -6,18 +6,21 @@ import 'package:solian/widgets/posts/post_item.dart';
|
|||||||
class PostOwnedListEntry extends StatelessWidget {
|
class PostOwnedListEntry extends StatelessWidget {
|
||||||
final Post item;
|
final Post item;
|
||||||
final Function onTap;
|
final Function onTap;
|
||||||
|
final bool isFullContent;
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
const PostOwnedListEntry({
|
const PostOwnedListEntry({
|
||||||
super.key,
|
super.key,
|
||||||
required this.item,
|
required this.item,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
|
this.isFullContent = false,
|
||||||
|
this.backgroundColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Card(
|
||||||
child: InkWell(
|
child: GestureDetector(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -28,6 +31,8 @@ class PostOwnedListEntry extends StatelessWidget {
|
|||||||
isClickable: false,
|
isClickable: false,
|
||||||
isShowReply: false,
|
isShowReply: false,
|
||||||
isReactable: false,
|
isReactable: false,
|
||||||
|
isFullContent: isFullContent,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
).paddingSymmetric(vertical: 8),
|
).paddingSymmetric(vertical: 8),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -9,6 +9,7 @@ class PostWarpedListWidget extends StatelessWidget {
|
|||||||
final bool isNestedClickable;
|
final bool isNestedClickable;
|
||||||
final bool isPinned;
|
final bool isPinned;
|
||||||
final PagingController<int, Post> controller;
|
final PagingController<int, Post> controller;
|
||||||
|
final Function? onUpdate;
|
||||||
|
|
||||||
const PostWarpedListWidget({
|
const PostWarpedListWidget({
|
||||||
super.key,
|
super.key,
|
||||||
@ -17,6 +18,7 @@ class PostWarpedListWidget extends StatelessWidget {
|
|||||||
this.isClickable = true,
|
this.isClickable = true,
|
||||||
this.isNestedClickable = true,
|
this.isNestedClickable = true,
|
||||||
this.isPinned = true,
|
this.isPinned = true,
|
||||||
|
this.onUpdate,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -35,9 +37,7 @@ class PostWarpedListWidget extends StatelessWidget {
|
|||||||
isNestedClickable: isNestedClickable,
|
isNestedClickable: isNestedClickable,
|
||||||
isClickable: isClickable,
|
isClickable: isClickable,
|
||||||
item: item,
|
item: item,
|
||||||
onUpdate: () {
|
onUpdate: onUpdate ?? () {},
|
||||||
controller.refresh();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -157,7 +157,7 @@ class _RealmMemberListPopupState extends State<RealmMemberListPopup> {
|
|||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AccountProfilePopup(
|
builder: (context) => AccountProfilePopup(
|
||||||
account: element.account,
|
name: element.account.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
|
|||||||
class SizedContainer extends StatelessWidget {
|
class SizedContainer extends StatelessWidget {
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final double maxWidth;
|
final double maxWidth;
|
||||||
|
final double maxHeight;
|
||||||
|
|
||||||
const SizedContainer({
|
const SizedContainer({
|
||||||
super.key,
|
super.key,
|
||||||
required this.child,
|
required this.child,
|
||||||
this.maxWidth = 720,
|
this.maxWidth = 720,
|
||||||
|
this.maxHeight = double.infinity,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -15,7 +17,7 @@ class SizedContainer extends StatelessWidget {
|
|||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints(maxWidth: maxWidth),
|
constraints: BoxConstraints(maxWidth: maxWidth, maxHeight: maxHeight),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
211
lib/widgets/stickers/sticker_uploader.dart
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exts.dart';
|
||||||
|
import 'package:solian/models/stickers.dart';
|
||||||
|
import 'package:solian/providers/auth.dart';
|
||||||
|
import 'package:solian/widgets/attachments/attachment_editor.dart';
|
||||||
|
|
||||||
|
class StickerUploadDialog extends StatefulWidget {
|
||||||
|
final Sticker? edit;
|
||||||
|
|
||||||
|
const StickerUploadDialog({super.key, this.edit});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StickerUploadDialog> createState() => _StickerUploadDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StickerUploadDialogState extends State<StickerUploadDialog> {
|
||||||
|
final TextEditingController _attachmentController = TextEditingController();
|
||||||
|
final TextEditingController _packController = TextEditingController();
|
||||||
|
final TextEditingController _aliasController = TextEditingController();
|
||||||
|
final TextEditingController _nameController = TextEditingController();
|
||||||
|
|
||||||
|
Color get _unFocusColor =>
|
||||||
|
Theme.of(context).colorScheme.onSurface.withOpacity(0.75);
|
||||||
|
|
||||||
|
bool _isBusy = false;
|
||||||
|
|
||||||
|
void _promptUploadNewAttachment() {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AttachmentEditorPopup(
|
||||||
|
usage: 'sticker',
|
||||||
|
singleMode: true,
|
||||||
|
imageOnly: true,
|
||||||
|
autoUpload: true,
|
||||||
|
imageMaxHeight: 28,
|
||||||
|
imageMaxWidth: 28,
|
||||||
|
onAdd: (value) {
|
||||||
|
setState(() {
|
||||||
|
_attachmentController.text = value.toString();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
initialAttachments: const [],
|
||||||
|
onRemove: (_) {},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _applySticker() async {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
if (auth.isAuthorized.isFalse) return;
|
||||||
|
|
||||||
|
if ([
|
||||||
|
_nameController.text.isEmpty,
|
||||||
|
_aliasController.text.isEmpty,
|
||||||
|
_packController.text.isEmpty,
|
||||||
|
_attachmentController.text.isEmpty,
|
||||||
|
].any((x) => x)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
|
Response resp;
|
||||||
|
final client = auth.configureClient('files');
|
||||||
|
if (widget.edit == null) {
|
||||||
|
resp = await client.post('/stickers', {
|
||||||
|
'name': _nameController.text,
|
||||||
|
'alias': _aliasController.text,
|
||||||
|
'pack_id': int.tryParse(_packController.text),
|
||||||
|
'attachment_id': int.tryParse(_attachmentController.text),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resp = await client.put('/stickers/${widget.edit!.id}', {
|
||||||
|
'name': _nameController.text,
|
||||||
|
'alias': _aliasController.text,
|
||||||
|
'pack_id': int.tryParse(_packController.text),
|
||||||
|
'attachment_id': int.tryParse(_attachmentController.text),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() => _isBusy = false);
|
||||||
|
|
||||||
|
if (resp.statusCode != 200) {
|
||||||
|
context.showErrorDialog(resp.bodyString);
|
||||||
|
} else {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.edit != null) {
|
||||||
|
_attachmentController.text = widget.edit!.attachmentId.toString();
|
||||||
|
_packController.text = widget.edit!.packId.toString();
|
||||||
|
_aliasController.text = widget.edit!.alias;
|
||||||
|
_nameController.text = widget.edit!.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_attachmentController.dispose();
|
||||||
|
_packController.dispose();
|
||||||
|
_aliasController.dispose();
|
||||||
|
_nameController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('stickerUploader'.tr),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
title: Text('stickerUploaderAttachmentNew'.tr),
|
||||||
|
contentPadding: const EdgeInsets.only(left: 16, right: 13),
|
||||||
|
trailing: const Icon(Icons.chevron_right),
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
_promptUploadNewAttachment();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
TextField(
|
||||||
|
controller: _attachmentController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
prefixText: '#',
|
||||||
|
labelText: 'stickerUploaderAttachment'.tr,
|
||||||
|
),
|
||||||
|
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
TextField(
|
||||||
|
controller: _packController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
prefixText: '#',
|
||||||
|
labelText: 'stickerUploaderPack'.tr,
|
||||||
|
),
|
||||||
|
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 6),
|
||||||
|
child: Text(
|
||||||
|
'stickerUploaderPackHint'.tr,
|
||||||
|
style: TextStyle(color: _unFocusColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: _aliasController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
labelText: 'stickerUploaderAlias'.tr,
|
||||||
|
),
|
||||||
|
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 6),
|
||||||
|
child: Text(
|
||||||
|
'stickerUploaderAliasHint'.tr,
|
||||||
|
style: TextStyle(color: _unFocusColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: _nameController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
labelText: 'stickerUploaderName'.tr,
|
||||||
|
),
|
||||||
|
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(left: 8, right: 8, top: 4),
|
||||||
|
child: Text(
|
||||||
|
'stickerUploaderNameHint'.tr,
|
||||||
|
style: TextStyle(color: _unFocusColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
foregroundColor:
|
||||||
|
Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||||
|
),
|
||||||
|
onPressed: _isBusy ? null : () => Navigator.pop(context),
|
||||||
|
child: Text('cancel'.tr),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: _isBusy ? null : () => _applySticker(),
|
||||||
|
child: Text('apply'.tr),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -79,7 +79,7 @@ PODS:
|
|||||||
- GoogleUtilities/UserDefaults (7.13.3):
|
- GoogleUtilities/UserDefaults (7.13.3):
|
||||||
- GoogleUtilities/Logger
|
- GoogleUtilities/Logger
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- livekit_client (2.2.2):
|
- livekit_client (2.2.3):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- WebRTC-SDK (= 125.6422.04)
|
- WebRTC-SDK (= 125.6422.04)
|
||||||
- macos_window_utils (1.0.0):
|
- macos_window_utils (1.0.0):
|
||||||
@ -108,7 +108,7 @@ PODS:
|
|||||||
- screen_brightness_macos (0.1.0):
|
- screen_brightness_macos (0.1.0):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- Sentry/HybridSDK (8.32.0)
|
- Sentry/HybridSDK (8.32.0)
|
||||||
- sentry_flutter (8.5.0):
|
- sentry_flutter (8.6.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- Sentry/HybridSDK (= 8.32.0)
|
- Sentry/HybridSDK (= 8.32.0)
|
||||||
@ -240,7 +240,7 @@ SPEC CHECKSUMS:
|
|||||||
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
|
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
|
||||||
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
|
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
|
||||||
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
|
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
|
||||||
livekit_client: c24af2b8474a39325596e714118e05551ec5eacc
|
livekit_client: a59d8778582019242d96fe9da69d4ec48833b5ca
|
||||||
macos_window_utils: 933f91f64805e2eb91a5bd057cf97cd097276663
|
macos_window_utils: 933f91f64805e2eb91a5bd057cf97cd097276663
|
||||||
media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82
|
media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82
|
||||||
media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5
|
media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5
|
||||||
@ -253,7 +253,7 @@ SPEC CHECKSUMS:
|
|||||||
protocol_handler_macos: d10a6c01d6373389ffd2278013ab4c47ed6d6daa
|
protocol_handler_macos: d10a6c01d6373389ffd2278013ab4c47ed6d6daa
|
||||||
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
|
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
|
||||||
Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
|
Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
|
||||||
sentry_flutter: f1d86adcb93a959bc47a40d8d55059bdf7569bc5
|
sentry_flutter: 090351ce1ff5f96a4b33ef9455b7e3b28185387d
|
||||||
share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
|
share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
|
||||||
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
|
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
|
||||||
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
|
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
|
||||||
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 354 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 582 B After Width: | Height: | Size: 698 B |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 5.0 KiB |
104
pubspec.lock
@ -385,6 +385,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.2"
|
||||||
|
field_suggestion:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: field_suggestion
|
||||||
|
sha256: "596362ed67a661a18e01e4f51b8b92424f333baf37cebd48cc647a4c82c858d5"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.5"
|
||||||
file:
|
file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -558,6 +566,54 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.1"
|
version: "7.0.1"
|
||||||
|
flutter_keyboard_visibility:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility
|
||||||
|
sha256: "98664be7be0e3ffca00de50f7f6a287ab62c763fc8c762e0a21584584a3ff4f8"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.0"
|
||||||
|
flutter_keyboard_visibility_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_linux
|
||||||
|
sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
flutter_keyboard_visibility_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_macos
|
||||||
|
sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
flutter_keyboard_visibility_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_platform_interface
|
||||||
|
sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
|
flutter_keyboard_visibility_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_web
|
||||||
|
sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
|
flutter_keyboard_visibility_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_keyboard_visibility_windows
|
||||||
|
sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@ -667,6 +723,14 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_typeahead:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_typeahead
|
||||||
|
sha256: d64712c65db240b1057559b952398ebb6e498077baeebf9b0731dade62438a6d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.2.0"
|
||||||
flutter_web_plugins:
|
flutter_web_plugins:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -736,6 +800,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.2"
|
version: "2.3.2"
|
||||||
|
highlightable:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: highlightable
|
||||||
|
sha256: "526793e148c91977b694d75d99cd34401ea3b65efd223e7b539c76916af86ffd"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.5"
|
||||||
http:
|
http:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1272,6 +1344,38 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
|
pointer_interceptor:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor
|
||||||
|
sha256: "57210410680379aea8b1b7ed6ae0c3ad349bfd56fe845b8ea934a53344b9d523"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.1+2"
|
||||||
|
pointer_interceptor_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_ios
|
||||||
|
sha256: a6906772b3205b42c44614fcea28f818b1e5fdad73a4ca742a7bd49818d9c917
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.1"
|
||||||
|
pointer_interceptor_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_platform_interface
|
||||||
|
sha256: "0597b0560e14354baeb23f8375cd612e8bd4841bf8306ecb71fcd0bb78552506"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.0+1"
|
||||||
|
pointer_interceptor_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: pointer_interceptor_web
|
||||||
|
sha256: "7a7087782110f8c1827170660b09f8aa893e0e9a61431dbbe2ac3fc482e8c044"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.2+1"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -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.0+8
|
version: 1.2.1+8
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.3.4 <4.0.0"
|
sdk: ">=3.3.4 <4.0.0"
|
||||||
@ -66,6 +66,8 @@ dependencies:
|
|||||||
animations: ^2.0.11
|
animations: ^2.0.11
|
||||||
avatar_stack: ^1.2.0
|
avatar_stack: ^1.2.0
|
||||||
async: ^2.11.0
|
async: ^2.11.0
|
||||||
|
field_suggestion: ^0.2.5
|
||||||
|
flutter_typeahead: ^5.2.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@ -113,7 +115,7 @@ flutter:
|
|||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
android:
|
android:
|
||||||
generate: "launcher_icon"
|
generate: "launcher_icon"
|
||||||
image_path: "assets/icon-fit.png"
|
image_path: "assets/icon.png"
|
||||||
ios: true
|
ios: true
|
||||||
image_path: "assets/icon.png"
|
image_path: "assets/icon.png"
|
||||||
min_sdk_android: 21
|
min_sdk_android: 21
|
||||||
|
BIN
web/favicon.png
Before Width: | Height: | Size: 582 B After Width: | Height: | Size: 698 B |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 39 KiB |