Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
0cdd131c
Unverified
Commit
0cdd131c
authored
Jan 20, 2022
by
Darren Austin
Committed by
GitHub
Jan 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the date from the Next/Previous month buttons on the Date Picker. (#96876)
parent
5d0403db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
calendar_date_picker.dart
packages/flutter/lib/src/material/calendar_date_picker.dart
+6
-18
calendar_date_picker_test.dart
...ages/flutter/test/material/calendar_date_picker_test.dart
+2
-2
No files found.
packages/flutter/lib/src/material/calendar_date_picker.dart
View file @
0cdd131c
...
...
@@ -490,8 +490,6 @@ class _MonthPicker extends StatefulWidget {
class
_MonthPickerState
extends
State
<
_MonthPicker
>
{
final
GlobalKey
_pageViewKey
=
GlobalKey
();
late
DateTime
_currentMonth
;
late
DateTime
_nextMonthDate
;
late
DateTime
_previousMonthDate
;
late
PageController
_pageController
;
late
MaterialLocalizations
_localizations
;
late
TextDirection
_textDirection
;
...
...
@@ -504,8 +502,6 @@ class _MonthPickerState extends State<_MonthPicker> {
void
initState
()
{
super
.
initState
();
_currentMonth
=
widget
.
initialMonth
;
_previousMonthDate
=
DateUtils
.
addMonthsToMonthDate
(
_currentMonth
,
-
1
);
_nextMonthDate
=
DateUtils
.
addMonthsToMonthDate
(
_currentMonth
,
1
);
_pageController
=
PageController
(
initialPage:
DateUtils
.
monthDelta
(
widget
.
firstDate
,
_currentMonth
));
_shortcutMap
=
const
<
ShortcutActivator
,
Intent
>{
SingleActivator
(
LogicalKeyboardKey
.
arrowLeft
):
DirectionalFocusIntent
(
TraversalDirection
.
left
),
...
...
@@ -556,8 +552,6 @@ class _MonthPickerState extends State<_MonthPicker> {
final
DateTime
monthDate
=
DateUtils
.
addMonthsToMonthDate
(
widget
.
firstDate
,
monthPage
);
if
(!
DateUtils
.
isSameMonth
(
_currentMonth
,
monthDate
))
{
_currentMonth
=
DateTime
(
monthDate
.
year
,
monthDate
.
month
);
_previousMonthDate
=
DateUtils
.
addMonthsToMonthDate
(
_currentMonth
,
-
1
);
_nextMonthDate
=
DateUtils
.
addMonthsToMonthDate
(
_currentMonth
,
1
);
widget
.
onDisplayedMonthChanged
(
_currentMonth
);
if
(
_focusedDay
!=
null
&&
!
DateUtils
.
isSameMonth
(
_focusedDay
,
_currentMonth
))
{
// We have navigated to a new month with the grid focused, but the
...
...
@@ -565,6 +559,10 @@ class _MonthPickerState extends State<_MonthPicker> {
// the same day of the month.
_focusedDay
=
_focusableDayForMonth
(
_currentMonth
,
_focusedDay
!.
day
);
}
SemanticsService
.
announce
(
_localizations
.
formatMonthYear
(
_currentMonth
),
_textDirection
,
);
}
});
}
...
...
@@ -596,10 +594,6 @@ class _MonthPickerState extends State<_MonthPicker> {
/// Navigate to the next month.
void
_handleNextMonth
()
{
if
(!
_isDisplayingLastMonth
)
{
SemanticsService
.
announce
(
_localizations
.
formatMonthYear
(
_nextMonthDate
),
_textDirection
,
);
_pageController
.
nextPage
(
duration:
_monthScrollDuration
,
curve:
Curves
.
ease
,
...
...
@@ -610,10 +604,6 @@ class _MonthPickerState extends State<_MonthPicker> {
/// Navigate to the previous month.
void
_handlePreviousMonth
()
{
if
(!
_isDisplayingFirstMonth
)
{
SemanticsService
.
announce
(
_localizations
.
formatMonthYear
(
_previousMonthDate
),
_textDirection
,
);
_pageController
.
previousPage
(
duration:
_monthScrollDuration
,
curve:
Curves
.
ease
,
...
...
@@ -748,8 +738,6 @@ class _MonthPickerState extends State<_MonthPicker> {
@override
Widget
build
(
BuildContext
context
)
{
final
String
previousTooltipText
=
'
${_localizations.previousMonthTooltip}
${_localizations.formatMonthYear(_previousMonthDate)}
'
;
final
String
nextTooltipText
=
'
${_localizations.nextMonthTooltip}
${_localizations.formatMonthYear(_nextMonthDate)}
'
;
final
Color
controlColor
=
Theme
.
of
(
context
).
colorScheme
.
onSurface
.
withOpacity
(
0.60
);
return
Semantics
(
...
...
@@ -764,13 +752,13 @@ class _MonthPickerState extends State<_MonthPicker> {
IconButton
(
icon:
const
Icon
(
Icons
.
chevron_left
),
color:
controlColor
,
tooltip:
_isDisplayingFirstMonth
?
null
:
previousTooltipText
,
tooltip:
_isDisplayingFirstMonth
?
null
:
_localizations
.
previousMonthTooltip
,
onPressed:
_isDisplayingFirstMonth
?
null
:
_handlePreviousMonth
,
),
IconButton
(
icon:
const
Icon
(
Icons
.
chevron_right
),
color:
controlColor
,
tooltip:
_isDisplayingLastMonth
?
null
:
nextTooltipText
,
tooltip:
_isDisplayingLastMonth
?
null
:
_localizations
.
nextMonthTooltip
,
onPressed:
_isDisplayingLastMonth
?
null
:
_handleNextMonth
,
),
],
...
...
packages/flutter/test/material/calendar_date_picker_test.dart
View file @
0cdd131c
...
...
@@ -649,7 +649,7 @@ void main() {
// Prev/Next month buttons.
expect
(
tester
.
getSemantics
(
previousMonthIcon
),
matchesSemantics
(
label:
'Previous month
December 2015
'
,
label:
'Previous month'
,
isButton:
true
,
hasTapAction:
true
,
isEnabled:
true
,
...
...
@@ -657,7 +657,7 @@ void main() {
isFocusable:
true
,
));
expect
(
tester
.
getSemantics
(
nextMonthIcon
),
matchesSemantics
(
label:
'Next month
February 2016
'
,
label:
'Next month'
,
isButton:
true
,
hasTapAction:
true
,
isEnabled:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment