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 #37

Open
wants to merge 1 commit 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ ios/Flutter/Generated.xcconfig
ios/Runner/GeneratedPluginRegistrant.*

*.log
*.iml
15 changes: 15 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Volumes/DATA/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/cobalt/dev/git/flutter/transformer_page_view/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/Volumes/DATA/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
103 changes: 55 additions & 48 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,41 +1,62 @@
# 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.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.5.0-nullsafety.3"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "2.1.0-nullsafety.3"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.5"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.0-nullsafety.3"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.15.0-nullsafety.5"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
version: "0.1.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -50,37 +71,23 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
version: "0.12.10-nullsafety.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.3.0-nullsafety.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "1.8.0-nullsafety.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -90,44 +97,44 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.4"
version: "1.8.0-nullsafety.4"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.10.0-nullsafety.6"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
version: "2.1.0-nullsafety.3"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.1.0-nullsafety.3"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety.3"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2"
version: "0.2.19-nullsafety.6"
transformer_page_view:
dependency: "direct dev"
description:
Expand All @@ -139,15 +146,15 @@ packages:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.3.0-nullsafety.5"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.5"
sdks:
dart: ">=2.1.0 <3.0.0"
dart: ">=2.12.0-0.0 <3.0.0"
30 changes: 15 additions & 15 deletions lib/index_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@ class IndexController extends ChangeNotifier {
static const int PREVIOUS = -1;
static const int MOVE = 0;

Completer _completer;
Completer? _completer;

int index;
bool animation;
int event;
int? index;
bool? animation;
int? event;

Future move(int index, {bool animation: true}) {
this.animation = animation ?? true;
Future? move(int index, {bool animation: true}) {
this.animation = animation;
this.index = index;
this.event = MOVE;
_completer = new Completer();
notifyListeners();
return _completer.future;
return _completer?.future;
}

Future next({bool animation: true}) {
Future? next({bool animation: true}) {
this.event = NEXT;
this.animation = animation ?? true;
this.animation = animation;
_completer = new Completer();
notifyListeners();
return _completer.future;
return _completer?.future;
}

Future previous({bool animation: true}) {
Future? previous({bool animation: true}) {
this.event = PREVIOUS;
this.animation = animation ?? true;
this.animation = animation;
_completer = new Completer();
notifyListeners();
return _completer.future;
return _completer?.future;
}

void complete() {
if (!_completer.isCompleted) {
_completer.complete();
if (_completer != null && !_completer!.isCompleted) {
_completer!.complete();
}
}
}
14 changes: 7 additions & 7 deletions lib/parallax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ class ParallaxColor extends StatefulWidget {
final TransformInfo info;

ParallaxColor({
@required this.colors,
@required this.info,
@required this.child,
required this.colors,
required this.info,
required this.child,
});

@override
Expand All @@ -106,8 +106,8 @@ class ParallaxContainer extends StatelessWidget {
final double opacityFactor;

ParallaxContainer(
{@required this.child,
@required this.position,
{required this.child,
required this.position,
this.translationFactor: 100.0,
this.opacityFactor: 1.0})
: assert(position != null),
Expand All @@ -129,12 +129,12 @@ class ParallaxImage extends StatelessWidget {
final Image image;
final double imageFactor;

ParallaxImage.asset(String name, {double position, this.imageFactor: 0.3})
ParallaxImage.asset(String name, {double? position, this.imageFactor: 0.3})
: assert(imageFactor != null),
image = Image.asset(name,
fit: BoxFit.cover,
alignment: FractionalOffset(
0.5 + position * imageFactor,
0.5 + (position ?? 0) * imageFactor,
0.5,
));

Expand Down
Loading