iosflutterdartflutter-dialogflutter-design

Flutter: Replace bottom Dialog with alert dialog


When I click at an option of my bottom dialog, I want the bottom dialog to be replaced by an alert dialog, Here is my onTap's function code:

Navigator.of(context).pushReplacement(MaterialPageRoute(
      builder: (_) => AlertDialog(
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(15.0),
        ),
        backgroundColor: AppTheme.backgroundColor,
        title: Text('Select reaction'),
        content: Container(
          height: 100,
          width: 100,
        ),
      ),
    ));

Solution

  • found it! i forgot to remove one line of code, now works perfectly,

    as well, i replace

    Navigator.of(context).pushReplacement(.....
    

    with

    showDialog(....