Home > OS >  How to set the width and height of a Outlinebutton in Flutter?
How to set the width and height of a Outlinebutton in Flutter?

Time:12-02

I am new in flutter, how to set width and height OutlineButton in Flutter, i have to try input width and height inside OutlineButton but got some errors. this is my code :

OutlinedButton(
  //width: AppSize.DIMEN_230,
  style: OutlinedButton.styleFrom(
    side: BorderSide(
      width: 2.0, color: Colors.black12,
    ),
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(10),
  ),),
  onPressed: () {
    showDatePicker(
        context: context,
        initialDate: DateTime.now(),
        firstDate: DateTime(1880),
        lastDate: DateTime(2050),
    );
  }, child: Text("YYYY/MM/DD HH:MM:SS",
      style: textStyleW400S16.copyWith(
        fontStyle: FontStyle.italic,
        color: Colors.black54,
      ),
),
),

Is it correct? Is there another way to do it?

CodePudding user response:

Wrap your button in SizedBox, and give it width and height.

SizedBox(
  width: 100,
  height: 100,
  child: OutlinedButton(...),
)

CodePudding user response:

Try below code, and refer image

  • Related