Skip to content

Commit

Permalink
bug# 修复
Browse files Browse the repository at this point in the history
#2
element为空导致的渲染崩溃
  • Loading branch information
lianyagang committed May 11, 2021
1 parent 8429674 commit e777cda
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .dart_tool/package_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"languageVersion": "2.12"
}
],
"generated": "2021-04-21T06:10:37.681614Z",
"generated": "2021-04-21T06:53:19.180607Z",
"generator": "pub",
"generatorVersion": "2.12.1"
}
104 changes: 47 additions & 57 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .packages
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2021-04-21 14:10:37.671644.
# Generated by pub on 2021-04-21 14:53:19.171685.
async:file:///Users/lian/.pub-cache/hosted/pub.flutter-io.cn/async-2.5.0/lib/
boolean_selector:file:///Users/lian/.pub-cache/hosted/pub.flutter-io.cn/boolean_selector-2.1.0/lib/
characters:file:///Users/lian/.pub-cache/hosted/pub.flutter-io.cn/characters-1.1.0/lib/
Expand Down
5 changes: 4 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ class ExampleHorizontal extends StatelessWidget {
},
indicatorLayout: PageIndicatorLayout.SCALE,
autoplay: true,
autoplayDelay: 3000,
autoplayDelay: 1000,
itemCount: images.length,
pagination: new SwiperPagination(),
control: new SwiperControl(),
fade: 1.0,
viewportFraction: 0.85,
));
}
}
Expand Down Expand Up @@ -159,6 +161,7 @@ class ExampleFraction extends StatelessWidget {
children: <Widget>[
Expanded(
child: new Swiper(
indicatorLayout: PageIndicatorLayout.SLIDE,
itemBuilder: (BuildContext context, int index) {
return new Image.asset(
images[index],
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.0"
version: "1.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
14 changes: 8 additions & 6 deletions lib/src/transformer_page_view/transformer_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,15 @@ class _TransformerPageViewState extends State<TransformerPageView> {

void _onGetSize(_) {
Size? size;
RenderObject? renderObject = context.findRenderObject();
if (renderObject != null) {
Rect bounds = renderObject.paintBounds;
size = bounds.size;
if (mounted) {
RenderObject? renderObject = context.findRenderObject();
if (renderObject != null) {
Rect bounds = renderObject.paintBounds;
size = bounds.size;
}
_calcCurrentPixels();
onGetSize(size);
}
_calcCurrentPixels();
onGetSize(size);
}

void onGetSize(Size? size) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_swiper_null_safety
description: The best swiper(carousel) for flutter, with multiple layouts, infinite loop. Compatible with Android & iOS.
version: 1.0.0
version: 1.0.2
homepage: https://github.com/lianyagang/flutter_swiper_null_safety

dependencies:
Expand Down

0 comments on commit e777cda

Please sign in to comment.