Home > Software design >  Parameter named isn't defined
Parameter named isn't defined

Time:04-26

How to fix this parameter name error. It error after I change OutlinedButton. Someone can help me.

enter image description here

Padding(
            padding: EdgeInsets.fromLTRB(0, 10, 10, 10),
            // ignore: deprecated_member_use
            child: OutlinedButton(
              padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
              textColor: secondaryColor,
              borderSide: BorderSide(color: secondaryColor),
              child: Text('Send Notification'),
              onPressed: () => _sendNotificationDialog(context),
              shape: new RoundedRectangleBorder(
                borderRadius: new BorderRadius.circular(30.0),
              ),
            ),
          ),

CodePudding user response:

What did you had before OutlinedButton ?

The code error means that the parameters you try to assign, doesn't exist in the OutlineButton Widget

Edit :

What I've found is that the buttons were migrated. it could be useful for other of your buttons : See the migration guide in flutter.dev/go/material-button-migration-guide). ' 'This feature was deprecated after v1.26.0-18.0.pre.'

You can try to use style argument instead. You'll find plenty of parameters to edit your button

OutlinedButton(
     style: ButtonStyle(
     shape: ,
     textStyle: ,
   ), onPressed: () {  },
   child: const Text('Hello'),
)

CodePudding user response:

FlatButton, Raised button and some widgets are now deprecated from the flutter framework. They wanted to distinguish the styling of the button from the rest of the widget. As you can see hear: New buttons and button themes Outlined button is not deprecated. To give style to it, you need to override the parameter 'style', like the code below:

OutlinedButton(
                style: OutlinedButton.styleFrom(
                  padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
                  shape: RoundedRectangleBorder(
                    borderRadius: new BorderRadius.circular(30.0),
                    side: BorderSide(
                      color: secondaryColor,
                    ),
                  ),
                ),
                child: Text('Send Notification'),
                onPressed: () => _sendNotificationDialog(context),
              ),
  • Related