title: TextButton is automatically invoked when the dropDown menu item is changed
body: <p>Here goes my code ,</p>
  <p>I am using the <code>TextButton</code> to update the order ,But after every change in the dropdown item, onPress is automatically invoked and the function <code>updateOrder</code> is automatically invoked</p>
  <pre><code>import 'package:admin/constants/Constants.dart';
  import 'package:admin/model/order_model.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:dropdown_button2/dropdown_button2.dart';
  import 'package:flutter/material.dart';
  
  class DetailsScreen extends StatefulWidget {
    const DetailsScreen({Key? key}) : super(key: key);
  
    @override
    State&lt;DetailsScreen&gt; createState() =&gt; _DetailsScreenState();
  }
  
  class _DetailsScreenState extends State&lt;DetailsScreen&gt; {
    List&lt;String&gt; _dropDownQuantities = [Pending, Confirmed, Rejected, Success];
  
    late OrderModel order;
    late String selectedStatus = order.status;
    @override
    Widget build(BuildContext context) {
      order = ModalRoute.of(context)?.settings.arguments as OrderModel;
  
      return Scaffold(
          appBar: AppBar(
            actions: [],
            title: Text(&quot;Order Details&quot;),
          ),
          body: Column(children: [
            Text(order.id),
            DropdownButtonHideUnderline(
                child: DropdownButton2&lt;String&gt;(
              value: selectedStatus,
              items: _dropDownQuantities
                  .map((e) =&gt; DropdownMenuItem&lt;String&gt;(
                        child: Text(e),
                        value: e,
                      ))
                  .toList(),
              onChanged: (value) {
                setState(() {
                  selectedStatus = value;
                });
              },
            )),
            TextButton(onPressed: updateOrder(order, selectedStatus), child: Text(&quot;Confirm&quot;)),
            
          ]));
    }
  }
  
  updateOrder(OrderModel order, String selected) {
    print(&quot;I am executed&quot;);
  }
  </code></pre>
  <p>So whenever i change the dropDown menu,</p>
  <p><code>I am executed</code> is printed in the console.</p>
  <p><strong>Edit:</strong></p>
  <p>But when i used the container with InkWell it was working fine. Why not working with TextButton ?</p>