Skip to content

Commit

Permalink
Enable strict-inference
Browse files Browse the repository at this point in the history
  • Loading branch information
simplezhli committed Nov 12, 2023
1 parent 373c867 commit cbb4e1c
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
errors:
# allow self-reference to deprecated members (we do this because otherwise we have
Expand Down
6 changes: 3 additions & 3 deletions lib/demo/lottie/lottie_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ class _MyTextField extends StatefulWidget {
final bool obscureText;
final TextInputType? keyboardType;
/// 获取焦点监听
final Function(bool isObscure)? onHasFocus;
final void Function(bool isObscure)? onHasFocus;
/// 密码可见监听
final Function(bool isObscure)? onObscureText;
final void Function(bool isObscure)? onObscureText;
/// 文字输入监听
final Function(String text)? onChanged;
final void Function(String text)? onChanged;

@override
_MyTextFieldState createState() => _MyTextFieldState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyBottomNavigationBar extends StatefulWidget {
/// 选中下标
final int selectedPosition;
final bool isShowIndicator;
final Function(int selectedPosition) selectedCallback;
final void Function(int selectedPosition) selectedCallback;

@override
_MyBottomNavigationBarState createState() => _MyBottomNavigationBarState();
Expand Down
2 changes: 1 addition & 1 deletion lib/goods/widgets/goods_size_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class GoodsSizeDialog extends StatefulWidget {
this.onPressed,
});

final Function(String)? onPressed;
final void Function(String)? onPressed;

@override
_GoodsSizeDialog createState() => _GoodsSizeDialog();
Expand Down
2 changes: 1 addition & 1 deletion lib/goods/widgets/goods_sort_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GoodsSortBottomSheet extends StatefulWidget {
required this.onSelected,
});

final Function(String, String) onSelected;
final void Function(String, String) onSelected;
/// 临时状态
final GoodsSortProvider provider;

