Skip to main content

移除 InputDecoration.collapsed 的無效參數

'InputDecoration.collapsed' 建構函式中的 'floatingLabelBehavior' 和 'floatingLabelAlignment' 參數已被棄用且無替代方案, 因為這些參數沒有任何作用。

摘要

#

InputDecoration.collapsed 的無效參數 floatingLabelBehaviorfloatingLabelAlignment 已被棄用。

背景

#

InputDecoration.collapsed 建構函式用於 建立一個沒有標籤的極簡裝飾。

參數 floatingLabelAlignmentfloatingLabelBehavior 沒有任何作用,因為使用 InputDecoration.collapsed 建立的輸入裝飾(InputDecoration)不會有標籤。

遷移指南

#

若要進行遷移,請在呼叫 InputDecoration.collapsed 建構函式時移除 floatingLabelBehaviorfloatingLabelAlignment 這兩個參數的使用。這些參數本來就沒有任何作用。

遷移前的程式碼:

dart
InputDecoration.collapsed(
  hintText: 'Hint',
  floatingLabelAlignment: FloatingLabelAlignment.center,
  floatingLabelBehavior: FloatingLabelBehavior.auto,
),

遷移後的程式碼:

dart
InputDecoration.collapsed(
  hintText: 'Hint',
),

時程

#

合併於版本:3.24.0-0.1.pre
正式版發佈於:3.27.0

參考資料

#

API 文件:

相關議題:

相關 PR: