Home > Software engineering >  How to create button in flutter?
How to create button in flutter?

Time:09-14

How do you create this button in this way? Need for my academic work. Please help me!! enter image description here

CodePudding user response:

   ElevatedButton(
                onPressed: () {
                
                },
                style: ElevatedButton.styleFrom(
                  foregroundColor: Colors.white,
                  backgroundColor: green,
                  shadowColor: green,
                  elevation: 3,
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(32.0)),
                  minimumSize: const Size(100, 50),
                ),
                child: const Padding(
                  padding: EdgeInsets.all(4.0),
                  child: Text(
                    "Arabic",
                    style: forteenWhite,
                  ),
                )),

CodePudding user response:

Try this :

Container(
              width: 300,
              height: 60,
              color: const Color(0xFF9c1f5d),
              padding: EdgeInsets.all(10),
              child:
                ElevatedButton(
                  onPressed: () {},
                  child: const Text(
                    'Register your account today !',
                    style: TextStyle(
                      color: Colors.black
                    )
                  ),            
                  style: ElevatedButton.styleFrom(
                    primary: const Color(0xFFcc4e8c),
                    shape: RoundedRectangleBorder(                 
                      borderRadius: BorderRadius.circular(20), 
                    ),
                  ),
                ),
              ),

CodePudding user response:

Container(
  padding: Padding.Edgeall(10.0),
  decoration: BoxDecoration(
    borderRadius: BorderRadius.circular(10.0),
    color: Colors.white,
  ),
  height: 55,
  child: Text("This is button")
),

And to use onClick wrap the Text or container with InkWell.

  • Related