Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I hope that when using GFAlert and showDialog together, GFAlert can be vertically centered. #352

Open
@windinternet

Description

Is your feature request related to a problem? Please describe.

It seems that the native GFAlert needs to be used with GFFloatingWidget because it requires providing some containers, masks, etc. This is too complicated and inflexible for popping up dialogs on other pages. Therefore, I want to use showDialog with Material to simplify the use of GFAlert. However, I found that GFAlert cannot be vertically centered even if I set the alignment of GFAlert to center. I also tried wrapping GFAlert with a layer of GFFloatingWidget, but it still doesn't work. So, I came here to ask questions, haha.

Describe the solution you'd like

just like:

static void showCustomDialog(BuildContext context,
 {required Widget widget, bool refuseBack = true, String? title, VoidCallback? onOk}) {
 showDialog(
 context: context,
 barrierDismissible: false,
 barrierColor: Colors.black54,
 builder: (BuildContext context) {
 return WillPopScope(
 onWillPop: () async => !refuseBack,
 child: GFAlert(
 title: title,
 content: widget,
 alignment: Alignment.center,
 onTapOk: () {
 onOk?.call();
 Navigator.pop(context);
 },
 onTapCancel: () {
 Navigator.pop(context);
 },
 ),
 );
 },
 );
 }

Describe alternatives you've considered

static void showCustomDialog(BuildContext context,
 {required Widget widget, bool refuseBack = true, String? title, VoidCallback? onOk}) {
 showDialog(
 context: context,
 barrierDismissible: false,
 barrierColor: Colors.black54,
 builder: (BuildContext context) {
 return WillPopScope(
 onWillPop: () async => !refuseBack,
 child: GFFloatingWidget(
 body: GFAlert(
 title: title,
 content: widget,
 alignment: Alignment.center,
 onTapOk: () {
 onOk?.call();
 Navigator.pop(context);
 },
 onTapCancel: () {
 Navigator.pop(context);
 },
 ),
 ),
 );
 },
 );
 }

Additional context
none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /