add scrollbar

This commit is contained in:
Mike Schwörer 2025-04-18 13:15:33 +02:00
parent 24cd1692c6
commit 967ae915b2
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
4 changed files with 107 additions and 81 deletions

View File

@ -2,24 +2,24 @@
# TODO
- [x] Message List
* [ ] CRUD
* [x] CRUD
- [x] Message Big-View
- [x] Search/Filter Messages
- [x] Channel List
* [x] Show subs
* [ ] CRUD
* [ ] what about unsubbed foreign channels? - thex should still be visible (or should they, do i still get the messages?)
* [x] CRUD
* [x] what about unsubbed foreign channels? - thex should still be visible (or should they, do i still get the messages?)
- [x] Sub List
* [x] Sub/Unsub/Accept/Deny
- [x] Debug List (Show logs, requests)
- [ ] Key List
* [ ] CRUD
- [ ] Auto R-only key for admin, use for QR+link+send
- [x] Key List
* [x] CRUD
- [x] Auto R-only key for admin, use for QR+link+send
- [ ] settings
- [ ] notifications
- [ ] push navigation stack
- [ ] read + migrate old SharedPrefs (or not? - who uses SCN even??)
- [ ] Account-Page
- [?] notifications
- [?] push navigation stack
- [/] read + migrate old SharedPrefs (or not? - who uses SCN even??)
- [x] Account-Page
- [x] Logout
- [x] Send-page
@ -27,10 +27,10 @@
- [x] fix time format (in message-list, in card, top right) - midnight is shown as "24:05" instead of "00:05" - thats weird
- [ ] Add scrollbar
- [x] Add scrollbar
-> https://api.flutter.dev/flutter/material/Scrollbar-class.html
- [ ] you cant unsubscribe from foreign channel without completely loosing subscription.
- [x] you cant unsubscribe from foreign channel without completely loosing subscription.
perhaps subscriptions should have two cofirmed bool (both must be true to receive messages): confirmed-owner && confirmed-subscriber
Then the subscriber can unconfirm his half - without loosing the owner confirmation

View File

@ -31,10 +31,10 @@ if [ -z "$pids" ]; then
exit 1
fi
trap 'echo "reseived SIGNAL<EXIT> - exiting"; exit 0' EXIT
trap 'echo "reseived SIGNAL<SIGINT> - exiting"; exit 0' SIGINT
trap 'echo "reseived SIGNAL<SIGTERM> - exiting"; exit 0' SIGTERM
trap 'echo "reseived SIGNAL<SIGQUIT> - exiting"; exit 0' SIGQUIT
trap 'echo "reseived SIGNAL<EXIT> - exiting"; jobs -p | xargs kill ; exit 0' EXIT
trap 'echo "reseived SIGNAL<SIGINT> - exiting"; jobs -p | xargs kill ; exit 0' SIGINT
trap 'echo "reseived SIGNAL<SIGTERM> - exiting"; jobs -p | xargs kill ; exit 0' SIGTERM
trap 'echo "reseived SIGNAL<SIGQUIT> - exiting"; jobs -p | xargs kill ; exit 0' SIGQUIT
echo ""
while IFS= read -r pid; do

View File

@ -37,6 +37,8 @@ class _MessageViewPageState extends State<MessageViewPage> {
(SCNMessage, ChannelPreview, KeyTokenPreview, UserPreview)? mainFutureSnapshot = null;
static final _dateFormat = DateFormat('yyyy-MM-dd HH:mm'); //TODO setting
final ScrollController _controller = ScrollController();
bool _monospaceMode = false;
SCNMessage? message = null;
@ -83,6 +85,7 @@ class _MessageViewPageState extends State<MessageViewPage> {
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@ -137,8 +140,7 @@ class _MessageViewPageState extends State<MessageViewPage> {
Widget _buildMessageView(BuildContext context, SCNMessage message, ChannelPreview? channel, KeyTokenPreview? token, UserPreview? user) {
final userAccUserID = context.select<AppAuth, String?>((v) => v.userID);
return SingleChildScrollView(
child: Padding(
final child = Padding(
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@ -206,8 +208,32 @@ class _MessageViewPageState extends State<MessageViewPage> {
if (message.senderUserID == userAccUserID) UI.button(text: "Delete Message", onPressed: () {/*TODO*/}, color: Colors.red[900]),
],
),
);
var showScrollbar = true;
if (!_monospaceMode && (message.content ?? '').length > 4096) showScrollbar = true;
if (_monospaceMode && (message.content ?? '').split('\n').length > 64) showScrollbar = true;
if (showScrollbar) {
return Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 6, 0),
child: Scrollbar(
thickness: 12.0,
radius: Radius.circular(6),
thumbVisibility: false,
interactive: true,
controller: _controller,
child: SingleChildScrollView(
controller: _controller,
child: child,
),
),
);
} else {
return SingleChildScrollView(
child: child,
);
}
}
String _resolveChannelName(ChannelPreview? channel, SCNMessage message) {

View File

@ -35,7 +35,7 @@ function send()
if (xhr.readyState !== 4) return;
console.log('Status: ' + xhr.status);
if (xhr.status === 200 || xhr.status === 401 || xhr.status === 403 || xhr.status === 412)
if (xhr.status === 200 || xhr.status === 400 || xhr.status === 401 || xhr.status === 403 || xhr.status === 412)
{
let resp = JSON.parse(xhr.responseText);
if (!resp.success || xhr.status !== 200)