Code cleanup

pull/1384/head
Kelrap 1 year ago
parent 02dd22a45f
commit 3d9000d2ae

@ -1132,7 +1132,9 @@ class ChatController extends State<ChatPageWithRoom>
replyEvent = replyTo ?? selectedEvents.first; replyEvent = replyTo ?? selectedEvents.first;
selectedEvents.clear(); selectedEvents.clear();
}); });
// #Pangea
MatrixState.pAnyState.closeAllOverlays(); MatrixState.pAnyState.closeAllOverlays();
// Pangea
inputFocus.requestFocus(); inputFocus.requestFocus();
} }
@ -1248,10 +1250,8 @@ class ChatController extends State<ChatPageWithRoom>
followerAnchor: Alignment.center, followerAnchor: Alignment.center,
backgroundColor: const Color.fromRGBO(0, 0, 0, 1).withAlpha(100), backgroundColor: const Color.fromRGBO(0, 0, 0, 1).withAlpha(100),
closePrevOverlay: false, closePrevOverlay: false,
targetScreen: true,
onDismiss: hideEmojiPicker, onDismiss: hideEmojiPicker,
centered: false, position: OverlayEnum.bottom,
bottom: true,
); );
// Pangea# // Pangea#
} }

@ -11,6 +11,13 @@ import '../../config/themes.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
import 'error_handler.dart'; import 'error_handler.dart';
enum OverlayEnum {
transform,
centered,
topRight,
bottom,
}
class OverlayUtil { class OverlayUtil {
static showOverlay({ static showOverlay({
required BuildContext context, required BuildContext context,
@ -26,10 +33,8 @@ class OverlayUtil {
Alignment? targetAnchor, Alignment? targetAnchor,
Alignment? followerAnchor, Alignment? followerAnchor,
bool closePrevOverlay = true, bool closePrevOverlay = true,
bool targetScreen = false,
Function? onDismiss, Function? onDismiss,
bool centered = true, OverlayEnum position = OverlayEnum.transform,
bool bottom = false,
}) { }) {
try { try {
if (closePrevOverlay) { if (closePrevOverlay) {
@ -48,24 +53,24 @@ class OverlayUtil {
onDismiss: onDismiss, onDismiss: onDismiss,
), ),
Positioned( Positioned(
top: (targetScreen && !centered && !bottom) top: (position == OverlayEnum.topRight)
? FluffyThemes.isColumnMode(context) ? FluffyThemes.isColumnMode(context)
? 20 ? 20
: 65 : 65
: null, : null,
right: (targetScreen && !centered) right: (position == OverlayEnum.topRight)
? bottom ? FluffyThemes.isColumnMode(context)
? 20
: 15
: (position == OverlayEnum.bottom)
? 0 ? 0
: FluffyThemes.isColumnMode(context) : null,
? 20 left: (position == OverlayEnum.bottom) ? 0 : null,
: 15 bottom: (position == OverlayEnum.bottom) ? 0 : null,
: null,
left: bottom ? 0 : null,
bottom: bottom ? 0 : null,
width: width, width: width,
height: height, height: height,
child: targetScreen child: (position != OverlayEnum.transform)
? centered ? (position == OverlayEnum.centered)
? Center(child: child) ? Center(child: child)
: child : child
: CompositedTransformFollower( : CompositedTransformFollower(

@ -136,7 +136,7 @@ class ToolbarDisplayController {
backgroundColor: const Color.fromRGBO(0, 0, 0, 1).withAlpha(200), backgroundColor: const Color.fromRGBO(0, 0, 0, 1).withAlpha(200),
closePrevOverlay: closePrevOverlay:
MatrixState.pangeaController.subscriptionController.isSubscribed, MatrixState.pangeaController.subscriptionController.isSubscribed,
targetScreen: true, position: OverlayEnum.centered,
onDismiss: controller.clearSelectedEvents, onDismiss: controller.clearSelectedEvents,
); );

@ -87,11 +87,8 @@ class OverlayHeader extends StatelessWidget {
transformTargetId: "", transformTargetId: "",
targetAnchor: Alignment.center, targetAnchor: Alignment.center,
followerAnchor: Alignment.center, followerAnchor: Alignment.center,
backgroundColor: Colors.transparent,
closePrevOverlay: false, closePrevOverlay: false,
targetScreen: true, position: OverlayEnum.topRight,
onDismiss: closeToolbar,
centered: false,
); );
} }
} }

Loading…
Cancel
Save