forked from firka/flutter
re-re-enable lint unnecessary_const (#20103)
This commit is contained in:
committed by
GitHub
parent
ffbaa97b50
commit
eda03e2586
File diff suppressed because it is too large
Load Diff
@@ -454,7 +454,7 @@ class GlobalMaterialLocalizations implements MaterialLocalizations {
|
||||
/// Most internationalized apps will use [GlobalMaterialLocalizations.delegates]
|
||||
/// as the value of [MaterialApp.localizationsDelegates] to include
|
||||
/// the localizations for both the material and widget libraries.
|
||||
static const LocalizationsDelegate<MaterialLocalizations> delegate = const _MaterialLocalizationsDelegate();
|
||||
static const LocalizationsDelegate<MaterialLocalizations> delegate = _MaterialLocalizationsDelegate();
|
||||
|
||||
/// A value for [MaterialApp.localizationsDelegates] that's typically used by
|
||||
/// internationalized apps.
|
||||
@@ -475,13 +475,13 @@ class GlobalMaterialLocalizations implements MaterialLocalizations {
|
||||
/// // ...
|
||||
/// )
|
||||
/// ```
|
||||
static const List<LocalizationsDelegate<dynamic>> delegates = const <LocalizationsDelegate<dynamic>>[
|
||||
static const List<LocalizationsDelegate<dynamic>> delegates = <LocalizationsDelegate<dynamic>>[
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
];
|
||||
}
|
||||
|
||||
const Map<String, TimeOfDayFormat> _icuTimeOfDayToEnum = const <String, TimeOfDayFormat>{
|
||||
const Map<String, TimeOfDayFormat> _icuTimeOfDayToEnum = <String, TimeOfDayFormat>{
|
||||
'HH:mm': TimeOfDayFormat.HH_colon_mm,
|
||||
'HH.mm': TimeOfDayFormat.HH_dot_mm,
|
||||
"HH 'h' mm": TimeOfDayFormat.frenchCanadian,
|
||||
@@ -536,7 +536,7 @@ class _MaterialLocalizationsDelegate extends LocalizationsDelegate<MaterialLocal
|
||||
|
||||
// Watch out: this list must match the one in the GlobalMaterialLocalizations
|
||||
// class doc and the list we test, see test/translations_test.dart.
|
||||
static const List<String> _supportedLanguages = const <String>[
|
||||
static const List<String> _supportedLanguages = <String>[
|
||||
'ar', // Arabic
|
||||
'bg', // Bulgarian
|
||||
'bs', // Bosnian
|
||||
|
||||
@@ -31,7 +31,7 @@ class GlobalWidgetsLocalizations implements WidgetsLocalizations {
|
||||
}
|
||||
|
||||
// See http://en.wikipedia.org/wiki/Right-to-left
|
||||
static const List<String> _rtlLanguages = const <String>[
|
||||
static const List<String> _rtlLanguages = <String>[
|
||||
'ar', // Arabic
|
||||
'fa', // Farsi
|
||||
'he', // Hebrew
|
||||
@@ -60,7 +60,7 @@ class GlobalWidgetsLocalizations implements WidgetsLocalizations {
|
||||
/// to create an instance of this class.
|
||||
///
|
||||
/// [WidgetsApp] automatically adds this value to [WidgetApp.localizationsDelegates].
|
||||
static const LocalizationsDelegate<WidgetsLocalizations> delegate = const _WidgetsLocalizationsDelegate();
|
||||
static const LocalizationsDelegate<WidgetsLocalizations> delegate = _WidgetsLocalizationsDelegate();
|
||||
}
|
||||
|
||||
class _WidgetsLocalizationsDelegate extends LocalizationsDelegate<WidgetsLocalizations> {
|
||||
|
||||
@@ -11,11 +11,11 @@ void main() {
|
||||
await tester.pumpWidget(new MaterialApp( // Creates the outer Localizations widget.
|
||||
home: new ListView(
|
||||
children: <Widget>[
|
||||
const LocalizationTracker(key: const ValueKey<String>('outer')),
|
||||
const LocalizationTracker(key: ValueKey<String>('outer')),
|
||||
new Localizations(
|
||||
locale: const Locale('zh', 'CN'),
|
||||
delegates: GlobalMaterialLocalizations.delegates,
|
||||
child: const LocalizationTracker(key: const ValueKey<String>('inner')),
|
||||
child: const LocalizationTracker(key: ValueKey<String>('inner')),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -32,8 +32,8 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
new MaterialApp(
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('en', 'US'),
|
||||
const Locale('es', 'ES'),
|
||||
Locale('en', 'US'),
|
||||
Locale('es', 'ES'),
|
||||
],
|
||||
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
|
||||
new _DummyLocalizationsDelegate(),
|
||||
@@ -56,8 +56,8 @@ void main() {
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('es', 'ES'),
|
||||
const Locale('zh'),
|
||||
Locale('es', 'ES'),
|
||||
Locale('zh'),
|
||||
],
|
||||
home: new Container(),
|
||||
)
|
||||
|
||||
@@ -99,8 +99,8 @@ void main() {
|
||||
await tester.pumpWidget(new MaterialApp(
|
||||
locale: const Locale('en', 'US'),
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('en', 'US'),
|
||||
const Locale('fr', 'CA'),
|
||||
Locale('en', 'US'),
|
||||
Locale('fr', 'CA'),
|
||||
],
|
||||
localizationsDelegates: GlobalMaterialLocalizations.delegates,
|
||||
home: new Material(
|
||||
@@ -144,7 +144,7 @@ void main() {
|
||||
await tester.pumpWidget(new MaterialApp(
|
||||
locale: const Locale('en', 'US'),
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('en', 'US'),
|
||||
Locale('en', 'US'),
|
||||
],
|
||||
home: new Material(
|
||||
child: new Builder(
|
||||
@@ -182,8 +182,8 @@ void main() {
|
||||
await tester.pumpWidget(new MaterialApp(
|
||||
locale: const Locale('en', 'US'),
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('en', 'US'),
|
||||
const Locale('fr', 'CA'),
|
||||
Locale('en', 'US'),
|
||||
Locale('fr', 'CA'),
|
||||
],
|
||||
localizationsDelegates: GlobalMaterialLocalizations.delegates,
|
||||
home: new Material(
|
||||
|
||||
@@ -43,8 +43,8 @@ Widget buildFrame({
|
||||
WidgetBuilder buildContent,
|
||||
LocaleResolutionCallback localeResolutionCallback,
|
||||
Iterable<Locale> supportedLocales = const <Locale>[
|
||||
const Locale('en', 'US'),
|
||||
const Locale('es', 'es'),
|
||||
Locale('en', 'US'),
|
||||
Locale('es', 'es'),
|
||||
],
|
||||
}) {
|
||||
return new MaterialApp(
|
||||
@@ -164,9 +164,9 @@ void main() {
|
||||
const FooMaterialLocalizationsDelegate(supportedLanguage: 'de', backButtonTooltip: 'DE'),
|
||||
],
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('en', ''),
|
||||
const Locale('fr', ''),
|
||||
const Locale('de', ''),
|
||||
Locale('en', ''),
|
||||
Locale('fr', ''),
|
||||
Locale('de', ''),
|
||||
],
|
||||
buildContent: (BuildContext context) {
|
||||
// Should always be 'foo', no matter what the locale is
|
||||
|
||||
@@ -106,9 +106,9 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('uses two-ring 24-hour dial for H and HH hour formats', (WidgetTester tester) async {
|
||||
const List<Locale> locales = const <Locale>[
|
||||
const Locale('en', 'GB'), // HH
|
||||
const Locale('es', 'ES'), // H
|
||||
const List<Locale> locales = <Locale>[
|
||||
Locale('en', 'GB'), // HH
|
||||
Locale('es', 'ES'), // H
|
||||
];
|
||||
for (Locale locale in locales) {
|
||||
// Tap along the segment stretching from the center to the edge at
|
||||
@@ -126,9 +126,9 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
const List<String> labels12To11 = const <String>['12', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'];
|
||||
const List<String> labels12To11TwoDigit = const <String>['12', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11'];
|
||||
const List<String> labels00To23 = const <String>['00', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'];
|
||||
const List<String> labels12To11 = <String>['12', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'];
|
||||
const List<String> labels12To11TwoDigit = <String>['12', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11'];
|
||||
const List<String> labels00To23 = <String>['00', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'];
|
||||
|
||||
Future<Null> mediaQueryBoilerplate(WidgetTester tester, bool alwaysUse24HourFormat) async {
|
||||
await tester.pumpWidget(
|
||||
|
||||
@@ -142,8 +142,8 @@ Widget buildFrame({
|
||||
WidgetBuilder buildContent,
|
||||
LocaleResolutionCallback localeResolutionCallback,
|
||||
List<Locale> supportedLocales = const <Locale>[
|
||||
const Locale('en', 'US'),
|
||||
const Locale('en', 'GB'),
|
||||
Locale('en', 'US'),
|
||||
Locale('en', 'GB'),
|
||||
],
|
||||
}) {
|
||||
return new WidgetsApp(
|
||||
@@ -202,7 +202,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Localizations.localeFor in a WidgetsApp with an explicit locale', (WidgetTester tester) async {
|
||||
const Locale locale = const Locale('en', 'US');
|
||||
const Locale locale = Locale('en', 'US');
|
||||
BuildContext pageContext;
|
||||
|
||||
await tester.pumpWidget(
|
||||
@@ -483,8 +483,8 @@ void main() {
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('en', 'GB'),
|
||||
const Locale('ar', 'EG'),
|
||||
Locale('en', 'GB'),
|
||||
Locale('ar', 'EG'),
|
||||
],
|
||||
buildContent: (BuildContext context) {
|
||||
pageContext = context;
|
||||
@@ -527,9 +527,9 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
buildFrame(
|
||||
supportedLocales: const <Locale>[
|
||||
const Locale('zh', 'CN'),
|
||||
const Locale('en', 'GB'),
|
||||
const Locale('en', 'CA'),
|
||||
Locale('zh', 'CN'),
|
||||
Locale('en', 'GB'),
|
||||
Locale('en', 'CA'),
|
||||
],
|
||||
buildContent: (BuildContext context) {
|
||||
return new Text(Localizations.localeOf(context).toString());
|
||||
@@ -608,7 +608,7 @@ void main() {
|
||||
context: context,
|
||||
delegates: const <OnlyRTLDefaultWidgetsLocalizationsDelegate>[
|
||||
// Override: no matter what the locale, textDirection is always RTL.
|
||||
const OnlyRTLDefaultWidgetsLocalizationsDelegate(),
|
||||
OnlyRTLDefaultWidgetsLocalizationsDelegate(),
|
||||
],
|
||||
child: new Builder(
|
||||
builder: (BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user