Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Unified Diff: samples/swarm/Views.dart

Issue 12317107: ceil/floor/truncate/round return integers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload due to error3 Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/solar3d/web/solar.dart ('k') | samples/swarm/swarm_ui_lib/layout/GridLayout.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/swarm/Views.dart
diff --git a/samples/swarm/Views.dart b/samples/swarm/Views.dart
index 685894442cbfc0645a025d570c395ebb8e5a3bca..493da93c4cc9ccc0026611c070afd8b908c1b73f 100644
--- a/samples/swarm/Views.dart
+++ b/samples/swarm/Views.dart
@@ -669,20 +669,20 @@ class FixedSizeListViewLayout<D> implements ListViewLayout<D> {
}
int getPageLength(int viewLength) {
- final itemsPerPage = (viewLength / _itemLength).floor();
- return (Math.max(1, itemsPerPage) * _itemLength).toInt();
+ final itemsPerPage = viewLength ~/ _itemLength;
+ return Math.max(1, itemsPerPage) * _itemLength;
}
int getPage(int index, int viewLength) {
- return (getOffset(index) / getPageLength(viewLength)).floor().toInt();
+ return getOffset(index) ~/ getPageLength(viewLength);
}
int getPageStartIndex(int page, int viewLength) {
- return (getPageLength(viewLength) / _itemLength).toInt() * page;
+ return getPageLength(viewLength) ~/ _itemLength * page;
}
int getSnapIndex(num offset, int viewLength) {
- int index = (-offset / _itemLength).round().toInt();
+ int index = (-offset / _itemLength).round();
if (_paginate) {
index = getPageStartIndex(getPage(index, viewLength), viewLength);
}
« no previous file with comments | « samples/solar3d/web/solar.dart ('k') | samples/swarm/swarm_ui_lib/layout/GridLayout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698