Hello I very new to Flutter and I am trying to create a button, but I have a problem with this.
This is the code:
Align(
alignment: AlignmentDirectional(-0.03, 0.13),
child: FFButtonWidget(
onPressed: () {
print('Login pressed ...');
},
text: 'Login',
options: FFButtonOptions(
width: 130,
height: 40,
color: FlutterFlowTheme.of(context).primaryColor,
textStyle: FlutterFlowTheme.of(context).subtitle2.override(
fontFamily: 'Poppins',
color: Colors.white,
),
borderSide: BorderSide(
color: Colors.transparent,
width: 1,
),
borderRadius: BorderRadius.circular(8),
),
),
),
This is the error:
The argument type ‘BorderRadius’ can’t be assigned to the parameter type ‘double?’.
Do you have any suggestion?
2
Answers
I think you are using FlutterFlow.
Here you don’t need to give the border radius like this
Do it like this
This is because FlutterFlow button widget is not like the usual Flutter button widget. They are modified versions of actual Flutter widgets.
In your case, properties of FFButtonWidget is set using this class
This class probably takes borderRadius as a double value and internally sets it like this
So you have to give the required borderRadius as a double value.
The
borderRadius
field in the FFButtonOptions require a double parameter. TryIt is hard to say, because I do not know how the
FFButtonWidget
looks like. Normally, your way of setting the border radius would be good for material widgets, for instance:Probably the
FFButtonWidget
takes a double parameter and finally transforms it intoBut if you want to use material widgets, you can check how the buttons work in Flutter here.