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
26f976f5
Unverified
Commit
26f976f5
authored
Aug 03, 2020
by
Hans Muller
Committed by
GitHub
Aug 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use OverflowBar instead of ButtonBar in DateRangePicker (#62695)
parent
ddeb5bb9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
14 deletions
+73
-14
date_range_picker_dialog.dart
...er/lib/src/material/pickers/date_range_picker_dialog.dart
+17
-14
date_range_picker_test.dart
packages/flutter/test/material/date_range_picker_test.dart
+56
-0
No files found.
packages/flutter/lib/src/material/pickers/date_range_picker_dialog.dart
View file @
26f976f5
...
...
@@ -12,7 +12,6 @@ import 'package:flutter/widgets.dart';
import
'../app_bar.dart'
;
import
'../back_button.dart'
;
import
'../button_bar.dart'
;
import
'../button_theme.dart'
;
import
'../color_scheme.dart'
;
import
'../debug.dart'
;
...
...
@@ -655,9 +654,12 @@ class _InputDateRangePickerDialog extends StatelessWidget {
onIconPressed:
onToggleEntryMode
,
);
final
Widget
actions
=
ButtonBar
(
buttonTextTheme:
ButtonTextTheme
.
primary
,
layoutBehavior:
ButtonBarLayoutBehavior
.
constrained
,
final
Widget
actions
=
Container
(
alignment:
AlignmentDirectional
.
centerEnd
,
constraints:
const
BoxConstraints
(
minHeight:
52.0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8
),
child:
OverflowBar
(
spacing:
8
,
children:
<
Widget
>[
TextButton
(
child:
Text
(
cancelText
??
localizations
.
cancelButtonLabel
),
...
...
@@ -668,6 +670,7 @@ class _InputDateRangePickerDialog extends StatelessWidget {
onPressed:
onConfirm
,
),
],
),
);
switch
(
orientation
)
{
...
...
packages/flutter/test/material/date_range_picker_test.dart
View file @
26f976f5
...
...
@@ -207,6 +207,62 @@ void main() {
});
});
testWidgets
(
'OK Cancel button layout'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
TextDirection
textDirection
)
{
return
MaterialApp
(
home:
Material
(
child:
Center
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
return
ElevatedButton
(
child:
const
Text
(
'X'
),
onPressed:
()
{
showDateRangePicker
(
context:
context
,
firstDate:
DateTime
(
2001
,
DateTime
.
january
,
1
),
lastDate:
DateTime
(
2031
,
DateTime
.
december
,
31
),
builder:
(
BuildContext
context
,
Widget
child
)
{
return
Directionality
(
textDirection:
textDirection
,
child:
child
,
);
},
);
},
);
},
),
),
),
);
}
Future
<
void
>
showOkCancelDialog
(
TextDirection
textDirection
)
async
{
await
tester
.
pumpWidget
(
buildFrame
(
textDirection
));
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
pumpAndSettle
();
await
tester
.
tap
(
find
.
byIcon
(
Icons
.
edit
));
await
tester
.
pumpAndSettle
();
}
Future
<
void
>
dismissOkCancelDialog
()
async
{
await
tester
.
tap
(
find
.
text
(
'CANCEL'
));
await
tester
.
pumpAndSettle
();
}
await
showOkCancelDialog
(
TextDirection
.
ltr
);
expect
(
tester
.
getBottomRight
(
find
.
text
(
'OK'
)).
dx
,
622
);
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'OK'
)).
dx
,
594
);
expect
(
tester
.
getBottomRight
(
find
.
text
(
'CANCEL'
)).
dx
,
560
);
await
dismissOkCancelDialog
();
await
showOkCancelDialog
(
TextDirection
.
rtl
);
expect
(
tester
.
getBottomRight
(
find
.
text
(
'OK'
)).
dx
,
206
);
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'OK'
)).
dx
,
178
);
expect
(
tester
.
getBottomRight
(
find
.
text
(
'CANCEL'
)).
dx
,
324
);
await
dismissOkCancelDialog
();
});
group
(
'Haptic feedback'
,
()
{
const
Duration
hapticFeedbackInterval
=
Duration
(
milliseconds:
10
);
FeedbackTester
feedback
;
...
...
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