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
269538df
Commit
269538df
authored
Mar 20, 2017
by
Adam Barth
Committed by
GitHub
Mar 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a constant for padding in a Material ListView (#8918)
Fixes #8235
parent
31fd7423
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
7 deletions
+11
-7
menu_demo.dart
examples/flutter_gallery/lib/demo/material/menu_demo.dart
+1
-1
overscroll_demo.dart
...es/flutter_gallery/lib/demo/material/overscroll_demo.dart
+1
-1
shrine_page.dart
examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
+1
-1
constants.dart
packages/flutter/lib/src/material/constants.dart
+4
-0
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+4
-4
No files found.
examples/flutter_gallery/lib/demo/material/menu_demo.dart
View file @
269538df
...
...
@@ -84,7 +84,7 @@ class MenuDemoState extends State<MenuDemo> {
]
),
body:
new
ListView
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
)
,
padding:
kMaterialListPadding
,
children:
<
Widget
>[
// Pressing the PopupMenuButton on the right of this item shows
// a simple menu with one disabled item. Typically the contents
...
...
examples/flutter_gallery/lib/demo/material/overscroll_demo.dart
View file @
269538df
...
...
@@ -60,7 +60,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
key:
_refreshIndicatorKey
,
onRefresh:
_handleRefresh
,
child:
new
ListView
.
builder
(
padding:
const
EdgeInsets
.
all
(
8.0
)
,
padding:
kMaterialListPadding
,
itemCount:
_items
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
final
String
item
=
_items
[
index
];
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
View file @
269538df
...
...
@@ -59,7 +59,7 @@ class ShrinePageState extends State<ShrinePage> {
);
}
return
new
ListView
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
)
,
padding:
kMaterialListPadding
,
children:
config
.
shoppingCart
.
values
.
map
((
Order
order
)
{
return
new
ListTile
(
title:
new
Text
(
order
.
product
.
name
),
...
...
packages/flutter/lib/src/material/constants.dart
View file @
269538df
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/painting.dart'
;
/// The height of the toolbar component of the [AppBar].
const
double
kToolbarHeight
=
56.0
;
...
...
@@ -25,3 +27,5 @@ const int kRadialReactionAlpha = 0x33;
/// The duration
const
Duration
kTabScrollDuration
=
const
Duration
(
milliseconds:
200
);
const
EdgeInsets
kMaterialListPadding
=
const
EdgeInsets
.
symmetric
(
vertical:
8.0
);
packages/flutter/lib/src/material/dropdown.dart
View file @
269538df
...
...
@@ -9,6 +9,7 @@ import 'package:flutter/scheduler.dart';
import
'package:flutter/widgets.dart'
;
import
'colors.dart'
;
import
'constants.dart'
;
import
'debug.dart'
;
import
'icon.dart'
;
import
'icons.dart'
;
...
...
@@ -21,7 +22,6 @@ import 'theme.dart';
const
Duration
_kDropdownMenuDuration
=
const
Duration
(
milliseconds:
300
);
const
double
_kMenuItemHeight
=
48.0
;
const
double
_kDenseButtonHeight
=
24.0
;
const
EdgeInsets
_kMenuVerticalPadding
=
const
EdgeInsets
.
symmetric
(
vertical:
8.0
);
const
EdgeInsets
_kMenuHorizontalPadding
=
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
);
class
_DropdownMenuPainter
extends
CustomPainter
{
...
...
@@ -49,7 +49,7 @@ class _DropdownMenuPainter extends CustomPainter {
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
final
double
selectedItemOffset
=
selectedIndex
*
_kMenuItemHeight
+
_kMenuVertical
Padding
.
top
;
final
double
selectedItemOffset
=
selectedIndex
*
_kMenuItemHeight
+
kMaterialList
Padding
.
top
;
final
Tween
<
double
>
top
=
new
Tween
<
double
>(
begin:
selectedItemOffset
.
clamp
(
0.0
,
size
.
height
-
_kMenuItemHeight
),
end:
0.0
,
...
...
@@ -178,7 +178,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
child:
new
Scrollbar
(
child:
new
ListView
(
controller:
config
.
route
.
scrollController
,
padding:
_kMenuVertical
Padding
,
padding:
kMaterialList
Padding
,
itemExtent:
_kMenuItemHeight
,
shrinkWrap:
true
,
children:
children
,
...
...
@@ -219,7 +219,7 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
@override
Offset
getPositionForChild
(
Size
size
,
Size
childSize
)
{
final
double
buttonTop
=
buttonRect
.
top
;
final
double
selectedItemOffset
=
selectedIndex
*
_kMenuItemHeight
+
_kMenuVertical
Padding
.
top
;
final
double
selectedItemOffset
=
selectedIndex
*
_kMenuItemHeight
+
kMaterialList
Padding
.
top
;
double
top
=
(
buttonTop
-
selectedItemOffset
)
-
(
_kMenuItemHeight
-
buttonRect
.
height
)
/
2.0
;
final
double
topPreferredLimit
=
_kMenuItemHeight
;
if
(
top
<
topPreferredLimit
)
...
...
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