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

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

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

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

Loading…
Cancel
Save