Skip to content

Commit 6a23930

Browse files
committed
调整了一些方法调用
1 parent 0cc9390 commit 6a23930

File tree

8 files changed

+10
-24
lines changed

8 files changed

+10
-24
lines changed

lib/common/ab/SqlManager.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ class SqlManager {
5959

6060
///关闭
6161
static close() {
62-
if (_database != null) {
63-
_database.close();
62+
_database?.close();
6463
_database = null;
65-
}
6664
}
6765
}

lib/widget/GSYFlexButton.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ class GSYFlexButton extends StatelessWidget {
3535
children: <Widget>[new Text(text, style: new TextStyle(fontSize: fontSize), maxLines: maxLines, overflow:TextOverflow.ellipsis)],
3636
),
3737
onPressed: () {
38-
if (this.onPress != null) {
39-
this.onPress();
40-
}
38+
this.onPress?.call();
4139
});
4240
}
4341
}

lib/widget/GSYPullLoadWidget.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class _GSYPullLoadWidgetState extends State<GSYPullLoadWidget> {
4646
_scrollController.addListener(() {
4747
///判断当前滑动位置是不是到达底部,触发加载更多回调
4848
if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
49-
if (this.onLoadMore != null && this.control.needLoadMore) {
50-
this.onLoadMore();
49+
if (this.control.needLoadMore) {
50+
this.onLoadMore?.call();
5151
}
5252
}
5353
});

lib/widget/GSYSearchDrawer.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ class _GSYSearchDrawerState extends State<GSYSearchDrawer> {
107107
}
108108
list[index].select = true;
109109
});
110-
if (select != null) {
111-
select(model.value);
112-
}
110+
select?.call(model.value);
113111
},
114112
child: new Container(
115113
width: itemWidth,

lib/widget/GSYSelectItemWidget.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ class _GSYSelectItemWidgetState extends State<GSYSelectItemWidget> {
6464
textAlign: TextAlign.center,
6565
),
6666
onPressed: () {
67-
if (selectItemChanged != null) {
68-
if (selectIndex != index) {
69-
selectItemChanged(index);
70-
}
67+
if (selectIndex != index) {
68+
selectItemChanged?.call(index);
7169
}
7270
setState(() {
7371
selectIndex = index;

lib/widget/GSYTabBarWidget.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ class _GSYTabBarState extends State<GSYTabBarWidget> with SingleTickerProviderSt
128128
children: _tabViews,
129129
onPageChanged: (index) {
130130
_tabController.animateTo(index);
131-
if (_onPageChanged != null) {
132-
_onPageChanged(index);
133-
}
131+
_onPageChanged?.call(index);
134132
},
135133
),
136134
);

lib/widget/IssueEditDIalog.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@ class _IssueEditDialogState extends State<IssueEditDialog> {
8787
setState(() {
8888
valueController.value = new TextEditingValue(text: newText);
8989
});
90-
if (onContentChanged != null) {
91-
onContentChanged(newText);
92-
}
90+
onContentChanged?.call(newText);
9391
});
9492
},
9593
itemCount: FAST_INPUT_LIST.length,

lib/widget/UserHeader.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ class UserHeaderItem extends StatelessWidget {
7070
),
7171
onPressed: () {
7272
NavigatorUtils.goNotifyPage(context).then((res) {
73-
if (refreshCallBack != null) {
74-
refreshCallBack();
75-
}
73+
refreshCallBack?.call();
7674
});
7775
});
7876
}

0 commit comments

Comments
 (0)