Expand Down
2 changes: 1 addition & 1 deletion lib/goods/widgets/goods_sort_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GoodsSortMenu extends StatefulWidget {
final List<String> data;
final int sortIndex;
final double height;
final Function(int, String) onSelected;
final void Function(int, String) onSelected;

@override
_GoodsSortMenuState createState() => _GoodsSortMenuState();
Expand Down
6 changes: 3 additions & 3 deletions lib/net/dio_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ void configDio({
_interceptors = interceptors ?? _interceptors;
}

typedef NetSuccessCallback<T> = Function(T data);
typedef NetSuccessListCallback<T> = Function(List<T> data);
typedef NetErrorCallback = Function(int code, String msg);
typedef NetSuccessCallback<T> = void Function(T data);
typedef NetSuccessListCallback<T> = void Function(List<T> data);
typedef NetErrorCallback = void Function(int code, String msg);

/// @weilu https://github.com/simplezhli
class DioUtils {
Expand Down
2 changes: 1 addition & 1 deletion lib/order/widgets/pay_type_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PayTypeDialog extends StatefulWidget {
this.onPressed,
});

final Function(int, String)? onPressed;
final void Function(int, String)? onPressed;

@override
_PayTypeDialog createState() => _PayTypeDialog();
Expand Down
2 changes: 1 addition & 1 deletion lib/routers/fluro_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NavigatorUtils {
);
}

static void pushResult(BuildContext context, String path, Function(Object) function,
static void pushResult(BuildContext context, String path, void Function(Object) function,
{bool replace = false, bool clearStack = false, Object? arguments}) {
unfocus();
Routes.router.navigateTo(context, path,
Expand Down
2 changes: 1 addition & 1 deletion lib/shop/page/shop_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class _ShopFunctionModule extends StatelessWidget {
required this.darkImage,
});

final Function(int index) onItemClick;
final void Function(int index) onItemClick;
final List<String> data;
final List<String> image;
final List<String> darkImage;
Expand Down
4 changes: 2 additions & 2 deletions lib/shop/page/shop_setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class _ShopSettingPageState extends State<ShopSettingPage> {
}

void _goInputTextPage(BuildContext context, String title,
String hintText, String content, Function(Object?) function,
String hintText, String content, void Function(Object?) function,
{TextInputType? keyboardType}) {

NavigatorUtils.pushResult(context,
Expand All @@ -218,7 +218,7 @@ class _ShopSettingPageState extends State<ShopSettingPage> {
);
}

void _showInputDialog(String title, Function(String) onPressed) {
void _showInputDialog(String title, void Function(String) onPressed) {
showDialog<void>(
context: context,
barrierDismissible: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/shop/widgets/pay_type_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PayTypeDialog extends StatefulWidget {
});

final List<int>? value;
final Function(List<int>) onPressed;
final void Function(List<int>) onPressed;

@override
_PayTypeDialog createState() => _PayTypeDialog();
Expand Down
2 changes: 1 addition & 1 deletion lib/shop/widgets/price_input_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PriceInputDialog extends StatefulWidget {

final String? title;
final double inputMaxPrice;
final Function(String) onPressed;
final void Function(String) onPressed;

@override
_PriceInputDialog createState() => _PriceInputDialog();
Expand Down
2 changes: 1 addition & 1 deletion lib/shop/widgets/range_price_input_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RangePriceInputDialog extends StatefulWidget {
});

final String? title;
final Function(String, String) onPressed;
final void Function(String, String) onPressed;

@override
_RangePriceInputDialog createState() => _RangePriceInputDialog();
Expand Down
2 changes: 1 addition & 1 deletion lib/shop/widgets/send_type_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SendTypeDialog extends StatefulWidget {
required this.onPressed,
});

final Function(int, String) onPressed;
final void Function(int, String) onPressed;

@override
_SendTypeDialog createState() => _SendTypeDialog();
Expand Down
2 changes: 1 addition & 1 deletion lib/util/app_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AppNavigator {
);
}

static void pushResult(BuildContext context, Widget scene, Function(Object?) function) {
static void pushResult(BuildContext context, Widget scene, void Function(Object?) function) {
Navigator.push<void>(
context,
MaterialPageRoute(
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/my_search_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MySearchBar extends StatefulWidget implements PreferredSizeWidget {

final String backImg;
final String hintText;
final Function(String)? onPressed;
final void Function(String)? onPressed;

@override
_MySearchBarState createState() => _MySearchBarState();
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
# 侧滑删除 https://github.com/letsar/flutter_slidable
flutter_slidable: ^3.0.0
# WebView插件 https://github.com/flutter/packages/tree/main/packages/webview_flutter
webview_flutter: 4.2.4
webview_flutter: 4.4.1
# 处理键盘事件 https://github.com/diegoveloper/flutter_keyboard_actions
keyboard_actions: ^4.2.0
# 城市选择列表 https://github.com/flutterchina/azlistview
Expand All @@ -64,7 +64,7 @@ dependencies:
vibration: 1.8.1
vibration_web: 1.6.5
# 获取当前设备信息 https://github.com/fluttercommunity/plus_plugins/tree/main/packages/device_info_plus
device_info_plus: 9.0.2
device_info_plus: 9.1.0
# 桌面应用调整窗口的大小和位置 https://github.com/leanflutter/window_manager
window_manager: 0.3.6
# 高德2D地图插件(支持Web) https://github.com/simplezhli/flutter_2d_amap
Expand All @@ -76,7 +76,7 @@ dependencies:
# 刮刮卡 https://github.com/vintage/scratcher
scratcher: ^2.4.0
# 动画效果 https://github.com/xvrh/lottie-flutter
lottie: ^2.6.0
lottie: ^2.7.0

# https://github.com/simplezhli/flutter_deer/issues/187
dependency_overrides:
Expand Down

0 comments on commit cbb4e1c

Please sign in to comment.