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

null safety migration #11

Open
wants to merge 2 commits into
base: master
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
30 changes: 15 additions & 15 deletions lib/paging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Pagination<T> extends StatefulWidget {
///
/// The arguments [pageBuilder], [itemBuilder] must not be null.
Pagination({
Key key,
@required this.pageBuilder,
@required this.itemBuilder,
Key? key,
required this.pageBuilder,
required this.itemBuilder,
this.scrollDirection = Axis.vertical,
this.progress,
this.onError,
Expand Down Expand Up @@ -56,30 +56,30 @@ class Pagination<T> extends StatefulWidget {
final Axis scrollDirection;

/// When non-null [progress] widget is called to show loading progress
final Widget progress;
final Widget? progress;

/// Handle error returned by the Future implemented in [pageBuilder]
final Function(dynamic error) onError;
final Function(dynamic error)? onError;

final bool reverse;
final ScrollController controller;
final bool primary;
final ScrollPhysics physics;
final ScrollController? controller;
final bool? primary;
final ScrollPhysics? physics;
final bool shrinkWrap = false;
final EdgeInsetsGeometry padding;
final double itemExtent;
final EdgeInsetsGeometry? padding;
final double? itemExtent;
final bool addAutomaticKeepAlives = true;
final bool addRepaintBoundaries = true;
final bool addSemanticIndexes = true;
final double cacheExtent;
final int semanticChildCount;
final double? cacheExtent;
final int? semanticChildCount;

@override
_PaginationState<T> createState() => _PaginationState<T>();
}

class _PaginationState<T> extends State<Pagination<T>> {
final List<T> _list = List();
final List<T> _list = List.empty();
bool _isLoading = false;
bool _isEndOfList = false;

Expand All @@ -100,7 +100,7 @@ class _PaginationState<T> extends State<Pagination<T>> {
});
print(error);
if (widget.onError != null) {
widget.onError(error);
widget.onError!(error);
}
});
}
Expand Down Expand Up @@ -134,7 +134,7 @@ class _PaginationState<T> extends State<Pagination<T>> {
fetchMore();
return widget.progress ?? defaultLoading();
}
return null;
return const SizedBox.shrink();
},
);
}
Expand Down
62 changes: 38 additions & 24 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,34 +1,55 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.8.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -45,28 +66,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -78,55 +92,55 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.1"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
version: "0.4.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0"
sdks:
dart: ">=2.0.0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: Joshua Matta<[email protected]>
homepage: https://github.com/joshmatta/paging_library

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down