[英]Flutter the named parameter 'border' isn't defined
我正在嘗試為按鈕創建邊框,但出現此錯誤:“命名參數‘邊框’未定義”我知道小部件已更新,但我無法找到未識別參數的原因.
代碼在這里:
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'),
),
),
),
],
),
);
}
}```
如果您查找 OutlinedButton 的描述,您將找不到任何名為border
的參數。 相反,您需要使用“style: ButtonStyle()”。 例如:
shape: RoundedRectangleBorder(
side: const BorderSide(color: Colors.grey, width: 1),
borderRadius: BorderRadius.circular(5),
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.