-
-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
New files: * `paged_product_query.dart`: Paged product query (with pageSize and pageNumber). * `partial_product_list.dart`: List of Products out of partial results (e.g. paged results). Impacted files: * `category_product_query.dart`: now extending new class `PagedProductQuery`. * `dao_product_list.dart`: now storing "total size" of paged results; now including page size and page number in the primary key; now returning a bool for method `delete`. * `database_product_list_supplier.dart`: now loads paged results page after page. * `keywords_product_query.dart`: now extending new class `PagedProductQuery`. * `new_product_page.dart`: unrelated fix about back icon on Android/iOS. * `onboarding_flow_navigator.dart`: unrelated fix about back icon on Android/iOS. * `personalized_ranking_page.dart`: refactoring. * `Podfile.lock`: wtf * `product_list.dart`: removed now unused product list type (pnns); added fields page size, page number and total size for paged results; refactored. * `product_list_page.dart`: refactored. * `product_list_supplier.dart`: now using `PagedProductQuery` and `PartialProductList`. * `product_query_model.dart`: added a `clear` method to go back to top page; added method `loadNextPage` and `loadFromTop`. * `product_query_page.dart`: now displaying pages results with a "load next" button; unrelated fix about back icon on Android/iOS. * `product_query_page_helper.dart`: refactored. * `query_product_list_supplier.dart`: now using `PagedProductQuery`. * `scan_page_helper.dart`: refactored. * `search_page.dart`: refactored. * `summary_card.dart`: refactored.
- Loading branch information
1 parent
d1f82bd
commit e9ec9b3
Showing
20 changed files
with
424 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/smooth_app/lib/data_models/partial_product_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:openfoodfacts/openfoodfacts.dart'; | ||
import 'package:smooth_app/data_models/product_list.dart'; | ||
|
||
/// List of [Product]s out of partial results (e.g. paged results). | ||
class PartialProductList { | ||
final List<Product> _products = <Product>[]; | ||
int _totalSize = 0; | ||
|
||
/// Total size of the list from which this partial list is taken. | ||
int get totalSize => _totalSize; | ||
|
||
List<Product> getProducts() => _products; | ||
|
||
void add(final ProductList productList) { | ||
_products.addAll(productList.getList()); | ||
_totalSize = productList.totalSize; | ||
} | ||
|
||
void clear() { | ||
_products.clear(); | ||
_totalSize = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.