rafaelcb21 rafaelcb21 - 1 month ago 6
Dart Question

Flutter - SimpleDialog in FloatingActionButton

I'm trying to create a

after a tap on the
, however when pressing that button nothing happens.

What was I doing wrong?

import "package:flutter/material.dart";

void main() {
runApp(new ControlleApp());

class ControlleApp extends StatelessWidget {
Widget build(BuildContext context) {
return new MaterialApp(
home: new HomePage(),

class HomePage extends StatelessWidget {
Widget build(BuildContext context) => new Scaffold(
appBar: new AppBar(
backgroundColor: new Color(0xFF26C6DA),
floatingActionButton: new FloatingActionButton(
tooltip: 'Add',
child: new Icon(Icons.add),
backgroundColor: new Color(0xFFF44336),
onPressed: (){
new SimpleDialog(
title: new Text('Test'),
children: <Widget>[
new RadioListTile(
title: new Text('Testing'), value: null, groupValue: null, onChanged: (value) {},

Answer Source

You need to wrap this on a show ActionDialog

showDialog(context: context, child:
    new AlertDialog(
      title: new Text("My Super title"),
      content: new Text("Hello World"),