mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Adjusts the Hindi TimeOfDayFormat to display in a LTR orientation in localizations. (#157998)
Fixes https://github.com/flutter/flutter/issues/156565 This update corrects the `TimeOfDayFormat` mapping for the Hindi language. Previously, the format was incorrectly set to `a_space_h_colon_mm` - (a h:mm), but it should be `h_colon_mm_space_a` - (h:mm a) since Hindi is a LTR language.
This commit is contained in:
parent
5f0f18d739
commit
dec763979c
@ -18612,7 +18612,7 @@ class MaterialLocalizationHi extends GlobalMaterialLocalizations {
|
|||||||
String get tabLabelRaw => r'$tabCount का टैब $tabIndex';
|
String get tabLabelRaw => r'$tabCount का टैब $tabIndex';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TimeOfDayFormat get timeOfDayFormatRaw => TimeOfDayFormat.a_space_h_colon_mm;
|
TimeOfDayFormat get timeOfDayFormatRaw => TimeOfDayFormat.h_colon_mm_space_a;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get timePickerDialHelpText => 'समय चुनें';
|
String get timePickerDialHelpText => 'समय चुनें';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scriptCategory": "dense",
|
"scriptCategory": "dense",
|
||||||
"timeOfDayFormat": "ah:mm",
|
"timeOfDayFormat": "h:mm a",
|
||||||
"openAppDrawerTooltip": "नेविगेशन मेन्यू खोलें",
|
"openAppDrawerTooltip": "नेविगेशन मेन्यू खोलें",
|
||||||
"backButtonTooltip": "वापस जाएं",
|
"backButtonTooltip": "वापस जाएं",
|
||||||
"closeButtonTooltip": "बंद करें",
|
"closeButtonTooltip": "बंद करें",
|
||||||
|
@ -603,6 +603,38 @@ void main() {
|
|||||||
labels00To22TwoDigit,
|
labels00To22TwoDigit,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Regression test for https://github.com/flutter/flutter/issues/156565
|
||||||
|
testWidgets('AM/PM buttons should be aligned to LTR in Hindi language - Portrait', (WidgetTester tester) async {
|
||||||
|
const Locale locale = Locale('hi', 'HI');
|
||||||
|
|
||||||
|
final Offset centerPortrait = await startPicker(tester, (TimeOfDay? time) {}, locale: locale, useMaterial3: false, orientation: Orientation.portrait);
|
||||||
|
|
||||||
|
final Finder amButtonPortrait = find.text('AM');
|
||||||
|
final Finder pmButtonPortrait = find.text('PM') ;
|
||||||
|
|
||||||
|
final Offset amButtonPositionPortrait = tester.getCenter(amButtonPortrait);
|
||||||
|
final Offset pmButtonPositionPortrait = tester.getCenter(pmButtonPortrait);
|
||||||
|
|
||||||
|
expect(amButtonPositionPortrait.dx, greaterThan(centerPortrait.dx));
|
||||||
|
expect(pmButtonPositionPortrait.dx, greaterThan(centerPortrait.dx));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Regression test for https://github.com/flutter/flutter/issues/156565
|
||||||
|
testWidgets('AM/PM buttons should be aligned to LTR in Hindi language - Landscape', (WidgetTester tester) async {
|
||||||
|
const Locale locale = Locale('hi', 'HI');
|
||||||
|
|
||||||
|
final Offset centerLandscape = await startPicker(tester, (TimeOfDay? time) {}, locale: locale, useMaterial3: false, orientation: Orientation.landscape);
|
||||||
|
|
||||||
|
final Finder amButtonLandscape = find.text('AM');
|
||||||
|
final Finder pmButtonLandscape = find.text('PM');
|
||||||
|
|
||||||
|
final Offset amButtonPositionLandscape = tester.getCenter(amButtonLandscape);
|
||||||
|
final Offset pmButtonPositionLandscape = tester.getCenter(pmButtonLandscape);
|
||||||
|
|
||||||
|
expect(amButtonPositionLandscape.dy, greaterThan(centerLandscape.dy));
|
||||||
|
expect(pmButtonPositionLandscape.dy, greaterThan(centerLandscape.dy));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TimePickerLauncher extends StatelessWidget {
|
class _TimePickerLauncher extends StatelessWidget {
|
||||||
@ -611,12 +643,14 @@ class _TimePickerLauncher extends StatelessWidget {
|
|||||||
required this.locale,
|
required this.locale,
|
||||||
this.entryMode = TimePickerEntryMode.dial,
|
this.entryMode = TimePickerEntryMode.dial,
|
||||||
this.useMaterial3,
|
this.useMaterial3,
|
||||||
|
this.orientation,
|
||||||
});
|
});
|
||||||
|
|
||||||
final ValueChanged<TimeOfDay?>? onChanged;
|
final ValueChanged<TimeOfDay?>? onChanged;
|
||||||
final Locale locale;
|
final Locale locale;
|
||||||
final TimePickerEntryMode entryMode;
|
final TimePickerEntryMode entryMode;
|
||||||
final bool? useMaterial3;
|
final bool? useMaterial3;
|
||||||
|
final Orientation? orientation;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -635,6 +669,7 @@ class _TimePickerLauncher extends StatelessWidget {
|
|||||||
onChanged?.call(await showTimePicker(
|
onChanged?.call(await showTimePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialEntryMode: entryMode,
|
initialEntryMode: entryMode,
|
||||||
|
orientation: orientation,
|
||||||
initialTime: const TimeOfDay(hour: 7, minute: 0),
|
initialTime: const TimeOfDay(hour: 7, minute: 0),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
@ -652,12 +687,14 @@ Future<Offset> startPicker(
|
|||||||
ValueChanged<TimeOfDay?> onChanged, {
|
ValueChanged<TimeOfDay?> onChanged, {
|
||||||
Locale locale = const Locale('en', 'US'),
|
Locale locale = const Locale('en', 'US'),
|
||||||
bool? useMaterial3,
|
bool? useMaterial3,
|
||||||
|
Orientation? orientation,
|
||||||
}) async {
|
}) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
_TimePickerLauncher(
|
_TimePickerLauncher(
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
useMaterial3: useMaterial3,
|
useMaterial3: useMaterial3,
|
||||||
|
orientation: orientation,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.tap(find.text('X'));
|
await tester.tap(find.text('X'));
|
||||||
|
Loading…
Reference in New Issue
Block a user