Reputation: 21
i'm trying to create a border for a button, but I get this error: "The named parameter 'border' isn't defined" I know that the widgets are updated, but I can't find why the parameter is not identified.
The code is here:
const ChooseOptionScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
alignment: Alignment.center,
child: FractionallySizedBox(
widthFactor: 0.4,
child: OutlinedButton(
border: OutlineInputBorder(borderRadius: BorderRadius.circular(20.0)),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.blue),
textStyle: MaterialStateProperty.all(const TextStyle(color: Colors.white)),
),
onPressed: () {
Navigator.pushNamed(context, '/login');
},
child: const Text('Login'),
),
),
),
const SizedBox(height: 10),
Container(
alignment: Alignment.center,
child: FractionallySizedBox(
widthFactor: 0.4,
child: OutlinedButton(
border: OutlineInputBorder(borderRadius: BorderRadius.circular(20.0)),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.green),
textStyle: MaterialStateProperty.all(const TextStyle(color: Colors.white)),
),
onPressed: () {
Navigator.pushNamed(context, '/register');
},
child: const Text('Register'),
),
),
),
],
),
);
}
}```
Upvotes: 0
Views: 363
Reputation: 2678
If you look-up the description of OutlinedButton, you will not find any parameter called border
. Instead you need to use `style: ButtonStyle()´. For example:
shape: RoundedRectangleBorder(
side: const BorderSide(color: Colors.grey, width: 1),
borderRadius: BorderRadius.circular(5),
),
Upvotes: 1