From 98a9195dce154ca80347dadcfa9c31ce2b67316e Mon Sep 17 00:00:00 2001 From: Darren Austin Date: Mon, 5 Apr 2021 17:33:34 -0700 Subject: [PATCH] Revert "Fix error when choose noon on time picker (#78478)" (#79828) This reverts commit 6dd77cc4 as it is breaking the build. --- packages/flutter/lib/src/material/time.dart | 2 +- packages/flutter/test/material/time_test.dart | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/packages/flutter/lib/src/material/time.dart b/packages/flutter/lib/src/material/time.dart index c776f79569..cf71d7b1da 100644 --- a/packages/flutter/lib/src/material/time.dart +++ b/packages/flutter/lib/src/material/time.dart @@ -91,7 +91,7 @@ class TimeOfDay { DayPeriod get period => hour < hoursPerPeriod ? DayPeriod.am : DayPeriod.pm; /// Which hour of the current period (e.g., am or pm) this time is. - int get hourOfPeriod => hour > hoursPerPeriod ? hour - periodOffset : hour; + int get hourOfPeriod => hour - periodOffset; /// The hour at which the current period starts. int get periodOffset => period == DayPeriod.am ? 0 : hoursPerPeriod; diff --git a/packages/flutter/test/material/time_test.dart b/packages/flutter/test/material/time_test.dart index 22f3584d76..7e5ada049d 100644 --- a/packages/flutter/test/material/time_test.dart +++ b/packages/flutter/test/material/time_test.dart @@ -25,24 +25,5 @@ void main() { expect(await pumpTest(false), '7:00 AM'); expect(await pumpTest(true), '07:00'); }); - - testWidgets('return 12 hours at noon', (WidgetTester tester) async { - Future pumpTest(bool alwaysUse24HourFormat) async { - late String formattedValue; - await tester.pumpWidget(MaterialApp( - home: MediaQuery( - data: MediaQueryData(alwaysUse24HourFormat: alwaysUse24HourFormat), - child: Builder(builder: (BuildContext context) { - formattedValue = const TimeOfDay(hour: 12, minute: 0).format(context); - return Container(); - }), - ), - )); - return formattedValue; - } - - expect(await pumpTest(false), '12:00 PM'); - expect(await pumpTest(true), '12:00'); - }); }); }