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
81912591
Commit
81912591
authored
Oct 27, 2015
by
krisgiesing
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into tap-fix
parents
25ed1577
e90dcf8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
1 deletion
+119
-1
material.dart
packages/flutter/lib/material.dart
+1
-0
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+117
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+1
-1
No files found.
packages/flutter/lib/material.dart
View file @
81912591
...
...
@@ -7,6 +7,7 @@
/// See https://www.google.com/design/spec/material-design/introduction.html
library
material
;
export
'src/material/bottom_sheet.dart'
;
export
'src/material/card.dart'
;
export
'src/material/checkbox.dart'
;
export
'src/material/circle_avatar.dart'
;
...
...
packages/flutter/lib/src/material/bottom_sheet.dart
0 → 100644
View file @
81912591
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'colors.dart'
;
import
'material.dart'
;
const
Duration
_kBottomSheetDuration
=
const
Duration
(
milliseconds:
200
);
class
_BottomSheet
extends
StatefulComponent
{
_BottomSheet
({
Key
key
,
this
.
child
,
this
.
performance
})
:
super
(
key:
key
);
final
Widget
child
;
final
PerformanceView
performance
;
_BottomSheetState
createState
()
=>
new
_BottomSheetState
();
}
class
_BottomSheetLayout
extends
OneChildLayoutDelegate
{
// The distance from the bottom of the parent to the top of the BottomSheet child.
AnimatedValue
<
double
>
childTop
=
new
AnimatedValue
<
double
>(
0.0
);
BoxConstraints
getConstraintsForChild
(
BoxConstraints
constraints
)
{
return
new
BoxConstraints
(
minWidth:
constraints
.
maxWidth
,
maxWidth:
constraints
.
maxWidth
,
minHeight:
0.0
,
maxHeight:
constraints
.
maxHeight
*
9.0
/
16.0
);
}
Point
getPositionForChild
(
Size
size
,
Size
childSize
)
{
childTop
.
end
=
childSize
.
height
;
return
new
Point
(
0.0
,
size
.
height
-
childTop
.
value
);
}
}
class
_BottomSheetState
extends
State
<
_BottomSheet
>
{
final
_BottomSheetLayout
_layout
=
new
_BottomSheetLayout
();
Widget
build
(
BuildContext
context
)
{
return
new
BuilderTransition
(
performance:
config
.
performance
,
variables:
<
AnimatedValue
<
double
>>[
_layout
.
childTop
],
builder:
(
BuildContext
context
)
{
return
new
ClipRect
(
child:
new
CustomOneChildLayout
(
delegate:
_layout
,
token:
_layout
.
childTop
.
value
,
child:
new
Material
(
child:
config
.
child
)
)
);
}
);
}
}
class
_ModalBottomSheetRoute
extends
PerformanceRoute
{
_ModalBottomSheetRoute
({
this
.
completer
,
this
.
child
});
final
Completer
completer
;
final
Widget
child
;
bool
get
ephemeral
=>
true
;
bool
get
modal
=>
true
;
bool
get
opaque
=>
false
;
Duration
get
transitionDuration
=>
_kBottomSheetDuration
;
Widget
build
(
RouteArguments
args
)
{
return
new
Focus
(
key:
new
GlobalObjectKey
(
this
),
autofocus:
true
,
child:
new
GestureDetector
(
onTap:
()
{
navigator
.
pop
();
},
child:
new
Stack
(<
Widget
>[
// mask
new
ColorTransition
(
performance:
performance
,
color:
new
AnimatedColorValue
(
Colors
.
transparent
,
end:
Colors
.
black54
),
child:
new
Container
()
),
// sheet
new
_BottomSheet
(
performance:
performance
,
child:
child
)
])
)
);
}
void
didPop
([
dynamic
result
])
{
completer
.
complete
(
result
);
super
.
didPop
(
result
);
}
}
Future
showModalBottomSheet
(
{
BuildContext
context
,
Widget
child
})
{
final
Completer
completer
=
new
Completer
();
Navigator
.
of
(
context
).
push
(
new
_ModalBottomSheetRoute
(
completer:
completer
,
child:
child
));
return
completer
.
future
;
}
packages/flutter/lib/src/widgets/basic.dart
View file @
81912591
...
...
@@ -347,7 +347,7 @@ class FractionallySizedBox extends OneChildRenderObjectWidget {
heightFactor:
height
);
void
updateRenderObject
(
RenderFractionallySizedBox
renderObject
,
SizedBox
oldWidget
)
{
void
updateRenderObject
(
RenderFractionallySizedBox
renderObject
,
Fractionally
SizedBox
oldWidget
)
{
renderObject
.
widthFactor
=
width
;
renderObject
.
heightFactor
=
height
;
}
...
...
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