title: AlertDialog widget not working setState function in Flutter
body: <p>I started to work with DropdownButton widget and I created List of cities.<br/> I want to see AlertDialog when i choose my favorite city on the list but it can't work.
  Here is codes : </p>
  
  <pre><code>import 'package:flutter/material.dart';
  import './func.dart';
  class ChooseCity extends StatefulWidget {
    @override
    State&lt;StatefulWidget&gt; createState() {
      return ChooseCityState();
    }
  }
  
  class ChooseCityState extends State&lt;ChooseCity&gt; {
    var cities = ["Ankara", "İzmir", "İstanbul", "Edirne", "Antalya"];
    String choosenCity = "Edirne";
  
    @override
    Widget build(BuildContext context) {
      return Column(
  
        mainAxisAlignment: MainAxisAlignment.center,
        children: &lt;Widget&gt;[
  
  
  
          DropdownButton&lt;String&gt;(
            items: cities.map((String city) {
              return DropdownMenuItem&lt;String&gt;(
                child: Text(city),
                value: city,
              ); 
            }).toList(),
            value: choosenCity,
            onChanged: (String choosen) {
  
              setState(() {
            choosenCity = choosen;});
            choosen=="Antalya" ? 
              AlertDialog(
                title:Text("ATTENTION"),
                content: Text("You chose the best place!!"),
                actions: [
                   FlatButton(child: Text("I see,I agree"),onPressed: ()=&gt;{},)
                     ],
  
  
                  )
  
                : Text("go on");
  
            },
  
  
          ),
          SizedBox(
            height: 60,
          ),
          Text(
            "    You choosed  :" + choosenCity,
            textAlign: TextAlign.center,
  
  
          ),
        ],
      );
  
    }
  }
  </code></pre>
  
  <p><br/>View of my page : <br/>
  <a href="https://i.stack.imgur.com/XzTrr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XzTrr.png" alt="enter image description here"></a></p>
  
  <p>It doesn't look like as i want. I want to see AlertDialog when i chose "Antalya" . Where is the error? Where should i put the bool function? I tried to put this bool function out of setState function but it didn't be as i want.</p>