Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#378 infinite loop gallery #543

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_classes_with_only_static_members
- avoid_empty_else
Expand All @@ -27,10 +26,8 @@ linter:
- empty_statements
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- library_names
- library_prefixes
- list_remove_unrelated_type
- no_adjacent_strings_in_list
- no_duplicate_case_values
- non_constant_identifier_names
Expand Down Expand Up @@ -71,4 +68,3 @@ linter:
- unrelated_type_equality_checks
- use_rethrow_when_possible
- unnecessary_new

4 changes: 0 additions & 4 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_classes_with_only_static_members
- avoid_empty_else
Expand All @@ -27,10 +26,8 @@ linter:
- empty_statements
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- library_names
- library_prefixes
- list_remove_unrelated_type
- no_adjacent_strings_in_list
- no_duplicate_case_values
- non_constant_identifier_names
Expand All @@ -46,7 +43,6 @@ linter:
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_final_locals
- prefer_foreach
Expand Down
13 changes: 5 additions & 8 deletions lib/photo_view_gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:photo_view/photo_view.dart'
PhotoViewImageTapUpCallback,
PhotoViewImageScaleEndCallback,
ScaleStateCycle;

import 'package:photo_view/src/controller/photo_view_controller.dart';
import 'package:photo_view/src/controller/photo_view_scalestate_controller.dart';
import 'package:photo_view/src/core/photo_view_gesture_detector.dart';
Expand Down Expand Up @@ -127,8 +126,8 @@ class PhotoViewGallery extends StatefulWidget {
/// The builder must return a [PhotoViewGalleryPageOptions].
const PhotoViewGallery.builder({
Key? key,
required this.itemCount,
required this.builder,
required PhotoViewGalleryBuilder this.builder,
this.itemCount,
this.loadingBuilder,
this.backgroundDecoration,
this.wantKeepAlive = false,
Expand All @@ -144,8 +143,6 @@ class PhotoViewGallery extends StatefulWidget {
this.allowImplicitScrolling = false,
this.pageSnapping = true,
}) : pageOptions = null,
assert(itemCount != null),
assert(builder != null),
super(key: key);

/// A list of options to describe the items in the gallery
Expand Down Expand Up @@ -220,11 +217,11 @@ class _PhotoViewGalleryState extends State<PhotoViewGallery> {
return _controller.hasClients ? _controller.page!.floor() : 0;
}

int get itemCount {
int? get itemCount {
if (widget._isBuilder) {
return widget.itemCount!;
return widget.itemCount;
}
return widget.pageOptions!.length;
return widget.pageOptions?.length;
}

@override
Expand Down