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

Removes null aware warning while building app #595

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions lib/src/smart_refresher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
createTime:2018-05-01 11:39
*/

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/physics.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/foundation.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:pull_to_refresh/src/internals/slivers.dart';
import 'internals/indicator_wrap.dart';
import 'internals/refresh_physics.dart';

import 'indicator/classic_indicator.dart';
import 'indicator/material_indicator.dart';
import 'internals/indicator_wrap.dart';
import 'internals/refresh_physics.dart';

// ignore_for_file: INVALID_USE_OF_PROTECTED_MEMBER
// ignore_for_file: INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER
Expand Down Expand Up @@ -510,7 +511,7 @@ class SmartRefresherState extends State<SmartRefresher> {
void initState() {
// TODO: implement initState
if (widget.controller.initialRefresh) {
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
// if mounted,it avoid one situation: when init done,then dispose the widget before build.
// this situation mostly TabBarView
if (mounted) widget.controller.requestRefresh();
Expand Down Expand Up @@ -762,7 +763,7 @@ class RefreshController {
{Duration duration: const Duration(milliseconds: 500),
Curve curve: Curves.linear}) {
headerMode?.value = RefreshStatus.twoLevelClosing;
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
position!
.animateTo(0.0, duration: duration, curve: curve)
.whenComplete(() {
Expand All @@ -785,22 +786,22 @@ class RefreshController {
/// after data returned,set the footer state to idle
void loadComplete() {
// change state after ui update,else it will have a bug:twice loading
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
footerMode?.value = LoadStatus.idle;
});
}

/// If catchError happen,you may call loadFailed indicate fetch data from network failed
void loadFailed() {
// change state after ui update,else it will have a bug:twice loading
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
footerMode?.value = LoadStatus.failed;
});
}

/// load more success without error,but no data returned
void loadNoData() {
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
footerMode?.value = LoadStatus.noMore;
});
}
Expand Down