mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

This PR fixes l10n issue when months names are being used in incorrect form in CupertinoDatePicker in CupertinoDatePickerMode.yearMonth (#130930). The idea of this proposal is to add an optional parameter `standalone` for `CupertinoLocalizations.datePickerMonth` to be able to choose when to use months names in base form (intl DateSymbols.STANDALONEMONTHS) and when in day-dependent form (intl DateSymbols.MONTHS) <details> <summary>Before</summary> <img width="366" alt="image" src="https://github.com/flutter/flutter/assets/32621121/1dd54fa7-6dd9-4053-889b-57134c145432"> <img width="387" alt="image" src="https://github.com/flutter/flutter/assets/32621121/c176070e-73e4-49d3-883b-ba31eca6d1d7"> </details> <details> <summary>After</summary> <img width="369" alt="image" src="https://github.com/flutter/flutter/assets/32621121/255594f1-219d-4bd4-9b75-1012912f8ab0"> <img width="378" alt="image" src="https://github.com/flutter/flutter/assets/32621121/16bbb41f-3f62-4446-bf41-e27140b649a9"> </details>
48 lines
1.6 KiB
Dart
48 lines
1.6 KiB
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
testWidgets('Test correct month form for CupertinoDatePicker in monthYear mode', (WidgetTester tester) async {
|
|
await tester.pumpWidget(
|
|
CupertinoApp(
|
|
home: CupertinoPageScaffold(
|
|
child: Center(
|
|
child: CupertinoDatePicker(
|
|
initialDateTime: DateTime(2023, 5),
|
|
onDateTimeChanged: (_) {},
|
|
mode: CupertinoDatePickerMode.monthYear,
|
|
)),
|
|
),
|
|
supportedLocales: const <Locale>[Locale('ru', 'RU')],
|
|
localizationsDelegates: GlobalCupertinoLocalizations.delegates,
|
|
),
|
|
);
|
|
|
|
expect(find.text('Май'), findsWidgets);
|
|
});
|
|
|
|
testWidgets('Test correct month form for CupertinoDatePicker in date mode', (WidgetTester tester) async {
|
|
await tester.pumpWidget(
|
|
CupertinoApp(
|
|
home: CupertinoPageScaffold(
|
|
child: Center(
|
|
child: CupertinoDatePicker(
|
|
initialDateTime: DateTime(2023, 5),
|
|
onDateTimeChanged: (_) {},
|
|
mode: CupertinoDatePickerMode.date,
|
|
)),
|
|
),
|
|
supportedLocales: const <Locale>[Locale('ru', 'RU')],
|
|
localizationsDelegates: GlobalCupertinoLocalizations.delegates,
|
|
),
|
|
);
|
|
|
|
expect(find.text('мая'), findsWidgets);
|
|
});
|
|
}
|