João Martins
João Martins

Reputation: 794

Showing dialog from inside another dialog

How do you show a dialog from an already open dialog? Basically, nesting dialogs in Flutter.

When I try to use showDialog(); in Flutter from inside an already created dialog(for example, by clicking some link inside a dialog, another dialog should open on top of that dialog) I get the following lint error:

Flutter showDialog Lint Error

Does any one have any idea on how to solve this problem?

Upvotes: 2

Views: 1578

Answers (1)

Wilson Wilson
Wilson Wilson

Reputation: 3757

Nesting dialogs is VERY possible. You are facing an entirely different issue.

Right now, you have conflicting imports from the custom_alert_dialog package, and the material.dart.

To resolve the issue, you have to name one of the imports using the as keyword.

E.x

import 'dart:math' as math;

Then to use it:

// BEFORE 
final valueOfPi = pi;

// AFTER
final valueOfPi = math.pi

The syntax of everything remains the same, but whenever you want to use an object or type from the library, just add the keyword as a prefix.

Upvotes: 3

Related Questions