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
149f788c
Commit
149f788c
authored
Mar 09, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use lowerBound() from package:collection/collection.dart
parent
df94a0ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
21 deletions
+4
-21
scrollable_grid.dart
packages/flutter/lib/src/widgets/scrollable_grid.dart
+3
-20
pubspec.yaml
packages/flutter/pubspec.yaml
+1
-1
No files found.
packages/flutter/lib/src/widgets/scrollable_grid.dart
View file @
149f788c
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'package:collection/collection.dart'
show
lowerBound
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'framework.dart'
;
import
'framework.dart'
;
...
@@ -84,24 +85,6 @@ class GridViewport extends VirtualViewportFromIterable {
...
@@ -84,24 +85,6 @@ class GridViewport extends VirtualViewportFromIterable {
_GridViewportElement
createElement
()
=>
new
_GridViewportElement
(
this
);
_GridViewportElement
createElement
()
=>
new
_GridViewportElement
(
this
);
}
}
// TODO(abarth): This function should go somewhere more general.
// See https://github.com/dart-lang/collection/pull/16
int
_lowerBound
(
List
sortedList
,
var
value
,
{
int
begin:
0
})
{
int
current
=
begin
;
int
count
=
sortedList
.
length
-
current
;
while
(
count
>
0
)
{
int
step
=
count
>>
1
;
int
test
=
current
+
step
;
if
(
sortedList
[
test
]
<
value
)
{
current
=
test
+
1
;
count
-=
step
+
1
;
}
else
{
count
=
step
;
}
}
return
current
;
}
class
_GridViewportElement
extends
VirtualViewportElement
<
GridViewport
>
{
class
_GridViewportElement
extends
VirtualViewportElement
<
GridViewport
>
{
_GridViewportElement
(
GridViewport
widget
)
:
super
(
widget
);
_GridViewportElement
(
GridViewport
widget
)
:
super
(
widget
);
...
@@ -133,8 +116,8 @@ class _GridViewportElement extends VirtualViewportElement<GridViewport> {
...
@@ -133,8 +116,8 @@ class _GridViewportElement extends VirtualViewportElement<GridViewport> {
double
contentExtent
=
_specification
.
gridSize
.
height
;
double
contentExtent
=
_specification
.
gridSize
.
height
;
double
containerExtent
=
renderObject
.
size
.
height
;
double
containerExtent
=
renderObject
.
size
.
height
;
int
materializedRowBase
=
math
.
max
(
0
,
_
lowerBound
(
_specification
.
rowOffsets
,
widget
.
startOffset
)
-
1
);
int
materializedRowBase
=
math
.
max
(
0
,
lowerBound
(
_specification
.
rowOffsets
,
widget
.
startOffset
)
-
1
);
int
materializedRowLimit
=
math
.
min
(
_specification
.
rowCount
,
_
lowerBound
(
_specification
.
rowOffsets
,
widget
.
startOffset
+
containerExtent
));
int
materializedRowLimit
=
math
.
min
(
_specification
.
rowCount
,
lowerBound
(
_specification
.
rowOffsets
,
widget
.
startOffset
+
containerExtent
));
_materializedChildBase
=
(
materializedRowBase
*
_specification
.
columnCount
).
clamp
(
0
,
renderObject
.
virtualChildCount
);
_materializedChildBase
=
(
materializedRowBase
*
_specification
.
columnCount
).
clamp
(
0
,
renderObject
.
virtualChildCount
);
_materializedChildCount
=
(
materializedRowLimit
*
_specification
.
columnCount
).
clamp
(
0
,
renderObject
.
virtualChildCount
)
-
_materializedChildBase
;
_materializedChildCount
=
(
materializedRowLimit
*
_specification
.
columnCount
).
clamp
(
0
,
renderObject
.
virtualChildCount
)
-
_materializedChildBase
;
...
...
packages/flutter/pubspec.yaml
View file @
149f788c
...
@@ -5,7 +5,7 @@ description: A framework for writing Flutter applications
...
@@ -5,7 +5,7 @@ description: A framework for writing Flutter applications
homepage
:
http://flutter.io
homepage
:
http://flutter.io
dependencies
:
dependencies
:
collection
:
'
>=1.
1.3
<2.0.0'
collection
:
'
>=1.
4.0
<2.0.0'
intl
:
'
>=0.12.4+2
<0.13.0'
intl
:
'
>=0.12.4+2
<0.13.0'
vector_math
:
'
>=1.4.5
<2.0.0'
vector_math
:
'
>=1.4.5
<2.0.0'
quiver
:
'
>=0.21.4
<0.22.0'
quiver
:
'
>=0.21.4
<0.22.0'
...
...
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