🐛 Fix several known bugs
This commit is contained in:
@ -7,6 +7,7 @@ import 'package:solian/widgets/chat/message_deletion.dart';
|
||||
|
||||
class ChatMessageAction extends StatelessWidget {
|
||||
final String channel;
|
||||
final String realm;
|
||||
final Message item;
|
||||
final Function? onEdit;
|
||||
final Function? onReply;
|
||||
@ -15,6 +16,7 @@ class ChatMessageAction extends StatelessWidget {
|
||||
super.key,
|
||||
required this.channel,
|
||||
required this.item,
|
||||
this.realm = 'global',
|
||||
this.onEdit,
|
||||
this.onReply,
|
||||
});
|
||||
@ -67,6 +69,7 @@ class ChatMessageAction extends StatelessWidget {
|
||||
builder: (context) => ChatMessageDeletionDialog(
|
||||
item: item,
|
||||
channel: channel,
|
||||
realm: realm,
|
||||
),
|
||||
).then((did) {
|
||||
if (did == true && Navigator.canPop(context)) {
|
||||
|
@ -10,17 +10,18 @@ import 'package:solian/widgets/exts.dart';
|
||||
|
||||
class ChatMessageDeletionDialog extends StatefulWidget {
|
||||
final String channel;
|
||||
final String realm;
|
||||
final Message item;
|
||||
|
||||
const ChatMessageDeletionDialog({
|
||||
super.key,
|
||||
required this.item,
|
||||
required this.channel,
|
||||
this.realm = 'global'
|
||||
});
|
||||
|
||||
@override
|
||||
State<ChatMessageDeletionDialog> createState() =>
|
||||
_ChatMessageDeletionDialogState();
|
||||
State<ChatMessageDeletionDialog> createState() => _ChatMessageDeletionDialogState();
|
||||
}
|
||||
|
||||
class _ChatMessageDeletionDialogState extends State<ChatMessageDeletionDialog> {
|
||||
@ -30,8 +31,8 @@ class _ChatMessageDeletionDialogState extends State<ChatMessageDeletionDialog> {
|
||||
final auth = context.read<AuthProvider>();
|
||||
if (!await auth.isAuthorized()) return;
|
||||
|
||||
final uri = getRequestUri('messaging',
|
||||
'/api/channels/global/${widget.channel}/messages/${widget.item.id}');
|
||||
final uri =
|
||||
getRequestUri('messaging', '/api/channels/${widget.realm}/${widget.channel}/messages/${widget.item.id}');
|
||||
|
||||
setState(() => _isSubmitting = true);
|
||||
final res = await auth.client!.delete(uri);
|
||||
|
@ -57,11 +57,13 @@ class RealmShortcuts extends StatelessWidget {
|
||||
onTap: () async {
|
||||
if (SolianTheme.isLargeScreen(context)) {
|
||||
await realm.fetchSingle(auth, element.alias);
|
||||
SolianRouter.router.pushNamed('realms');
|
||||
} else {
|
||||
SolianRouter.router.pushNamed(
|
||||
'realms.details',
|
||||
pathParameters: {'realm': element.alias},
|
||||
);
|
||||
}
|
||||
SolianRouter.router.pushNamed(
|
||||
'realms.details',
|
||||
pathParameters: {'realm': element.alias},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
@ -1,45 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:solian/router.dart';
|
||||
import 'package:solian/utils/theme.dart';
|
||||
import 'package:solian/widgets/navigation_drawer.dart';
|
||||
|
||||
class IndentScaffold extends StatelessWidget {
|
||||
final Widget? child;
|
||||
final Widget? body;
|
||||
final Widget? floatingActionButton;
|
||||
final Widget? appBarLeading;
|
||||
final List<Widget>? appBarActions;
|
||||
final bool noSafeArea;
|
||||
final bool hideDrawer;
|
||||
final bool showSafeArea;
|
||||
final bool fixedAppBarColor;
|
||||
final String title;
|
||||
|
||||
const IndentScaffold({
|
||||
super.key,
|
||||
this.child,
|
||||
this.body,
|
||||
required this.title,
|
||||
this.floatingActionButton,
|
||||
this.appBarLeading,
|
||||
this.appBarActions,
|
||||
this.hideDrawer = false,
|
||||
this.showSafeArea = false,
|
||||
this.fixedAppBarColor = false,
|
||||
this.noSafeArea = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final content = child ?? Container();
|
||||
final backButton = IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
|
||||
onPressed: () {
|
||||
if (SolianRouter.router.canPop()) {
|
||||
SolianRouter.router.pop();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
final drawerButton = Builder(
|
||||
builder: (context) {
|
||||
return IconButton(
|
||||
icon: const Icon(Icons.menu),
|
||||
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
leading: appBarLeading,
|
||||
leading: appBarLeading ?? (hideDrawer ? backButton : drawerButton),
|
||||
actions: appBarActions,
|
||||
centerTitle: false,
|
||||
elevation: fixedAppBarColor ? 4 : null,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
floatingActionButton: floatingActionButton,
|
||||
drawer: !hideDrawer ? const SolianNavigationDrawer() : null,
|
||||
drawerScrimColor: SolianTheme.isLargeScreen(context) ? Colors.transparent : null,
|
||||
body: noSafeArea ? content : SafeArea(child: content),
|
||||
body: showSafeArea ? SafeArea(child: body ?? Container()) : body,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user