Migration guide for material localized strings
Summary
#ReorderableListView
's localized strings were moved from
material localizations to widgets localizations.
These strings were deprecated in material localizations.
Context
#ReorderableListView
uses these strings to annotate its semantics actions.
To apply the same annotations to ReorderableList
and SliverReorderableList
, they need to
access these strings from widgets library.
Description of change
#The MaterialLocalizations
strings for
reorderItemToStart
, reorderItemToEnd
, reorderItemUp
,
reorderItemDown
, reorderItemLeft
, and reorderItemRight
are deprecated and
replaced by the same strings in WidgetsLocalizations
.
Migration guide
#If you use these strings in your code,
you can access them from WidgetsLocalizations
instead.
Code before migration:
MaterialLocalizations.of(context).reorderItemToStart;
Code after migration:
WidgetsLocalizations.of(context).reorderItemToStart;
If you override MaterialLocalizations
or WidgetsLocalizations
,
make sure to remove the translations from the MaterialLocalizations
subclass and move them to the WidgetsLocalizations
subclass.
Code before migration:
class MaterialLocalizationsMyLanguage extends MaterialLocalizationsEn {
// ...
@override
String get reorderItemRight => 'my translation';
}
Code after migration:
class MaterialLocalizationsMyLanguage extends MaterialLocalizationsEn {
// ...
}
class WidgetsLocalizationsMyLanguage extends WidgetsLocalizationsEn {
// ...
@override
String get reorderItemRight => 'my translation';
}
Timeline
#Landed in version: v3.10.0-2.0.pre
In stable release: 3.13.0
References
#Relevant PR:
- PR 124711: Deprecates string for ReorderableList in material_localizations.
除非另有说明,本文档之所提及适用于 Flutter 的最新稳定版本,本页面最后更新时间: 2024-04-04。 查看文档源码 或者 为本页面内容提出建议。