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
a555ee47
Commit
a555ee47
authored
Jul 26, 2016
by
Hans Muller
Committed by
GitHub
Jul 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TimePicker layout tweaks (#5047)
parent
3b577c53
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
dialog_demo.dart
examples/flutter_gallery/lib/demo/dialog_demo.dart
+13
-3
time_picker.dart
packages/flutter/lib/src/material/time_picker.dart
+4
-5
time_picker_dialog.dart
packages/flutter/lib/src/material/time_picker_dialog.dart
+10
-1
No files found.
examples/flutter_gallery/lib/demo/dialog_demo.dart
View file @
a555ee47
...
@@ -64,6 +64,15 @@ class DialogDemo extends StatefulWidget {
...
@@ -64,6 +64,15 @@ class DialogDemo extends StatefulWidget {
class
DialogDemoState
extends
State
<
DialogDemo
>
{
class
DialogDemoState
extends
State
<
DialogDemo
>
{
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
TimeOfDay
_selectedTime
;
@override
void
initState
()
{
super
.
initState
();
final
DateTime
now
=
new
DateTime
.
now
();
_selectedTime
=
new
TimeOfDay
(
hour:
now
.
hour
,
minute:
now
.
minute
);
}
void
showDemoDialog
/*<T>*/
({
BuildContext
context
,
Dialog
dialog
})
{
void
showDemoDialog
/*<T>*/
({
BuildContext
context
,
Dialog
dialog
})
{
showDialog
/*<T>*/
(
showDialog
/*<T>*/
(
context:
context
,
context:
context
,
...
@@ -177,10 +186,11 @@ class DialogDemoState extends State<DialogDemo> {
...
@@ -177,10 +186,11 @@ class DialogDemoState extends State<DialogDemo> {
onPressed:
()
{
onPressed:
()
{
showTimePicker
(
showTimePicker
(
context:
context
,
context:
context
,
initialTime:
const
TimeOfDay
(
hour:
15
,
minute:
30
)
initialTime:
_selectedTime
)
)
.
then
((
TimeOfDay
value
)
{
// The value passed to Navigator.pop() or null.
.
then
((
TimeOfDay
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
_selectedTime
)
{
_selectedTime
=
value
;
_scaffoldKey
.
currentState
.
showSnackBar
(
new
SnackBar
(
_scaffoldKey
.
currentState
.
showSnackBar
(
new
SnackBar
(
content:
new
Text
(
'You selected:
$value
'
)
content:
new
Text
(
'You selected:
$value
'
)
));
));
...
...
packages/flutter/lib/src/material/time_picker.dart
View file @
a555ee47
...
@@ -99,8 +99,8 @@ class TimeOfDay {
...
@@ -99,8 +99,8 @@ class TimeOfDay {
}
}
enum
_TimePickerMode
{
hour
,
minute
}
enum
_TimePickerMode
{
hour
,
minute
}
const
double
_kHeaderFontSize
=
6
5
.0
;
const
double
_kHeaderFontSize
=
6
0
.0
;
const
double
_kPreferredDialExtent
=
300
.0
;
const
double
_kPreferredDialExtent
=
296
.0
;
/// A material design time picker.
/// A material design time picker.
///
///
...
@@ -250,8 +250,7 @@ class _TimePickerHeader extends StatelessWidget {
...
@@ -250,8 +250,7 @@ class _TimePickerHeader extends StatelessWidget {
);
);
return
new
Container
(
return
new
Container
(
height:
100.0
,
height:
96.0
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
24.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
backgroundColor
),
decoration:
new
BoxDecoration
(
backgroundColor:
backgroundColor
),
child:
new
Row
(
child:
new
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
...
@@ -274,7 +273,7 @@ class _TimePickerHeader extends StatelessWidget {
...
@@ -274,7 +273,7 @@ class _TimePickerHeader extends StatelessWidget {
onTap:
()
=>
_handleChangeMode
(
_TimePickerMode
.
minute
),
onTap:
()
=>
_handleChangeMode
(
_TimePickerMode
.
minute
),
child:
new
Text
(
selectedTime
.
minuteLabel
,
style:
minuteStyle
)
child:
new
Text
(
selectedTime
.
minuteLabel
,
style:
minuteStyle
)
),
),
new
Container
(
width:
16
.0
,
height:
0.0
),
// Horizontal spacer
new
Container
(
width:
8
.0
,
height:
0.0
),
// Horizontal spacer
new
GestureDetector
(
new
GestureDetector
(
onTap:
_handleChangeDayPeriod
,
onTap:
_handleChangeDayPeriod
,
behavior:
HitTestBehavior
.
opaque
,
behavior:
HitTestBehavior
.
opaque
,
...
...
packages/flutter/lib/src/material/time_picker_dialog.dart
View file @
a555ee47
...
@@ -71,7 +71,16 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
...
@@ -71,7 +71,16 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
///
///
/// The returned Future resolves to the time selected by the user when the user
/// The returned Future resolves to the time selected by the user when the user
/// closes the dialog. If the user cancels the dialog, the Future resolves to
/// closes the dialog. If the user cancels the dialog, the Future resolves to
/// the initialTime.
/// the [initialTime].
///
/// To show a dialog with [initialTime] equal to the current time:
/// ```dart
/// final DateTime now = new DateTime.now();
/// showTimePicker(
/// initialTime: new TimeOfDay(hour: now.hour, minute: now.minute),
/// context: context
/// );
/// ```
///
///
/// See also:
/// See also:
///
///
...
...
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