0
votes
  1. productDetails

child: ButtonTheme( child: (TextButton( child: Text( 'Demande de prix', style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w600), ), style: TextButton.styleFrom( primary: Colors.white, backgroundColor: Color(0xFF2664B5), onSurface: Colors.white, ), onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DemandeDevis( productName: (selectedProduitslist[index] .titre) .toUpperCase(), ), ), ); }, )), ), 2.demandedevis

AlertDialog(
  backgroundColor: Colors.white,
  elevation: 20,
  content: SingleChildScrollView(
    child: Form(
      key: _formKey,
      child: ListBody(
        children: <Widget>[
          Container(
            child: Text(
              "Demande de prix",
              textAlign: TextAlign.center,
              style: TextStyle(
                  color: Colors.blue[900],
                  fontSize: 20,
                  fontWeight: FontWeight.bold),
            ),
          ),
          Container(
            width: ResponsiveFlutter.of(context).wp(50),
            padding: EdgeInsets.all(3),
            child: TextFormField(
              controller: largeurController,
              style: TextStyle(color: Colors.black),
              keyboardType: TextInputType.phone,
              // validator: (text) {
              //   if (text == null || text.isEmpty) {
              //     return "Champ obligatoire";
              //   }
              //   return null;
              // },
              decoration: InputDecoration(
                fillColor: Colors.white,
                filled: true,
                hintText: 'Largeur (m)',
                hintStyle: TextStyle(
                  color: Colors.blue[900],
                  fontSize: 10,
                ),
                focusedBorder: OutlineInputBorder(
                  borderSide:
                      BorderSide(color: Colors.blue[900], width: 0.5),
                  borderRadius: BorderRadius.circular(3.0),
                ),
                contentPadding:
                    const EdgeInsets.symmetric(horizontal: 20, vertical: 0),
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(3.0),
                ),
              ),
            ),
          ),
          Container(
            width: ResponsiveFlutter.of(context).wp(50),
            padding: EdgeInsets.all(3),
            child: TextFormField(
              controller: longeurController,
              style: TextStyle(color: Colors.black),
              keyboardType: TextInputType.phone,
              // validator: (text) {
              //   if (text == null || text.isEmpty) {
              //     return "Champ obligatoire";
              //   }
              //   return null;
              // },
              decoration: InputDecoration(
                fillColor: Colors.white,
                filled: true,
                hintText: 'Longeur (m)',
                hintStyle: TextStyle(
                  color: Colors.blue[900],
                  fontSize: 10,
                ),
1
Which button? can you specify?Abdul Malik

1 Answers

0
votes

I'm assuming that you are asking how to show a dialog when a button is pressed.

Every button has an onPressed : argument, in that onPressed function you can execute the showDialog() function to show a dialog in the UI. Given below is the code snippet.

TextButton(
 child: Text(
             'Yes!',
              style: TextStyle(color: Theme.of(context).accentColor),),
              onPressed: () => 
               {

                //This is the function that will execute when the button is pressed

                showDialog(
                     context : context,
                     builder : (context) => AlertDialog()
                          );                
               },
            ),
         );