From 6f27a6c626b85ff03587b6bf9b1698d6c7d02b27 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Tue, 27 Apr 2021 17:56:24 +0800 Subject: [PATCH] NNBD #1 --- lib/constants/api.dart | 4 +- lib/constants/app_theme.dart | 4 +- lib/extensions/widget_list_ext.dart | 2 +- lib/main.dart | 6 +- lib/main_initialize.dart | 8 +- lib/model/common/img_model.dart | 17 ++- lib/model/common/real_time_weather_model.dart | 126 +++++++++--------- .../community/activity_detail_model.dart | 34 ++--- lib/model/community/activity_item_model.dart | 28 ++-- .../community/activity_people_model.dart | 12 +- lib/model/community/board_detail_model.dart | 18 +-- lib/model/community/board_model.dart | 14 +- .../community/community_topic_model.dart | 16 +-- lib/model/community/event_item_model.dart | 56 ++++---- lib/model/community/hot_topic_model.dart | 4 +- lib/model/community/my_event_item_model.dart | 14 +- lib/model/manager/advice_detail_model.dart | 44 +++--- lib/model/manager/article_QR_code_model.dart | 18 +-- .../manager/article_borrow_detail_model.dart | 17 ++- lib/model/manager/article_borrow_model.dart | 12 +- .../manager/article_return_list_model.dart | 30 ++--- lib/model/manager/article_return_model.dart | 26 ++-- lib/model/manager/estate_payment_model.dart | 6 +- lib/model/manager/event_voting_model.dart | 34 ++--- lib/model/manager/fixed_detail_model.dart | 42 +++--- lib/model/manager/goods_out_model.dart | 30 ++--- lib/model/manager/life_pay_model.dart | 48 +++---- lib/model/manager/life_pay_record_model.dart | 16 +-- lib/model/manager/mine_goods_model.dart | 14 +- lib/model/manager/moving_company_model.dart | 10 +- lib/model/manager/questinnaire_model.dart | 36 ++--- .../manager/questionnaire_detail_model.dart | 40 +++--- .../manager/quetionnaire_submit_model.dart | 14 +- .../manager/suggestion_or_complain_model.dart | 26 ++-- .../manager/visitor_list_item_model.dart | 16 +-- lib/model/manager/voting_detail_model.dart | 44 +++--- lib/model/message/comment_message_model.dart | 28 ++-- lib/model/message/message_center_model.dart | 8 +- .../message/system_message_detail_model.dart | 6 +- lib/model/message/system_message_model.dart | 8 +- lib/model/user/car_parking_model.dart | 14 +- lib/model/user/committee_item_model.dart | 24 ++-- lib/model/user/convenient_phone_model.dart | 6 +- lib/model/user/fixed_submit_model.dart | 14 +- lib/model/user/house_model.dart | 18 +-- lib/model/user/pick_building_model.dart | 4 +- lib/model/user/user_detail_model.dart | 30 ++--- lib/model/user/user_info_model.dart | 16 +-- .../convenient_phone_page.dart | 22 +-- .../event_activity/event_voting_page.dart | 18 +-- .../event_activity/voting_detail_page.dart | 24 ++-- .../deto_code_page/deto_code_page.dart | 18 +-- .../deto_create_page/deto_create_page.dart | 36 ++--- .../deto_create_page/widget/common_radio.dart | 14 +- .../goods_deto_page/goods_deto_page.dart | 10 +- .../select_move_company_page.dart | 24 ++-- .../widget/goods_info_card.dart | 24 ++-- .../widget/goods_info_card_button.dart | 14 +- .../borrow/borrow_finsh_page.dart | 18 +-- .../borrow/borrow_goods_detail_page.dart | 34 ++--- .../borrow/borrow_goods_page.dart | 23 ++-- .../goods_manage_page/goods_manage_page.dart | 6 +- .../mine_goods_page/mine_goods_page.dart | 16 +-- .../retrun/return_goods_detail_page.dart | 14 +- .../select_borrow_return_page.dart | 2 +- lib/pages/home/home_page.dart | 8 +- lib/pages/home/widget/animate_app_bar.dart | 20 +-- lib/pages/home/widget/home_search.dart | 2 +- .../committee_mailbox_page.dart | 2 +- .../industry_committee_page.dart | 8 +- .../life_pay_bill_page.dart | 2 +- .../life_pay_bill_page/widget/bill_card.dart | 2 +- lib/pages/life_pay/life_pay_page.dart | 40 +++--- lib/pages/life_pay/life_pay_record_page.dart | 18 +-- .../life_pay/widget/life_pay_detail_page.dart | 50 +++---- lib/pages/life_pay/widget/submit_bar.dart | 6 +- lib/pages/manager_func.dart | 66 +++++---- .../comment_message/comment_message_page.dart | 14 +- .../message_center_page.dart | 20 +-- .../message_center_page/message_func.dart | 2 +- .../message_center_page/refund_details.dart | 6 +- .../system_message_detail_page.dart | 10 +- .../system_message/system_message_page.dart | 18 +-- lib/pages/one_alarm/alarm_detail_page.dart | 2 +- lib/pages/one_alarm/widget/alarm_page.dart | 12 +- .../opening_code_page/opening_code_page.dart | 2 +- lib/pages/personal/change_nick_name_page.dart | 10 +- lib/pages/personal/personal_page.dart | 6 +- lib/pages/personal/update_tel_page.dart | 33 ++--- lib/pages/personal/user_profile_page.dart | 20 +-- .../personal/widget/refund_shop_card.dart | 10 +- .../personal/widget/refund_tile_card.dart | 6 +- lib/pages/property/property_index.dart | 10 +- lib/pages/property/widget/property_card.dart | 2 +- .../setting_page/about_page/about_page.dart | 2 +- .../setting_page/account_manager_page.dart | 2 +- .../agreement_page/privacy_page.dart | 2 +- .../feedback_page/feedback_page.dart | 6 +- .../setting_page/invite_page/invite_page.dart | 2 +- lib/pages/setting_page/settings_page.dart | 8 +- lib/pages/sign/sign_func.dart | 14 +- lib/pages/sign/sign_in_page.dart | 24 ++-- .../sign_up/sign_up_set_nickname_page.dart | 6 +- .../sign/sign_up/sign_up_verify_page.dart | 6 +- lib/pages/splash/splash_page.dart | 6 +- lib/pages/tab_navigator.dart | 10 +- lib/pages/things_page/fixed_submit_page.dart | 35 +++-- .../widget/add_fixed_submit_page.dart | 24 ++-- .../things_page/widget/bee_list_view.dart | 24 ++-- .../widget/finish_fixed_submit_page.dart | 2 +- .../things_page/widget/fixed_check_box.dart | 6 +- .../things_page/widget/fixed_detail_page.dart | 50 +++---- .../widget/fixed_evaluate_page.dart | 16 +-- .../visitor_access_page.dart | 26 ++-- lib/provider/app_provider.dart | 44 +++--- lib/provider/sign_up_provider.dart | 8 +- lib/provider/user_provider.dart | 48 +++---- lib/ui/community/activity/activity_card.dart | 28 ++-- .../activity/activity_detail_page.dart | 28 ++-- .../activity/activity_list_page.dart | 8 +- .../activity/activity_people_list_page.dart | 14 +- lib/ui/community/community_func.dart | 10 +- .../community_views/add_new_event_page.dart | 24 ++-- .../community_views/community_page.dart | 14 +- .../community_views/event_detail_page.dart | 8 +- .../community_views/my_community_view.dart | 10 +- .../community_views/new_community_view.dart | 8 +- .../topic/topic_community_view.dart | 14 +- .../topic/topic_detail_page.dart | 24 ++-- .../topic/topic_sliver_header.dart | 12 +- .../community_views/widgets/chat_card.dart | 88 ++++++------ .../widgets/my_event_card.dart | 28 ++-- .../community_views/widgets/send_a_chat.dart | 12 +- lib/ui/community/facility/facility_page.dart | 2 +- .../facility/pick_facility_page.dart | 2 +- lib/ui/community/notice/notice_card.dart | 36 ++--- .../community/notice/notice_detail_page.dart | 22 +-- lib/ui/community/notice/notice_page.dart | 8 +- lib/ui/community/public_infomation_page.dart | 4 +- lib/ui/home/application/all_application.dart | 2 +- lib/ui/home/home_notification.dart | 4 +- lib/ui/home/home_title.dart | 8 +- .../advice/advice_add_comment_page.dart | 10 +- lib/ui/manager/advice/advice_card.dart | 22 +-- lib/ui/manager/advice/advice_detail_page.dart | 32 ++--- .../manager/advice/advice_evaluate_page.dart | 6 +- lib/ui/manager/advice/advice_page.dart | 23 +--- lib/ui/manager/advice/new_advice_page.dart | 12 +- .../questionnaire_detail_page.dart | 46 +++---- .../questionnaire/questionnaire_page.dart | 20 +-- .../questionnaire_siglecheck.dart | 28 ++-- .../questionnaire_truefalse.dart | 14 +- .../questionnarie_raido_check.dart | 28 ++-- .../questionnaire/submit_complish_page.dart | 16 +-- lib/ui/manager/visitor/visitor_list_item.dart | 4 +- .../visitor/visitor_passport_page.dart | 12 +- .../manager/visitor/visitor_record_page.dart | 6 +- .../manager/visitor/visitor_record_view.dart | 8 +- lib/ui/profile/car/car_manage_card.dart | 16 +-- lib/ui/profile/car/car_manage_page.dart | 2 +- .../profile/car_parking/car_parking_card.dart | 16 +-- .../profile/car_parking/car_parking_page.dart | 2 +- .../car_parking/manage_car_parking_page.dart | 2 +- .../car_parking/mange_card_parking_card.dart | 2 +- lib/ui/profile/house/add_house_page.dart | 50 +++---- lib/ui/profile/house/house_card.dart | 24 ++-- lib/ui/profile/house/house_func.dart | 2 +- lib/ui/profile/house/house_item.dart | 7 +- lib/ui/profile/house/house_owners_page.dart | 12 +- lib/ui/profile/house/pick_building_page.dart | 6 +- lib/ui/profile/house/pick_my_house_page.dart | 34 ++--- lib/ui/profile/house/pick_plot_page.dart | 2 +- lib/ui/profile/house/pick_role_page.dart | 10 +- lib/ui/profile/house/pick_unit_page.dart | 6 +- lib/ui/search/bee_search.dart | 6 +- lib/utils/bee_date_util.dart | 14 +- lib/utils/hive_store.dart | 4 +- lib/utils/login_util.dart | 6 +- lib/utils/network/base_file_model.dart | 6 +- lib/utils/network/base_list_model.dart | 6 +- lib/utils/network/base_model.dart | 6 +- lib/utils/network/login_model.dart | 6 +- lib/utils/network/net_util.dart | 36 ++--- lib/widget/animated/animated_scale.dart | 10 +- lib/widget/animated/animated_transition.dart | 10 +- lib/widget/bee_back_button.dart | 2 +- lib/widget/bee_divider.dart | 18 +-- lib/widget/bee_scaffold.dart | 26 ++-- lib/widget/buttons/bee_check_box.dart | 14 +- lib/widget/buttons/bee_check_button.dart | 14 +- lib/widget/buttons/bee_check_radio.dart | 8 +- lib/widget/buttons/bee_single_check.dart | 6 +- lib/widget/buttons/bottom_button.dart | 8 +- lib/widget/buttons/column_action_button.dart | 12 +- lib/widget/buttons/radio_button.dart | 6 +- lib/widget/common_input.dart | 8 +- lib/widget/others/stack_avatar.dart | 6 +- lib/widget/picker/bee_custom_picker.dart | 8 +- lib/widget/picker/bee_date_picker.dart | 16 +-- lib/widget/picker/bee_house_picker.dart | 6 +- lib/widget/picker/bee_image_picker.dart | 6 +- lib/widget/picker/bee_image_preview.dart | 22 +-- lib/widget/picker/grid_image_picker.dart | 8 +- lib/widget/tab_bar/bee_tab_bar.dart | 16 +-- lib/widget/views/ bee_download_view.dart | 10 +- lib/widget/views/application_box.dart | 4 +- lib/widget/views/application_view.dart | 14 +- lib/widget/views/bee_grid_image_view.dart | 8 +- lib/widget/views/horizontal_image_view.dart | 6 +- pubspec.lock | 2 +- pubspec.yaml | 5 +- 211 files changed, 1705 insertions(+), 1719 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index f091151e..8c63611c 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -8,8 +8,8 @@ class API { ///静态资源路径 static String get resource => '$host/static'; - static String image(String path) => '$resource$path'; - static String file(String path) => '$resource$path'; + static String image(String? path) => '$resource$path'; + static String file(String? path) => '$resource$path'; static const int networkTimeOut = 10000; static _Login login = _Login(); diff --git a/lib/constants/app_theme.dart b/lib/constants/app_theme.dart index 6fa0c405..313af275 100644 --- a/lib/constants/app_theme.dart +++ b/lib/constants/app_theme.dart @@ -62,7 +62,7 @@ class AppTheme { unselectedLabelStyle: TextStyle(), ), radioTheme: RadioThemeData( - fillColor: MaterialStateProperty.resolveWith((states) { + fillColor: MaterialStateProperty.resolveWith((states) { if (states.contains(MaterialState.selected)) return Color(0xFFFFD000); return null; }), @@ -121,7 +121,7 @@ class SystemStyle { systemNavigationBarColor: Color(0xFFFFD000), ); - static genStyle({@required Color bottom}) { + static genStyle({required Color bottom}) { return SystemUiOverlayStyle( statusBarIconBrightness: Brightness.light, systemNavigationBarColor: bottom, diff --git a/lib/extensions/widget_list_ext.dart b/lib/extensions/widget_list_ext.dart index 97718f4c..083ecf76 100644 --- a/lib/extensions/widget_list_ext.dart +++ b/lib/extensions/widget_list_ext.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'num_ext.dart'; extension WidgetListExt on List { - List sepWidget({Widget separate}) { + List sepWidget({Widget? separate}) { if (this.isEmpty) return []; return List.generate(this.length * 2 - 1, (index) { if (index.isEven) diff --git a/lib/main.dart b/lib/main.dart index b8329023..5aea23b1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -30,7 +30,7 @@ void main() async { } class MyApp extends StatefulWidget { - MyApp({Key key}) : super(key: key); + MyApp({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); @@ -52,13 +52,13 @@ class _MyAppState extends State { FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) { - FocusManager.instance.primaryFocus.unfocus(); + FocusManager.instance.primaryFocus!.unfocus(); } }, child: ScreenUtilInit( designSize: Size(750, 1334), builder: () => GetMaterialApp( - onGenerateTitle: (context) => S.of(context).appName, + onGenerateTitle: (context) => S.of(context)!.appName, debugShowCheckedModeBanner: false, theme: AppTheme.theme, home: SplashPage(), diff --git a/lib/main_initialize.dart b/lib/main_initialize.dart index a6459d28..05c46c5d 100644 --- a/lib/main_initialize.dart +++ b/lib/main_initialize.dart @@ -48,9 +48,9 @@ class MainInitialize { } jpush.addEventHandler( - onReceiveNotification: jPushLogger('onReceiveNotification'), - onOpenNotification: jPushLogger('onOpenNotification'), - onReceiveMessage: jPushLogger('onReceiveMessage'), + onReceiveNotification: jPushLogger('onReceiveNotification') as Future Function(Map?)?, + onOpenNotification: jPushLogger('onOpenNotification') as Future Function(Map?)?, + onReceiveMessage: jPushLogger('onReceiveMessage') as Future Function(Map?)?, ); jpush.setup( appKey: "6a2c6507e3e8b3187ac1c9f9", @@ -58,7 +58,7 @@ class MainInitialize { production: false, debug: true, ); - String rID = await jpush.getRegistrationID(); + String? rID = await jpush.getRegistrationID(); LoggerData.addData(rID, tag: 'RegistrationID'); } diff --git a/lib/model/common/img_model.dart b/lib/model/common/img_model.dart index fe1e9a54..c3f8d08b 100644 --- a/lib/model/common/img_model.dart +++ b/lib/model/common/img_model.dart @@ -1,10 +1,10 @@ class ImgModel { - String url; - String size; - double longs; - double paragraph; - int sort; - double get aspect => paragraph / longs; + String? url; + String? size; + double? longs; + double? paragraph; + int? sort; + double get aspect => paragraph! / longs!; ImgModel({this.url, this.size, this.longs, this.paragraph, this.sort}); @@ -16,14 +16,13 @@ class ImgModel { sort = json['sort']; } - static String first(List models) { + static String first(List? models) { if (models == null) return ''; if (models.isEmpty) return ''; return models.first.url ?? ''; } - static ImgModel firstModel(List models) { - if (models == null) return null; + static ImgModel? firstModel(List models) { if (models.isEmpty) return null; return models.first; } diff --git a/lib/model/common/real_time_weather_model.dart b/lib/model/common/real_time_weather_model.dart index 97ac7810..1995b636 100644 --- a/lib/model/common/real_time_weather_model.dart +++ b/lib/model/common/real_time_weather_model.dart @@ -1,14 +1,14 @@ class RealTimeWeatherModel { - String status; - String apiVersion; - String apiStatus; - String lang; - String unit; - num tzshift; - String timezone; - num serverTime; - List location; - Result result; + String? status; + String? apiVersion; + String? apiStatus; + String? lang; + String? unit; + num? tzshift; + String? timezone; + num? serverTime; + List? location; + Result? result; RealTimeWeatherModel( {this.status, @@ -48,15 +48,15 @@ class RealTimeWeatherModel { data['server_time'] = this.serverTime; data['location'] = this.location; if (this.result != null) { - data['result'] = this.result.toJson(); + data['result'] = this.result!.toJson(); } return data; } } class Result { - Realtime realtime; - num primary; + Realtime? realtime; + num? primary; Result({this.realtime, this.primary}); @@ -70,7 +70,7 @@ class Result { Map toJson() { final Map data = new Map(); if (this.realtime != null) { - data['realtime'] = this.realtime.toJson(); + data['realtime'] = this.realtime!.toJson(); } data['primary'] = this.primary; return data; @@ -78,19 +78,19 @@ class Result { } class Realtime { - String status; - num temperature; - num humidity; - num cloudrate; - String skycon; - num visibility; - num dswrf; - Wind wind; - num pressure; - num apparentTemperature; - Precipitation precipitation; - AirQuality airQuality; - LifeIndex lifeIndex; + String? status; + num? temperature; + num? humidity; + num? cloudrate; + String? skycon; + num? visibility; + num? dswrf; + Wind? wind; + num? pressure; + num? apparentTemperature; + Precipitation? precipitation; + AirQuality? airQuality; + LifeIndex? lifeIndex; Realtime( {this.status, @@ -139,26 +139,26 @@ class Realtime { data['visibility'] = this.visibility; data['dswrf'] = this.dswrf; if (this.wind != null) { - data['wind'] = this.wind.toJson(); + data['wind'] = this.wind!.toJson(); } data['pressure'] = this.pressure; data['apparent_temperature'] = this.apparentTemperature; if (this.precipitation != null) { - data['precipitation'] = this.precipitation.toJson(); + data['precipitation'] = this.precipitation!.toJson(); } if (this.airQuality != null) { - data['air_quality'] = this.airQuality.toJson(); + data['air_quality'] = this.airQuality!.toJson(); } if (this.lifeIndex != null) { - data['life_index'] = this.lifeIndex.toJson(); + data['life_index'] = this.lifeIndex!.toJson(); } return data; } } class Wind { - num speed; - num direction; + num? speed; + num? direction; Wind({this.speed, this.direction}); @@ -176,8 +176,8 @@ class Wind { } class Precipitation { - Local local; - Nearest nearest; + Local? local; + Nearest? nearest; Precipitation({this.local, this.nearest}); @@ -190,19 +190,19 @@ class Precipitation { Map toJson() { final Map data = new Map(); if (this.local != null) { - data['local'] = this.local.toJson(); + data['local'] = this.local!.toJson(); } if (this.nearest != null) { - data['nearest'] = this.nearest.toJson(); + data['nearest'] = this.nearest!.toJson(); } return data; } } class Local { - String status; - String datasource; - num numensity; + String? status; + String? datasource; + num? numensity; Local({this.status, this.datasource, this.numensity}); @@ -222,9 +222,9 @@ class Local { } class Nearest { - String status; - num distance; - num numensity; + String? status; + num? distance; + num? numensity; Nearest({this.status, this.distance, this.numensity}); @@ -244,14 +244,14 @@ class Nearest { } class AirQuality { - num pm25; - num pm10; - num o3; - num so2; - num no2; - num co; - Aqi aqi; - Description description; + num? pm25; + num? pm10; + num? o3; + num? so2; + num? no2; + num? co; + Aqi? aqi; + Description? description; AirQuality( {this.pm25, @@ -285,18 +285,18 @@ class AirQuality { data['no2'] = this.no2; data['co'] = this.co; if (this.aqi != null) { - data['aqi'] = this.aqi.toJson(); + data['aqi'] = this.aqi!.toJson(); } if (this.description != null) { - data['description'] = this.description.toJson(); + data['description'] = this.description!.toJson(); } return data; } } class Aqi { - num chn; - num usa; + num? chn; + num? usa; Aqi({this.chn, this.usa}); @@ -314,8 +314,8 @@ class Aqi { } class Description { - String usa; - String chn; + String? usa; + String? chn; Description({this.usa, this.chn}); @@ -333,8 +333,8 @@ class Description { } class LifeIndex { - Ultraviolet ultraviolet; - Ultraviolet comfort; + Ultraviolet? ultraviolet; + Ultraviolet? comfort; LifeIndex({this.ultraviolet, this.comfort}); @@ -350,18 +350,18 @@ class LifeIndex { Map toJson() { final Map data = new Map(); if (this.ultraviolet != null) { - data['ultraviolet'] = this.ultraviolet.toJson(); + data['ultraviolet'] = this.ultraviolet!.toJson(); } if (this.comfort != null) { - data['comfort'] = this.comfort.toJson(); + data['comfort'] = this.comfort!.toJson(); } return data; } } class Ultraviolet { - num index; - String desc; + num? index; + String? desc; Ultraviolet({this.index, this.desc}); diff --git a/lib/model/community/activity_detail_model.dart b/lib/model/community/activity_detail_model.dart index 3b7bcb22..c803ff93 100644 --- a/lib/model/community/activity_detail_model.dart +++ b/lib/model/community/activity_detail_model.dart @@ -3,20 +3,20 @@ import 'package:flustars/flustars.dart'; import 'package:aku_community/model/common/img_model.dart'; class ActivityDetailModel { - int id; - String title; - String content; - String location; - String activityStartTime; - String activityEndTime; - String registrationEndTime; - int countRegistration; - List imgUrls; - List headImgURls; + int? id; + String? title; + String? content; + String? location; + String? activityStartTime; + String? activityEndTime; + String? registrationEndTime; + int? countRegistration; + List? imgUrls; + List? headImgURls; - DateTime get startDate => DateUtil.getDateTime(activityStartTime); - DateTime get endDate => DateUtil.getDateTime(activityEndTime); - DateTime get registEndDate => DateUtil.getDateTime(registrationEndTime); + DateTime? get startDate => DateUtil.getDateTime(activityStartTime!); + DateTime? get endDate => DateUtil.getDateTime(activityEndTime!); + DateTime? get registEndDate => DateUtil.getDateTime(registrationEndTime!); ActivityDetailModel( {this.id, @@ -42,14 +42,14 @@ class ActivityDetailModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } else imgUrls = []; if (json['headImgURls'] != null) { headImgURls = []; json['headImgURls'].forEach((v) { - headImgURls.add(new ImgModel.fromJson(v)); + headImgURls!.add(new ImgModel.fromJson(v)); }); } else headImgURls = []; @@ -66,10 +66,10 @@ class ActivityDetailModel { data['registrationEndTime'] = this.registrationEndTime; data['countRegistration'] = this.countRegistration; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } if (this.headImgURls != null) { - data['headImgURls'] = this.headImgURls.map((v) => v.toJson()).toList(); + data['headImgURls'] = this.headImgURls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/community/activity_item_model.dart b/lib/model/community/activity_item_model.dart index 3ae50a5a..8d3e8fd8 100644 --- a/lib/model/community/activity_item_model.dart +++ b/lib/model/community/activity_item_model.dart @@ -3,17 +3,17 @@ import 'package:flustars/flustars.dart'; import 'package:aku_community/model/common/img_model.dart'; class ActivityItemModel { - int id; - String title; - String location; - int status; - String registrationStartTime; - String registrationEndTime; - List imgUrls; - List headImgURls; + int? id; + String? title; + String? location; + int? status; + String? registrationStartTime; + String? registrationEndTime; + List? imgUrls; + List? headImgURls; - DateTime get begin => DateUtil.getDateTime(registrationStartTime); - DateTime get end => DateUtil.getDateTime(registrationEndTime); + DateTime? get begin => DateUtil.getDateTime(registrationStartTime!); + DateTime? get end => DateUtil.getDateTime(registrationEndTime!); ActivityItemModel( {this.id, @@ -35,7 +35,7 @@ class ActivityItemModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } else { imgUrls = []; @@ -43,7 +43,7 @@ class ActivityItemModel { if (json['headImgURls'] != null) { headImgURls = []; json['headImgURls'].forEach((v) { - headImgURls.add(new ImgModel.fromJson(v)); + headImgURls!.add(new ImgModel.fromJson(v)); }); } else { headImgURls = []; @@ -59,10 +59,10 @@ class ActivityItemModel { data['registrationStartTime'] = this.registrationStartTime; data['registrationEndTime'] = this.registrationEndTime; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } if (this.headImgURls != null) { - data['headImgURls'] = this.headImgURls.map((v) => v.toJson()).toList(); + data['headImgURls'] = this.headImgURls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/community/activity_people_model.dart b/lib/model/community/activity_people_model.dart index 5adf640c..63fa1b4f 100644 --- a/lib/model/community/activity_people_model.dart +++ b/lib/model/community/activity_people_model.dart @@ -1,10 +1,10 @@ import 'package:aku_community/model/common/img_model.dart'; class ActivityPeopleModel { - int id; - String name; - String tel; - List imgUrl; + int? id; + String? name; + String? tel; + List? imgUrl; ActivityPeopleModel({this.id, this.name, this.tel, this.imgUrl}); @@ -15,7 +15,7 @@ class ActivityPeopleModel { if (json['imgUrl'] != null) { imgUrl = []; json['imgUrl'].forEach((v) { - imgUrl.add(new ImgModel.fromJson(v)); + imgUrl!.add(new ImgModel.fromJson(v)); }); } } @@ -26,7 +26,7 @@ class ActivityPeopleModel { data['name'] = this.name; data['tel'] = this.tel; if (this.imgUrl != null) { - data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); + data['imgUrl'] = this.imgUrl!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/community/board_detail_model.dart b/lib/model/community/board_detail_model.dart index 08b9be59..809e2e19 100644 --- a/lib/model/community/board_detail_model.dart +++ b/lib/model/community/board_detail_model.dart @@ -1,13 +1,13 @@ import 'package:aku_community/model/common/img_model.dart'; class BoardDetailModel { - int id; - String title; - String content; - String fileDocUrl; - String fileDocName; - String releaseTime; - List imgUrls; + int? id; + String? title; + String? content; + String? fileDocUrl; + String? fileDocName; + String? releaseTime; + List? imgUrls; BoardDetailModel( {this.id, @@ -28,7 +28,7 @@ class BoardDetailModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } } @@ -42,7 +42,7 @@ class BoardDetailModel { data['fileDocName'] = this.fileDocName; data['releaseTime'] = this.releaseTime; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/community/board_model.dart b/lib/model/community/board_model.dart index d8b53282..eff340f6 100644 --- a/lib/model/community/board_model.dart +++ b/lib/model/community/board_model.dart @@ -3,12 +3,12 @@ import 'package:flustars/flustars.dart'; import 'package:aku_community/model/common/img_model.dart'; class BoardItemModel { - int id; - String title; - String releaseTime; - List imgUrls; + int? id; + String? title; + String? releaseTime; + List? imgUrls; - DateTime get releaseDate => DateUtil.getDateTime(releaseTime); + DateTime? get releaseDate => DateUtil.getDateTime(releaseTime!); BoardItemModel({this.id, this.title, this.releaseTime, this.imgUrls}); @@ -19,7 +19,7 @@ class BoardItemModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } } @@ -30,7 +30,7 @@ class BoardItemModel { data['title'] = this.title; data['releaseTime'] = this.releaseTime; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/community/community_topic_model.dart b/lib/model/community/community_topic_model.dart index ef828740..61678608 100644 --- a/lib/model/community/community_topic_model.dart +++ b/lib/model/community/community_topic_model.dart @@ -1,12 +1,12 @@ import 'package:aku_community/model/common/img_model.dart'; class CommunityTopicModel { - int id; - String title; - String summary; - String content; - List imgUrl; - int activityNum; + int? id; + String? title; + String? summary; + String? content; + List? imgUrl; + int? activityNum; CommunityTopicModel( {this.id, @@ -24,7 +24,7 @@ class CommunityTopicModel { if (json['imgUrl'] != null) { imgUrl = []; json['imgUrl'].forEach((v) { - imgUrl.add(new ImgModel.fromJson(v)); + imgUrl!.add(new ImgModel.fromJson(v)); }); } else imgUrl = []; @@ -38,7 +38,7 @@ class CommunityTopicModel { data['summary'] = this.summary; data['content'] = this.content; if (this.imgUrl != null) { - data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); + data['imgUrl'] = this.imgUrl!.map((v) => v.toJson()).toList(); } data['activityNum'] = this.activityNum; return data; diff --git a/lib/model/community/event_item_model.dart b/lib/model/community/event_item_model.dart index e0752f36..d68c9f50 100644 --- a/lib/model/community/event_item_model.dart +++ b/lib/model/community/event_item_model.dart @@ -3,19 +3,19 @@ import 'package:flustars/flustars.dart'; import 'package:aku_community/model/common/img_model.dart'; class EventItemModel { - int id; - int createId; - int isComment; - int isLike; - String createName; - String content; - String gambitTitle; - String createDate; - List likeNames; - List imgUrls; - List headSculptureImgUrl; - List gambitThemeCommentVoList; - DateTime get date => DateUtil.getDateTime(createDate); + int? id; + int? createId; + int? isComment; + int? isLike; + String? createName; + String? content; + String? gambitTitle; + String? createDate; + List? likeNames; + List? imgUrls; + List? headSculptureImgUrl; + List? gambitThemeCommentVoList; + DateTime? get date => DateUtil.getDateTime(createDate!); EventItemModel( {this.id, this.createId, @@ -42,28 +42,28 @@ class EventItemModel { if (json['likeNames'] != null) { likeNames = []; json['likeNames'].forEach((v) { - likeNames.add(new LikeNames.fromJson(v)); + likeNames!.add(new LikeNames.fromJson(v)); }); } else likeNames = []; if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } else imgUrls = []; if (json['headSculptureImgUrl'] != null) { headSculptureImgUrl = []; json['headSculptureImgUrl'].forEach((v) { - headSculptureImgUrl.add(new ImgModel.fromJson(v)); + headSculptureImgUrl!.add(new ImgModel.fromJson(v)); }); } else headSculptureImgUrl = []; if (json['gambitThemeCommentVoList'] != null) { gambitThemeCommentVoList = []; json['gambitThemeCommentVoList'].forEach((v) { - gambitThemeCommentVoList.add(new GambitThemeCommentVoList.fromJson(v)); + gambitThemeCommentVoList!.add(new GambitThemeCommentVoList.fromJson(v)); }); } else gambitThemeCommentVoList = []; @@ -80,26 +80,26 @@ class EventItemModel { data['gambitTitle'] = this.gambitTitle; data['createDate'] = this.createDate; if (this.likeNames != null) { - data['likeNames'] = this.likeNames.map((v) => v.toJson()).toList(); + data['likeNames'] = this.likeNames!.map((v) => v.toJson()).toList(); } if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } if (this.headSculptureImgUrl != null) { data['headSculptureImgUrl'] = - this.headSculptureImgUrl.map((v) => v.toJson()).toList(); + this.headSculptureImgUrl!.map((v) => v.toJson()).toList(); } if (this.gambitThemeCommentVoList != null) { data['gambitThemeCommentVoList'] = - this.gambitThemeCommentVoList.map((v) => v.toJson()).toList(); + this.gambitThemeCommentVoList!.map((v) => v.toJson()).toList(); } return data; } } class LikeNames { - int id; - String name; + int? id; + String? name; LikeNames({this.id, this.name}); @@ -117,11 +117,11 @@ class LikeNames { } class GambitThemeCommentVoList { - int id; - String parentName; - String content; - String createName; - String createDate; + int? id; + String? parentName; + String? content; + String? createName; + String? createDate; GambitThemeCommentVoList( {this.id, diff --git a/lib/model/community/hot_topic_model.dart b/lib/model/community/hot_topic_model.dart index 4bb0f456..960c9c1a 100644 --- a/lib/model/community/hot_topic_model.dart +++ b/lib/model/community/hot_topic_model.dart @@ -1,6 +1,6 @@ class HotTopicModel { - int id; - String name; + int? id; + String? name; HotTopicModel({this.id, this.name}); diff --git a/lib/model/community/my_event_item_model.dart b/lib/model/community/my_event_item_model.dart index 168d52c6..b51858d7 100644 --- a/lib/model/community/my_event_item_model.dart +++ b/lib/model/community/my_event_item_model.dart @@ -3,12 +3,12 @@ import 'package:flustars/flustars.dart'; import 'package:aku_community/model/common/img_model.dart'; class MyEventItemModel { - int id; - String content; - List imgUrl; - String createDate; + int? id; + String? content; + List? imgUrl; + String? createDate; - DateTime get date => DateUtil.getDateTime(createDate); + DateTime? get date => DateUtil.getDateTime(createDate!); MyEventItemModel({this.id, this.content, this.imgUrl, this.createDate}); @@ -18,7 +18,7 @@ class MyEventItemModel { if (json['imgUrl'] != null) { imgUrl = []; json['imgUrl'].forEach((v) { - imgUrl.add(new ImgModel.fromJson(v)); + imgUrl!.add(new ImgModel.fromJson(v)); }); } else imgUrl = []; @@ -30,7 +30,7 @@ class MyEventItemModel { data['id'] = this.id; data['content'] = this.content; if (this.imgUrl != null) { - data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); + data['imgUrl'] = this.imgUrl!.map((v) => v.toJson()).toList(); } data['createDate'] = this.createDate; return data; diff --git a/lib/model/manager/advice_detail_model.dart b/lib/model/manager/advice_detail_model.dart index baba22a7..796f592d 100644 --- a/lib/model/manager/advice_detail_model.dart +++ b/lib/model/manager/advice_detail_model.dart @@ -3,7 +3,7 @@ import 'package:flustars/flustars.dart'; import 'package:aku_community/model/common/img_model.dart'; class AdviceDetailModel { - AppAdviceDetailVo appAdviceDetailVo; + AppAdviceDetailVo? appAdviceDetailVo; AdviceDetailModel({this.appAdviceDetailVo}); @@ -16,15 +16,15 @@ class AdviceDetailModel { Map toJson() { final Map data = new Map(); if (this.appAdviceDetailVo != null) { - data['appAdviceDetailVo'] = this.appAdviceDetailVo.toJson(); + data['appAdviceDetailVo'] = this.appAdviceDetailVo!.toJson(); } return data; } } class AppAdviceDetailVo { - AppAdviceVo appAdviceVo; - List appAdviceContentVos; + AppAdviceVo? appAdviceVo; + List? appAdviceContentVos; AppAdviceDetailVo({this.appAdviceVo, this.appAdviceContentVos}); @@ -35,7 +35,7 @@ class AppAdviceDetailVo { if (json['appAdviceContentVos'] != null) { appAdviceContentVos = []; json['appAdviceContentVos'].forEach((v) { - appAdviceContentVos.add(new AppAdviceContentVos.fromJson(v)); + appAdviceContentVos!.add(new AppAdviceContentVos.fromJson(v)); }); } } @@ -43,25 +43,25 @@ class AppAdviceDetailVo { Map toJson() { final Map data = new Map(); if (this.appAdviceVo != null) { - data['appAdviceVo'] = this.appAdviceVo.toJson(); + data['appAdviceVo'] = this.appAdviceVo!.toJson(); } if (this.appAdviceContentVos != null) { data['appAdviceContentVos'] = - this.appAdviceContentVos.map((v) => v.toJson()).toList(); + this.appAdviceContentVos!.map((v) => v.toJson()).toList(); } return data; } } class AppAdviceVo { - int id; - int type; - int status; - String content; - String createDate; - List imgUrls; + int? id; + int? type; + int? status; + String? content; + String? createDate; + List? imgUrls; - DateTime get date => DateUtil.getDateTime(createDate); + DateTime? get date => DateUtil.getDateTime(createDate!); AppAdviceVo( {this.id, @@ -80,7 +80,7 @@ class AppAdviceVo { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } } @@ -93,18 +93,18 @@ class AppAdviceVo { data['content'] = this.content; data['createDate'] = this.createDate; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } } class AppAdviceContentVos { - int id; - int createUserType; - String content; - String createDate; - int parentId; + int? id; + int? createUserType; + String? content; + String? createDate; + int? parentId; AppAdviceContentVos( {this.id, @@ -113,7 +113,7 @@ class AppAdviceContentVos { this.createDate, this.parentId}); - DateTime get date => DateUtil.getDateTime(createDate); + DateTime? get date => DateUtil.getDateTime(createDate!); AppAdviceContentVos.fromJson(Map json) { id = json['id']; diff --git a/lib/model/manager/article_QR_code_model.dart b/lib/model/manager/article_QR_code_model.dart index c38f285a..22ee7e11 100644 --- a/lib/model/manager/article_QR_code_model.dart +++ b/lib/model/manager/article_QR_code_model.dart @@ -1,7 +1,7 @@ class ArticleQRModel { - AppArticleOutQRCodeVo appArticleOutQRCodeVo; - String message; - bool status; + AppArticleOutQRCodeVo? appArticleOutQRCodeVo; + String? message; + bool? status; ArticleQRModel({this.appArticleOutQRCodeVo, this.message, this.status}); @@ -16,7 +16,7 @@ class ArticleQRModel { Map toJson() { final Map data = new Map(); if (this.appArticleOutQRCodeVo != null) { - data['appArticleOutQRCodeVo'] = this.appArticleOutQRCodeVo.toJson(); + data['appArticleOutQRCodeVo'] = this.appArticleOutQRCodeVo!.toJson(); } data['message'] = this.message; data['status'] = this.status; @@ -25,11 +25,11 @@ class ArticleQRModel { } class AppArticleOutQRCodeVo { - int id; - String roomName; - int applicantId; - String applicantName; - String effectiveTime; + int? id; + String? roomName; + int? applicantId; + String? applicantName; + String? effectiveTime; AppArticleOutQRCodeVo( {this.id, diff --git a/lib/model/manager/article_borrow_detail_model.dart b/lib/model/manager/article_borrow_detail_model.dart index 2b74b3cc..e4f4ad7f 100644 --- a/lib/model/manager/article_borrow_detail_model.dart +++ b/lib/model/manager/article_borrow_detail_model.dart @@ -1,16 +1,15 @@ import 'package:aku_community/model/common/img_model.dart'; class ArticleBorrowDetailModel { - int id; - String name; - String code; - int status; - List imgList; + int? id; + String? name; + String? code; + int? status; + List? imgList; String get borrowStatus { switch (this.status) { case 1: - return '正常'; - break; + return '正常'; case 2: return '破损'; case 3: @@ -31,7 +30,7 @@ class ArticleBorrowDetailModel { if (json['imgList'] != null) { imgList = []; json['imgList'].forEach((v) { - imgList.add(new ImgModel.fromJson(v)); + imgList!.add(new ImgModel.fromJson(v)); }); } } @@ -43,7 +42,7 @@ class ArticleBorrowDetailModel { data['code'] = this.code; data['status'] = this.status; if (this.imgList != null) { - data['imgList'] = this.imgList.map((v) => v.toJson()).toList(); + data['imgList'] = this.imgList!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/manager/article_borrow_model.dart b/lib/model/manager/article_borrow_model.dart index 05c1cbd6..6a546bcb 100644 --- a/lib/model/manager/article_borrow_model.dart +++ b/lib/model/manager/article_borrow_model.dart @@ -1,10 +1,10 @@ import 'package:aku_community/model/common/img_model.dart'; class ArticleBorrowModel { - int id; - String name; - int quantity; - List imgUrls; + int? id; + String? name; + int? quantity; + List? imgUrls; ArticleBorrowModel({this.id, this.name, this.quantity, this.imgUrls}); @@ -15,7 +15,7 @@ class ArticleBorrowModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } } @@ -26,7 +26,7 @@ class ArticleBorrowModel { data['name'] = this.name; data['quantity'] = this.quantity; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/manager/article_return_list_model.dart b/lib/model/manager/article_return_list_model.dart index deee927d..6d1186ff 100644 --- a/lib/model/manager/article_return_list_model.dart +++ b/lib/model/manager/article_return_list_model.dart @@ -1,15 +1,15 @@ import 'package:aku_community/model/common/img_model.dart'; class ArticleReturnListModel { - int id; - String name; - String code; - String beginDate; - int borrowTime; - List imgList; + int? id; + String? name; + String? code; + String? beginDate; + int? borrowTime; + List? imgList; String get paraseBorrowTime { - if (this.borrowTime > 24) { - return '${this.borrowTime ~/ 24}天${this.borrowTime % 24}小时'; + if (this.borrowTime! > 24) { + return '${this.borrowTime! ~/ 24}天${this.borrowTime! % 24}小时'; } else { return '${this.borrowTime}小时'; } @@ -32,7 +32,7 @@ class ArticleReturnListModel { if (json['imgList'] != null) { imgList = []; json['imgList'].forEach((v) { - imgList.add(new ImgModel.fromJson(v)); + imgList!.add(new ImgModel.fromJson(v)); }); } } @@ -45,18 +45,18 @@ class ArticleReturnListModel { data['beginDate'] = this.beginDate; data['borrowTime'] = this.borrowTime; if (this.imgList != null) { - data['imgList'] = this.imgList.map((v) => v.toJson()).toList(); + data['imgList'] = this.imgList!.map((v) => v.toJson()).toList(); } return data; } } class ImgList { - String url; - String size; - int longs; - int paragraph; - int sort; + String? url; + String? size; + int? longs; + int? paragraph; + int? sort; ImgList({this.url, this.size, this.longs, this.paragraph, this.sort}); diff --git a/lib/model/manager/article_return_model.dart b/lib/model/manager/article_return_model.dart index f5b15f66..e4f8488c 100644 --- a/lib/model/manager/article_return_model.dart +++ b/lib/model/manager/article_return_model.dart @@ -1,12 +1,12 @@ import 'package:aku_community/model/common/img_model.dart'; class ArticleReturnModel { - int id; - String name; - String code; - String beginDate; - int borrowTime; - List imgList; + int? id; + String? name; + String? code; + String? beginDate; + int? borrowTime; + List? imgList; ArticleReturnModel( {this.id, @@ -25,7 +25,7 @@ class ArticleReturnModel { if (json['imgList'] != null) { imgList = []; json['imgList'].forEach((v) { - imgList.add(new ImgModel.fromJson(v)); + imgList!.add(new ImgModel.fromJson(v)); }); } } @@ -38,18 +38,18 @@ class ArticleReturnModel { data['beginDate'] = this.beginDate; data['borrowTime'] = this.borrowTime; if (this.imgList != null) { - data['imgList'] = this.imgList.map((v) => v.toJson()).toList(); + data['imgList'] = this.imgList!.map((v) => v.toJson()).toList(); } return data; } } class ImgList { - String url; - String size; - int longs; - int paragraph; - int sort; + String? url; + String? size; + int? longs; + int? paragraph; + int? sort; ImgList({this.url, this.size, this.longs, this.paragraph, this.sort}); diff --git a/lib/model/manager/estate_payment_model.dart b/lib/model/manager/estate_payment_model.dart index c0dc312d..44b28e30 100644 --- a/lib/model/manager/estate_payment_model.dart +++ b/lib/model/manager/estate_payment_model.dart @@ -1,7 +1,7 @@ class EstatePaymentModel { - int id; - String roomName; - int status; + int? id; + String? roomName; + int? status; EstatePaymentModel({this.id, this.roomName, this.status}); diff --git a/lib/model/manager/event_voting_model.dart b/lib/model/manager/event_voting_model.dart index af991894..37be6a42 100644 --- a/lib/model/manager/event_voting_model.dart +++ b/lib/model/manager/event_voting_model.dart @@ -1,14 +1,14 @@ import 'package:aku_community/model/common/img_model.dart'; class EventVotingModel { - int id; - String title; - String content; - String beginDate; - String endDate; - int status; - List imgUrls; - List headImgURls; + int? id; + String? title; + String? content; + String? beginDate; + String? endDate; + int? status; + List? imgUrls; + List? headImgURls; EventVotingModel( {this.id, @@ -30,14 +30,14 @@ class EventVotingModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } else imgUrls = []; if (json['headImgURls'] != null) { headImgURls = []; json['headImgURls'].forEach((v) { - headImgURls.add(new ImgModel.fromJson(v)); + headImgURls!.add(new ImgModel.fromJson(v)); }); } else headImgURls = []; @@ -52,21 +52,21 @@ class EventVotingModel { data['endDate'] = this.endDate; data['status'] = this.status; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } if (this.headImgURls != null) { - data['headImgURls'] = this.headImgURls.map((v) => v.toJson()).toList(); + data['headImgURls'] = this.headImgURls!.map((v) => v.toJson()).toList(); } return data; } } class ImgUrls { - String url; - String size; - int longs; - int paragraph; - int sort; + String? url; + String? size; + int? longs; + int? paragraph; + int? sort; ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort}); diff --git a/lib/model/manager/fixed_detail_model.dart b/lib/model/manager/fixed_detail_model.dart index 9cf0d17e..3f2b9a6f 100644 --- a/lib/model/manager/fixed_detail_model.dart +++ b/lib/model/manager/fixed_detail_model.dart @@ -1,10 +1,10 @@ import 'package:aku_community/model/common/img_model.dart'; class FixedDetailModel { - AppReportRepairVo appReportRepairVo; - List appProcessRecordVo; + AppReportRepairVo? appReportRepairVo; + List? appProcessRecordVo; Null appMaintenanceResultVo; - AppDispatchListVo appDispatchListVo; + AppDispatchListVo? appDispatchListVo; FixedDetailModel( {this.appReportRepairVo, @@ -19,7 +19,7 @@ class FixedDetailModel { if (json['appProcessRecordVo'] != null) { appProcessRecordVo = []; json['appProcessRecordVo'].forEach((v) { - appProcessRecordVo.add(new AppProcessRecordVo.fromJson(v)); + appProcessRecordVo!.add(new AppProcessRecordVo.fromJson(v)); }); } appMaintenanceResultVo = json['appMaintenanceResultVo']; @@ -31,26 +31,26 @@ class FixedDetailModel { Map toJson() { final Map data = new Map(); if (this.appReportRepairVo != null) { - data['appReportRepairVo'] = this.appReportRepairVo.toJson(); + data['appReportRepairVo'] = this.appReportRepairVo!.toJson(); } if (this.appProcessRecordVo != null) { data['appProcessRecordVo'] = - this.appProcessRecordVo.map((v) => v.toJson()).toList(); + this.appProcessRecordVo!.map((v) => v.toJson()).toList(); } data['appMaintenanceResultVo'] = this.appMaintenanceResultVo; if (this.appDispatchListVo != null) { - data['appDispatchListVo'] = this.appDispatchListVo.toJson(); + data['appDispatchListVo'] = this.appDispatchListVo!.toJson(); } return data; } } class AppReportRepairVo { - int id; - int type; - int status; - String reportDetail; - List imgUrls; + int? id; + int? type; + int? status; + String? reportDetail; + List? imgUrls; AppReportRepairVo( {this.id, this.type, this.status, this.reportDetail, this.imgUrls}); @@ -63,7 +63,7 @@ class AppReportRepairVo { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } } @@ -75,15 +75,15 @@ class AppReportRepairVo { data['status'] = this.status; data['reportDetail'] = this.reportDetail; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } } class AppProcessRecordVo { - String operationDate; - int operationType; + String? operationDate; + int? operationType; AppProcessRecordVo({this.operationDate, this.operationType}); @@ -101,11 +101,11 @@ class AppProcessRecordVo { } class AppDispatchListVo { - String code; - String orderDate; - int type; - String operatorName; - String distributorName; + String? code; + String? orderDate; + int? type; + String? operatorName; + String? distributorName; AppDispatchListVo( {this.code, diff --git a/lib/model/manager/goods_out_model.dart b/lib/model/manager/goods_out_model.dart index c9eabf4c..5ffc1969 100644 --- a/lib/model/manager/goods_out_model.dart +++ b/lib/model/manager/goods_out_model.dart @@ -1,12 +1,12 @@ class GoodsOutModel { - int id; - String name; - int weight; - String expectedTime; - int approach; - int status; - String movingCompanyTel; - List imgUrl; + int? id; + String? name; + int? weight; + String? expectedTime; + int? approach; + int? status; + String? movingCompanyTel; + List? imgUrl; GoodsOutModel( {this.id, @@ -29,7 +29,7 @@ class GoodsOutModel { if (json['imgUrl'] != null) { imgUrl = []; json['imgUrl'].forEach((v) { - imgUrl.add(new ImgUrl.fromJson(v)); + imgUrl!.add(new ImgUrl.fromJson(v)); }); } } @@ -44,18 +44,18 @@ class GoodsOutModel { data['status'] = this.status; data['movingCompanyTel'] = this.movingCompanyTel; if (this.imgUrl != null) { - data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); + data['imgUrl'] = this.imgUrl!.map((v) => v.toJson()).toList(); } return data; } } class ImgUrl { - String url; - String size; - int longs; - int paragraph; - int sort; + String? url; + String? size; + int? longs; + int? paragraph; + int? sort; ImgUrl({this.url, this.size, this.longs, this.paragraph, this.sort}); diff --git a/lib/model/manager/life_pay_model.dart b/lib/model/manager/life_pay_model.dart index 712face5..01bc0a59 100644 --- a/lib/model/manager/life_pay_model.dart +++ b/lib/model/manager/life_pay_model.dart @@ -1,7 +1,7 @@ class LifePayModel { - int years; - int paymentNum; - List dailyPaymentTypeVos; + int? years; + int? paymentNum; + List? dailyPaymentTypeVos; LifePayModel({this.years, this.paymentNum, this.dailyPaymentTypeVos}); @@ -11,7 +11,7 @@ class LifePayModel { if (json['dailyPaymentTypeVos'] != null) { dailyPaymentTypeVos = []; json['dailyPaymentTypeVos'].forEach((v) { - dailyPaymentTypeVos.add(new DailyPaymentTypeVos.fromJson(v)); + dailyPaymentTypeVos!.add(new DailyPaymentTypeVos.fromJson(v)); }); } } @@ -22,16 +22,16 @@ class LifePayModel { data['paymentNum'] = this.paymentNum; if (this.dailyPaymentTypeVos != null) { data['dailyPaymentTypeVos'] = - this.dailyPaymentTypeVos.map((v) => v.toJson()).toList(); + this.dailyPaymentTypeVos!.map((v) => v.toJson()).toList(); } return data; } } class DailyPaymentTypeVos { - int id; - String name; - List detailedVoList; + int? id; + String? name; + List? detailedVoList; DailyPaymentTypeVos({this.id, this.name, this.detailedVoList}); @@ -41,7 +41,7 @@ class DailyPaymentTypeVos { if (json['detailedVoList'] != null) { detailedVoList = []; json['detailedVoList'].forEach((v) { - detailedVoList.add(new DetailedVoList.fromJson(v)); + detailedVoList!.add(new DetailedVoList.fromJson(v)); }); } } @@ -52,16 +52,16 @@ class DailyPaymentTypeVos { data['name'] = this.name; if (this.detailedVoList != null) { data['detailedVoList'] = - this.detailedVoList.map((v) => v.toJson()).toList(); + this.detailedVoList!.map((v) => v.toJson()).toList(); } return data; } } class DetailedVoList { - int groupId; - double paymentPrice; - List detailsVoList; + int? groupId; + double? paymentPrice; + List? detailsVoList; DetailedVoList({this.groupId, this.paymentPrice, this.detailsVoList}); @@ -71,7 +71,7 @@ class DetailedVoList { if (json['detailsVoList'] != null) { detailsVoList = []; json['detailsVoList'].forEach((v) { - detailsVoList.add(new DetailsVoList.fromJson(v)); + detailsVoList!.add(new DetailsVoList.fromJson(v)); }); } } @@ -82,22 +82,22 @@ class DetailedVoList { data['paymentPrice'] = this.paymentPrice; if (this.detailsVoList != null) { data['detailsVoList'] = - this.detailsVoList.map((v) => v.toJson()).toList(); + this.detailsVoList!.map((v) => v.toJson()).toList(); } return data; } } class DetailsVoList { - int id; - String month; - double costPrice; - double paidPrice; - double totalPrice; - String beginDate; - String endDate; - String unitPriceType; - int num; + int? id; + String? month; + double? costPrice; + double? paidPrice; + double? totalPrice; + String? beginDate; + String? endDate; + String? unitPriceType; + int? num; DetailsVoList( {this.id, diff --git a/lib/model/manager/life_pay_record_model.dart b/lib/model/manager/life_pay_record_model.dart index fea38101..aaec4893 100644 --- a/lib/model/manager/life_pay_record_model.dart +++ b/lib/model/manager/life_pay_record_model.dart @@ -1,12 +1,12 @@ class LifePayRecordModel { - int id; - String chargesTemplateDetailName; - String roomName; - String years; - int paidPrice; - String createDate; - int payType; - String code; + int? id; + String? chargesTemplateDetailName; + String? roomName; + String? years; + int? paidPrice; + String? createDate; + int? payType; + String? code; LifePayRecordModel( {this.id, diff --git a/lib/model/manager/mine_goods_model.dart b/lib/model/manager/mine_goods_model.dart index 6f77f281..9541d352 100644 --- a/lib/model/manager/mine_goods_model.dart +++ b/lib/model/manager/mine_goods_model.dart @@ -1,11 +1,11 @@ class MineGoodsModel { - int id; - String name; - int code; - String beginDate; - String endDate; - int borrowDate; - int borrowStatus; + int? id; + String? name; + int? code; + String? beginDate; + String? endDate; + int? borrowDate; + int? borrowStatus; MineGoodsModel( {this.id, diff --git a/lib/model/manager/moving_company_model.dart b/lib/model/manager/moving_company_model.dart index 18ef626a..8a3ea1d4 100644 --- a/lib/model/manager/moving_company_model.dart +++ b/lib/model/manager/moving_company_model.dart @@ -1,5 +1,5 @@ class MovingCompanyModel { - List appMovingCompanyVoList; + List? appMovingCompanyVoList; MovingCompanyModel({this.appMovingCompanyVoList}); @@ -7,7 +7,7 @@ class MovingCompanyModel { if (json['appMovingCompanyVoList'] != null) { appMovingCompanyVoList = []; json['appMovingCompanyVoList'].forEach((v) { - appMovingCompanyVoList.add(new AppMovingCompanyVoList.fromJson(v)); + appMovingCompanyVoList!.add(new AppMovingCompanyVoList.fromJson(v)); }); } } @@ -16,15 +16,15 @@ class MovingCompanyModel { final Map data = new Map(); if (this.appMovingCompanyVoList != null) { data['appMovingCompanyVoList'] = - this.appMovingCompanyVoList.map((v) => v.toJson()).toList(); + this.appMovingCompanyVoList!.map((v) => v.toJson()).toList(); } return data; } } class AppMovingCompanyVoList { - String name; - String tel; + String? name; + String? tel; AppMovingCompanyVoList({this.name, this.tel}); diff --git a/lib/model/manager/questinnaire_model.dart b/lib/model/manager/questinnaire_model.dart index 2a5c49ef..03ea5d81 100644 --- a/lib/model/manager/questinnaire_model.dart +++ b/lib/model/manager/questinnaire_model.dart @@ -1,15 +1,15 @@ import 'package:aku_community/model/common/img_model.dart'; class QuestionnaireModel { - int id; - String title; - String description; - String beginDate; - String endDate; - int status; - int answerNum; - List imgUrls; - List headImgURls; + int? id; + String? title; + String? description; + String? beginDate; + String? endDate; + int? status; + int? answerNum; + List? imgUrls; + List? headImgURls; QuestionnaireModel( {this.id, @@ -33,14 +33,14 @@ class QuestionnaireModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } else imgUrls = []; if (json['headImgURls'] != null) { headImgURls = []; json['headImgURls'].forEach((v) { - headImgURls.add(new ImgModel.fromJson(v)); + headImgURls!.add(new ImgModel.fromJson(v)); }); } else headImgURls = []; @@ -56,21 +56,21 @@ class QuestionnaireModel { data['status'] = this.status; data['answerNum'] = this.answerNum; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } if (this.headImgURls != null) { - data['headImgURls'] = this.headImgURls.map((v) => v.toJson()).toList(); + data['headImgURls'] = this.headImgURls!.map((v) => v.toJson()).toList(); } return data; } } class ImgUrls { - String url; - String size; - int longs; - int paragraph; - int sort; + String? url; + String? size; + int? longs; + int? paragraph; + int? sort; ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort}); diff --git a/lib/model/manager/questionnaire_detail_model.dart b/lib/model/manager/questionnaire_detail_model.dart index c1e9b572..9162ad03 100644 --- a/lib/model/manager/questionnaire_detail_model.dart +++ b/lib/model/manager/questionnaire_detail_model.dart @@ -1,13 +1,13 @@ import 'package:aku_community/model/common/img_model.dart'; class QuestionnaireDetialModel { - int id; - String title; - String description; - String beginDate; - String endDate; - List questionnaireTopicVoList; - List voResourcesImgList; + int? id; + String? title; + String? description; + String? beginDate; + String? endDate; + List? questionnaireTopicVoList; + List? voResourcesImgList; QuestionnaireDetialModel( {this.id, @@ -27,13 +27,13 @@ class QuestionnaireDetialModel { if (json['questionnaireTopicVoList'] != null) { questionnaireTopicVoList = []; json['questionnaireTopicVoList'].forEach((v) { - questionnaireTopicVoList.add(new QuestionnaireTopicVoList.fromJson(v)); + questionnaireTopicVoList!.add(new QuestionnaireTopicVoList.fromJson(v)); }); } if (json['voResourcesImgList'] != null) { voResourcesImgList = []; json['voResourcesImgList'].forEach((v) { - voResourcesImgList.add(new ImgModel.fromJson(v)); + voResourcesImgList!.add(new ImgModel.fromJson(v)); }); } else voResourcesImgList = []; @@ -48,21 +48,21 @@ class QuestionnaireDetialModel { data['endDate'] = this.endDate; if (this.questionnaireTopicVoList != null) { data['questionnaireTopicVoList'] = - this.questionnaireTopicVoList.map((v) => v.toJson()).toList(); + this.questionnaireTopicVoList!.map((v) => v.toJson()).toList(); } if (this.voResourcesImgList != null) { data['voResourcesImgList'] = - this.voResourcesImgList.map((v) => v.toJson()).toList(); + this.voResourcesImgList!.map((v) => v.toJson()).toList(); } return data; } } class QuestionnaireTopicVoList { - int id; - int type; - String topic; - List questionnaireChoiceVoList; + int? id; + int? type; + String? topic; + List? questionnaireChoiceVoList; QuestionnaireTopicVoList( {this.id, this.type, this.topic, this.questionnaireChoiceVoList}); @@ -74,7 +74,7 @@ class QuestionnaireTopicVoList { if (json['questionnaireChoiceVoList'] != null) { questionnaireChoiceVoList = []; json['questionnaireChoiceVoList'].forEach((v) { - questionnaireChoiceVoList + questionnaireChoiceVoList! .add(new QuestionnaireChoiceVoList.fromJson(v)); }); } else @@ -88,7 +88,7 @@ class QuestionnaireTopicVoList { data['topic'] = this.topic; if (this.questionnaireChoiceVoList != null) { data['questionnaireChoiceVoList'] = - this.questionnaireChoiceVoList.map((v) => v.toJson()).toList(); + this.questionnaireChoiceVoList!.map((v) => v.toJson()).toList(); } else questionnaireChoiceVoList = []; return data; @@ -96,9 +96,9 @@ class QuestionnaireTopicVoList { } class QuestionnaireChoiceVoList { - int id; - String options; - String answer; + int? id; + String? options; + String? answer; QuestionnaireChoiceVoList({this.id, this.options, this.answer}); diff --git a/lib/model/manager/quetionnaire_submit_model.dart b/lib/model/manager/quetionnaire_submit_model.dart index 61537600..770c385a 100644 --- a/lib/model/manager/quetionnaire_submit_model.dart +++ b/lib/model/manager/quetionnaire_submit_model.dart @@ -1,6 +1,6 @@ class QuestionnaireSubmitModel { - int id; - List appQuestionnaireAnswerSubmits; + int? id; + List? appQuestionnaireAnswerSubmits; QuestionnaireSubmitModel({this.id, this.appQuestionnaireAnswerSubmits}); @@ -9,7 +9,7 @@ class QuestionnaireSubmitModel { if (json['appQuestionnaireAnswerSubmits'] != null) { appQuestionnaireAnswerSubmits = []; json['appQuestionnaireAnswerSubmits'].forEach((v) { - appQuestionnaireAnswerSubmits + appQuestionnaireAnswerSubmits! .add(new AppQuestionnaireAnswerSubmits.fromJson(v)); }); } @@ -20,16 +20,16 @@ class QuestionnaireSubmitModel { data['id'] = this.id; if (this.appQuestionnaireAnswerSubmits != null) { data['appQuestionnaireAnswerSubmits'] = - this.appQuestionnaireAnswerSubmits.map((v) => v.toJson()).toList(); + this.appQuestionnaireAnswerSubmits!.map((v) => v.toJson()).toList(); } return data; } } class AppQuestionnaireAnswerSubmits { - int topicId; - List choiceAnswer; - String shortAnswer; + int? topicId; + List? choiceAnswer; + String? shortAnswer; AppQuestionnaireAnswerSubmits( {this.topicId, this.choiceAnswer, this.shortAnswer}); diff --git a/lib/model/manager/suggestion_or_complain_model.dart b/lib/model/manager/suggestion_or_complain_model.dart index d0c7033c..c102270c 100644 --- a/lib/model/manager/suggestion_or_complain_model.dart +++ b/lib/model/manager/suggestion_or_complain_model.dart @@ -3,13 +3,13 @@ import 'package:flustars/flustars.dart'; import 'package:aku_community/model/common/img_model.dart'; class SuggestionOrComplainModel { - int id; - int type; - int status; - String content; - int score; - DateTime createDate; - List imgUrls; + int? id; + int? type; + int? status; + String? content; + int? score; + DateTime? createDate; + List? imgUrls; SuggestionOrComplainModel( {this.id, @@ -30,18 +30,18 @@ class SuggestionOrComplainModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } } } class ImgUrls { - String url; - String size; - int longs; - int paragraph; - int sort; + String? url; + String? size; + int? longs; + int? paragraph; + int? sort; ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort}); diff --git a/lib/model/manager/visitor_list_item_model.dart b/lib/model/manager/visitor_list_item_model.dart index c09ed8f4..a4573aa0 100644 --- a/lib/model/manager/visitor_list_item_model.dart +++ b/lib/model/manager/visitor_list_item_model.dart @@ -1,15 +1,15 @@ import 'package:flustars/flustars.dart'; class VisitorListItemModel { - int id; - int accessCode; - int visitorStatus; - String name; - int isDrive; - String carNum; - String effectiveTime; + int? id; + int? accessCode; + int? visitorStatus; + String? name; + int? isDrive; + String? carNum; + String? effectiveTime; - DateTime get date => DateUtil.getDateTime(effectiveTime); + DateTime? get date => DateUtil.getDateTime(effectiveTime!); bool get drive => isDrive == 1; VisitorListItemModel( diff --git a/lib/model/manager/voting_detail_model.dart b/lib/model/manager/voting_detail_model.dart index 7b04fdc4..9515dd90 100644 --- a/lib/model/manager/voting_detail_model.dart +++ b/lib/model/manager/voting_detail_model.dart @@ -1,13 +1,13 @@ import 'package:aku_community/model/common/img_model.dart'; class VotingDetailModel { - int id; - String title; - String content; - int status; - int totals; - List imgUrls; - List appVoteCandidateVos; + int? id; + String? title; + String? content; + int? status; + int? totals; + List? imgUrls; + List? appVoteCandidateVos; VotingDetailModel( {this.id, @@ -27,14 +27,14 @@ class VotingDetailModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } else imgUrls = []; if (json['appVoteCandidateVos'] != null) { appVoteCandidateVos = []; json['appVoteCandidateVos'].forEach((v) { - appVoteCandidateVos.add(new AppVoteCandidateVos.fromJson(v)); + appVoteCandidateVos!.add(new AppVoteCandidateVos.fromJson(v)); }); } } @@ -47,22 +47,22 @@ class VotingDetailModel { data['status'] = this.status; data['totals'] = this.totals; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } if (this.appVoteCandidateVos != null) { data['appVoteCandidateVos'] = - this.appVoteCandidateVos.map((v) => v.toJson()).toList(); + this.appVoteCandidateVos!.map((v) => v.toJson()).toList(); } return data; } } class ImgUrls { - String url; - String size; - int longs; - int paragraph; - int sort; + String? url; + String? size; + int? longs; + int? paragraph; + int? sort; ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort}); @@ -86,10 +86,10 @@ class ImgUrls { } class AppVoteCandidateVos { - int id; - String name; - int total; - List imgUrls; + int? id; + String? name; + int? total; + List? imgUrls; AppVoteCandidateVos({this.id, this.name, this.total, this.imgUrls}); @@ -100,7 +100,7 @@ class AppVoteCandidateVos { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } else imgUrls = []; @@ -112,7 +112,7 @@ class AppVoteCandidateVos { data['name'] = this.name; data['total'] = this.total; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/message/comment_message_model.dart b/lib/model/message/comment_message_model.dart index 46ee7235..285dd4c6 100644 --- a/lib/model/message/comment_message_model.dart +++ b/lib/model/message/comment_message_model.dart @@ -1,17 +1,17 @@ import 'package:aku_community/model/common/img_model.dart'; class CommentMessageModel { - int id; - int gambitThemeId; - String respondentName; - int type; - String content; - int receiverAccount; - int sendStatus; - String createName; - String createDate; - List imgUrls; - List headSculpture; + int? id; + int? gambitThemeId; + String? respondentName; + int? type; + String? content; + int? receiverAccount; + int? sendStatus; + String? createName; + String? createDate; + List? imgUrls; + List? headSculpture; CommentMessageModel( {this.id, @@ -39,13 +39,13 @@ class CommentMessageModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } if (json['headSculpture'] != null) { headSculpture = []; json['headSculpture'].forEach((v) { - headSculpture.add(new ImgModel.fromJson(v)); + headSculpture!.add(new ImgModel.fromJson(v)); }); } } @@ -62,7 +62,7 @@ class CommentMessageModel { data['createName'] = this.createName; data['createDate'] = this.createDate; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/message/message_center_model.dart b/lib/model/message/message_center_model.dart index affd4a98..f0a46eb9 100644 --- a/lib/model/message/message_center_model.dart +++ b/lib/model/message/message_center_model.dart @@ -1,8 +1,8 @@ class MessageCenterModel { - String commentTitle; - int sysCount; - String sysTitle; - int commentCount; + String? commentTitle; + int? sysCount; + String? sysTitle; + int? commentCount; MessageCenterModel.zero() { commentTitle = ''; diff --git a/lib/model/message/system_message_detail_model.dart b/lib/model/message/system_message_detail_model.dart index 58bc8b24..602e0e87 100644 --- a/lib/model/message/system_message_detail_model.dart +++ b/lib/model/message/system_message_detail_model.dart @@ -1,7 +1,7 @@ class SystemMessageDetailModel { - int id; - String title; - String content; + int? id; + String? title; + String? content; SystemMessageDetailModel({this.id, this.title, this.content}); diff --git a/lib/model/message/system_message_model.dart b/lib/model/message/system_message_model.dart index d13123d3..72c39ee8 100644 --- a/lib/model/message/system_message_model.dart +++ b/lib/model/message/system_message_model.dart @@ -1,8 +1,8 @@ class SystemMessageModel { - int id; - String content; - int status; - String title; + int? id; + String? content; + int? status; + String? title; SystemMessageModel({this.id, this.content, this.status, this.title}); diff --git a/lib/model/user/car_parking_model.dart b/lib/model/user/car_parking_model.dart index cd50d58c..321adb80 100644 --- a/lib/model/user/car_parking_model.dart +++ b/lib/model/user/car_parking_model.dart @@ -4,10 +4,10 @@ import 'package:flustars/flustars.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class CarParkingModel { - String code; - int type; - int status; - String effectiveTimeEnd; + String? code; + int? type; + int? status; + String? effectiveTimeEnd; String get typeName { switch (type) { case 1: @@ -40,9 +40,9 @@ class CarParkingModel { return effectiveDateValue; } - DateTime get effectiveDate { + DateTime? get effectiveDate { if (effectiveTimeEnd == null) return null; - return DateUtil.getDateTime(effectiveTimeEnd); + return DateUtil.getDateTime(effectiveTimeEnd!); } String get effectiveDateValue => @@ -51,7 +51,7 @@ class CarParkingModel { bool get outdated { if (effectiveDate == null) return false; DateTime now = DateTime.now(); - return effectiveDate.isAfter(now); + return effectiveDate!.isAfter(now); } List get shadow { diff --git a/lib/model/user/committee_item_model.dart b/lib/model/user/committee_item_model.dart index ee4b380b..930f2794 100644 --- a/lib/model/user/committee_item_model.dart +++ b/lib/model/user/committee_item_model.dart @@ -1,18 +1,18 @@ import 'package:aku_community/model/common/img_model.dart'; class CommitteeItemModel { - int id; - int positionId; - String name; - int sexId; - int age; - int educationId; - String roomName; - String profession; - String roomNumber; - int unitNo; - int estateNo; - List imgUrls; + int? id; + int? positionId; + String? name; + int? sexId; + int? age; + int? educationId; + String? roomName; + String? profession; + String? roomNumber; + int? unitNo; + int? estateNo; + List? imgUrls; String get sexValue { if (sexId == 0 || sexId == null) return '未设置'; diff --git a/lib/model/user/convenient_phone_model.dart b/lib/model/user/convenient_phone_model.dart index 916c171d..dd99cf34 100644 --- a/lib/model/user/convenient_phone_model.dart +++ b/lib/model/user/convenient_phone_model.dart @@ -1,7 +1,7 @@ class ConvenientPhoneModel { - int id; - String name; - String tel; + int? id; + String? name; + String? tel; ConvenientPhoneModel({this.id, this.name, this.tel}); diff --git a/lib/model/user/fixed_submit_model.dart b/lib/model/user/fixed_submit_model.dart index 4690729e..6e321831 100644 --- a/lib/model/user/fixed_submit_model.dart +++ b/lib/model/user/fixed_submit_model.dart @@ -1,11 +1,11 @@ import 'package:aku_community/model/common/img_model.dart'; class FixedSubmitModel { - int id; - int type; - int status; - String reportDetail; - List imgUrls; + int? id; + int? type; + int? status; + String? reportDetail; + List? imgUrls; FixedSubmitModel( {this.id, this.type, this.status, this.reportDetail, this.imgUrls}); @@ -18,7 +18,7 @@ class FixedSubmitModel { if (json['imgUrls'] != null) { imgUrls = []; json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + imgUrls!.add(new ImgModel.fromJson(v)); }); } } @@ -30,7 +30,7 @@ class FixedSubmitModel { data['status'] = this.status; data['reportDetail'] = this.reportDetail; if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/model/user/house_model.dart b/lib/model/user/house_model.dart index dd13158e..b4795dc3 100644 --- a/lib/model/user/house_model.dart +++ b/lib/model/user/house_model.dart @@ -3,21 +3,21 @@ import 'package:flutter/material.dart'; import 'package:flustars/flustars.dart'; class HouseModel { - int id; - String roomName; + int? id; + String? roomName; - int estateId; + int? estateId; ///1.未审核,3.审核失败,4.审核成功 - int status; + int? status; ///1 审核业主,2审核亲属,3审核租客 - int type; - String effectiveTimeStart; - String effectiveTimeEnd; + int? type; + String? effectiveTimeStart; + String? effectiveTimeEnd; - DateTime get effectiveStartDate => DateUtil.getDateTime(effectiveTimeStart); - DateTime get effectiveEndDate => DateUtil.getDateTime(effectiveTimeEnd); + DateTime? get effectiveStartDate => DateUtil.getDateTime(effectiveTimeStart!); + DateTime? get effectiveEndDate => DateUtil.getDateTime(effectiveTimeEnd!); //TODO 未通过状态 bool get reviewed => status == 4; diff --git a/lib/model/user/pick_building_model.dart b/lib/model/user/pick_building_model.dart index 6a5f0517..aa2080db 100644 --- a/lib/model/user/pick_building_model.dart +++ b/lib/model/user/pick_building_model.dart @@ -1,6 +1,6 @@ class PickBuildingModel { - int value; - String label; + int? value; + String? label; PickBuildingModel({this.value, this.label}); diff --git a/lib/model/user/user_detail_model.dart b/lib/model/user/user_detail_model.dart index ed99dbd4..22f9856e 100644 --- a/lib/model/user/user_detail_model.dart +++ b/lib/model/user/user_detail_model.dart @@ -1,19 +1,19 @@ class UserDetailModel { - int id; - String name; - int type; - String tel; - int idType; - String idNumber; - String pwd; - String confuse; - String email; - int createId; - String createDate; - String identity; - int roomStatus; - String nickName; - List estateNames; + int? id; + String? name; + int? type; + String? tel; + int? idType; + String? idNumber; + String? pwd; + String? confuse; + String? email; + int? createId; + String? createDate; + String? identity; + int? roomStatus; + String? nickName; + List? estateNames; UserDetailModel( {this.id, diff --git a/lib/model/user/user_info_model.dart b/lib/model/user/user_info_model.dart index 750f6b3c..ea49b2c8 100644 --- a/lib/model/user/user_info_model.dart +++ b/lib/model/user/user_info_model.dart @@ -1,15 +1,15 @@ import 'package:flustars/flustars.dart'; class UserInfoModel { - int id; - String imgUrl; - String name; - String nickName; - String tel; + int? id; + String? imgUrl; + String? name; + String? nickName; + String? tel; /// 性别 1.男 2.女 - int sex; - String birthday; + int? sex; + String? birthday; String get sexValue { if (sex == null) return '未设置'; @@ -18,7 +18,7 @@ class UserInfoModel { return '未设置'; } - DateTime get birthdayDate => DateUtil.getDateTime(birthday); + DateTime? get birthdayDate => DateUtil.getDateTime(birthday!); String get birthdayValue { if (TextUtil.isEmpty(birthday)) return '未设置'; diff --git a/lib/pages/convenient_phone/convenient_phone_page.dart b/lib/pages/convenient_phone/convenient_phone_page.dart index faadd8bf..1eba5b06 100644 --- a/lib/pages/convenient_phone/convenient_phone_page.dart +++ b/lib/pages/convenient_phone/convenient_phone_page.dart @@ -14,15 +14,15 @@ import 'package:aku_community/pages/things_page/widget/bee_list_view.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class ConvenientPhonePage extends StatefulWidget { - ConvenientPhonePage({Key key}) : super(key: key); + ConvenientPhonePage({Key? key}) : super(key: key); @override _ConvenientPhonePageState createState() => _ConvenientPhonePageState(); } class _ConvenientPhonePageState extends State { - EasyRefreshController _easyRefreshController; - TextEditingController _textEditingController; + EasyRefreshController? _easyRefreshController; + TextEditingController? _textEditingController; @override void initState() { @@ -47,9 +47,9 @@ class _ConvenientPhonePageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.name.text.black.size(32.sp).make(), + model.name!.text.black.size(32.sp).make(), 12.w.heightBox, - model.tel.text.color(Color(0xFF999999)).size(28.sp).make(), + model.tel!.text.color(Color(0xFF999999)).size(28.sp).make(), ], ).expand(), IconButton( @@ -59,8 +59,8 @@ class _ConvenientPhonePageState extends State { height: 40.w, ), onPressed: () async { - bool result = await Get.dialog(CupertinoAlertDialog( - title: model.tel.text.isIntrinsic.make(), + bool? result = await Get.dialog(CupertinoAlertDialog( + title: model.tel!.text.isIntrinsic.make(), actions: [ CupertinoDialogAction( child: '取消'.text.isIntrinsic.make(), @@ -102,7 +102,7 @@ class _ConvenientPhonePageState extends State { child: TextField( controller: _textEditingController, onSubmitted: (value) { - _easyRefreshController.callRefresh(); + _easyRefreshController!.callRefresh(); setState(() {}); }, decoration: InputDecoration( @@ -121,12 +121,12 @@ class _ConvenientPhonePageState extends State { ), ), Expanded( - child: BeeListView( - extraParams: {'name': _textEditingController.text}, + child: BeeListView( + extraParams: {'name': _textEditingController!.text}, controller: _easyRefreshController, path: API.manager.convenientPhone, convert: (model) { - return model.tableList + return model.tableList! .map((e) => ConvenientPhoneModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/event_activity/event_voting_page.dart b/lib/pages/event_activity/event_voting_page.dart index b1f44e4a..59da9072 100644 --- a/lib/pages/event_activity/event_voting_page.dart +++ b/lib/pages/event_activity/event_voting_page.dart @@ -14,14 +14,14 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/others/stack_avatar.dart'; class EventVotingPage extends StatefulWidget { - EventVotingPage({Key key}) : super(key: key); + EventVotingPage({Key? key}) : super(key: key); @override _EventVotingPageState createState() => _EventVotingPageState(); } class _EventVotingPageState extends State { - EasyRefreshController _controller; + EasyRefreshController? _controller; @override void initState() { super.initState(); @@ -34,7 +34,7 @@ class _EventVotingPageState extends State { super.dispose(); } - String _getButtonText(int status) { + String _getButtonText(int? status) { switch (status) { case 1: case 2: @@ -71,13 +71,13 @@ class _EventVotingPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.title.text.black + model.title!.text.black .size(28.sp) .bold .overflow(TextOverflow.ellipsis) .make(), 16.w.heightBox, - model.content.text.color(ktextSubColor).size(24.sp).make(), + model.content!.text.color(ktextSubColor).size(24.sp).make(), 8.w.heightBox, RichText( text: TextSpan( @@ -92,14 +92,14 @@ class _EventVotingPageState extends State { color: ktextPrimary, fontSize: 24.sp, ), - text: model.beginDate + '至' + model.endDate, + text: model.beginDate! + '至' + model.endDate!, ), ])), 16.w.heightBox, Row( children: [ StackAvatar( - avatars: model.headImgURls.map((e) => e.url).toList()), + avatars: model.headImgURls!.map((e) => e.url).toList()), Spacer(), MaterialButton( shape: RoundedRectangleBorder( @@ -134,11 +134,11 @@ class _EventVotingPageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '活动投票', - body: BeeListView( + body: BeeListView( path: API.manager.enventVotingList, controller: _controller, convert: (model) { - return model.tableList + return model.tableList! .map((e) => EventVotingModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/event_activity/voting_detail_page.dart b/lib/pages/event_activity/voting_detail_page.dart index 4838b908..e318cc54 100644 --- a/lib/pages/event_activity/voting_detail_page.dart +++ b/lib/pages/event_activity/voting_detail_page.dart @@ -20,20 +20,20 @@ import 'package:aku_community/widget/buttons/bee_single_check.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; class VotingDetailPage extends StatefulWidget { - final int id; + final int? id; - VotingDetailPage({Key key, this.id}) : super(key: key); + VotingDetailPage({Key? key, this.id}) : super(key: key); @override _VotingDetailPageState createState() => _VotingDetailPageState(); } class _VotingDetailPageState extends State { - VotingDetailModel _model; - EasyRefreshController _refreshController; + late VotingDetailModel _model; + EasyRefreshController? _refreshController; bool _isOnload = true; // List _select = []; - int _selectId; + int? _selectId; bool _hasVoted = false; bool get finishVoted { if ((_model.status == 4) || _hasVoted || (_model.status == 3)) { @@ -78,11 +78,11 @@ class _VotingDetailPageState extends State { ); } - double _getPercent(num numerator, num denominator) { + double _getPercent(num? numerator, num? denominator) { if (denominator == 0) { return 0; } else { - return (numerator / denominator) * 100; + return (numerator! / denominator!) * 100; } } @@ -147,7 +147,7 @@ class _VotingDetailPageState extends State { children: [ // '测试'.text.black.size(32.sp).make(), // 10.w.heightBox, - model.name.text.black.size(32.sp).make(), + model.name!.text.black.size(32.sp).make(), 33.w.heightBox, finishVoted ? Row( @@ -225,7 +225,7 @@ class _VotingDetailPageState extends State { vertical: 26.w, ), children: [ - _model.title.text.black.size(32.sp).bold.maxLines(2).make(), + _model.title!.text.black.size(32.sp).bold.maxLines(2).make(), 44.w.heightBox, ClipRRect( borderRadius: BorderRadius.circular(8.w), @@ -235,7 +235,7 @@ class _VotingDetailPageState extends State { ), ), 44.w.heightBox, - _model.content.text.black.size(28.sp).make(), + _model.content!.text.black.size(28.sp).make(), 44.w.heightBox, Container( padding: EdgeInsets.fromLTRB(32.w, 50.w, 32.w, 0), @@ -255,7 +255,7 @@ class _VotingDetailPageState extends State { // .size(32.sp) // .make(), //TODO:缺少字段; // 26.w.heightBox, - ..._model.appVoteCandidateVos + ..._model.appVoteCandidateVos! .map((e) => _buildVoteCard(e)) .toList() .sepWidget(separate: BeeDivider.horizontal()), @@ -274,7 +274,7 @@ class _VotingDetailPageState extends State { } else { BaseModel baseModel = await ManagerFunc.vote(widget.id, _selectId); - if (baseModel.status) { + if (baseModel.status!) { await Get.dialog(_shouwVoteDialog()); _hasVoted = true; setState(() {}); diff --git a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart index c9d87a66..542af825 100644 --- a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart +++ b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart @@ -13,9 +13,9 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/dotted_line.dart'; class DetoCodePage extends StatelessWidget { - final int id; - final ArticleQRModel model; - const DetoCodePage({Key key, this.id, this.model}) : super(key: key); + final int? id; + final ArticleQRModel? model; + const DetoCodePage({Key? key, this.id, this.model}) : super(key: key); Widget _header(String estateName) { return Container( @@ -24,7 +24,7 @@ class DetoCodePage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - S.of(Get.context).tempPlotName, + S.of(Get.context!)!.tempPlotName, style: TextStyle(fontSize: 40.sp, color: Color(0xffffffff)), ), SizedBox(height: 10.w), @@ -37,7 +37,7 @@ class DetoCodePage extends StatelessWidget { ); } - Widget _card(String name, String effectiveTime) { + Widget _card(String? name, String? effectiveTime) { return Container( decoration: BoxDecoration( color: Color(0xffffffff), @@ -117,7 +117,7 @@ class DetoCodePage extends StatelessWidget { // SizedBox(height: 11.w), QrImage( padding: EdgeInsets.zero, - data: model.appArticleOutQRCodeVo.id.toString(), + data: model!.appArticleOutQRCodeVo!.id.toString(), size: 260.w, ), ], @@ -152,10 +152,10 @@ class DetoCodePage extends StatelessWidget { Column( children: [ SizedBox(height: 192.w - kToolbarHeight), - _header(appProvider.selectedHouse.roomName), + _header(appProvider.selectedHouse!.roomName!), SizedBox(height: 32.w), - _card(model.appArticleOutQRCodeVo.applicantName, - model.appArticleOutQRCodeVo.effectiveTime), + _card(model!.appArticleOutQRCodeVo!.applicantName, + model!.appArticleOutQRCodeVo!.effectiveTime), ], ), ], diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index 0961efc8..52fc5603 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -31,7 +31,7 @@ import 'package:aku_community/widget/picker/bee_date_picker.dart'; import 'package:aku_community/widget/picker/grid_image_picker.dart'; class DetoCreatePage extends StatefulWidget { - DetoCreatePage({Key key}) : super(key: key); + DetoCreatePage({Key? key}) : super(key: key); @override _DetoCreatePageState createState() => _DetoCreatePageState(); @@ -41,12 +41,12 @@ class _DetoCreatePageState extends State { List _files = []; UserProvider get userProvider => Provider.of(context); - String _itemName; - DateTime _date; + String? _itemName; + DateTime? _date; String get datetime => DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"); - int _selectWeight; - String _selectTel; + int? _selectWeight; + String? _selectTel; List _listWeight = [ '< 50kg', '50kg-100kg', @@ -108,7 +108,7 @@ class _DetoCreatePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - S.of(context).tempPlotName, + S.of(context)!.tempPlotName, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 32.sp, @@ -214,7 +214,7 @@ class _DetoCreatePageState extends State { title: e, value: _listWeight.indexOf(e), groupValue: _selectWeight, - onChange: (value) { + onChange: (dynamic value) { _selectWeight = value; setState(() {}); }, @@ -242,7 +242,7 @@ class _DetoCreatePageState extends State { title: e, value: _listMode.indexOf(e), groupValue: _selectApproach, - onChange: (value) { + onChange: (dynamic value) { _selectApproach = value; setState(() {}); }, @@ -256,7 +256,7 @@ class _DetoCreatePageState extends State { ); } - Widget _itemPicker(String title, String select, VoidCallback onTap) { + Widget _itemPicker(String title, String? select, VoidCallback onTap) { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, @@ -270,7 +270,7 @@ class _DetoCreatePageState extends State { onTap: onTap, child: Row( children: [ - ((select?.isEmptyOrNull ?? true) ? '请选择' : select) + ((select?.isEmptyOrNull ?? true) ? '请选择' : select)! .text .color((select?.isEmptyOrNull ?? true) ? ktextSubColor @@ -368,7 +368,7 @@ class _DetoCreatePageState extends State { padding: EdgeInsets.symmetric(vertical: 30.w), child: Row( children: [ - (_selectTel.isEmptyOrNull ? '请选择搬家公司' : _selectTel) + (_selectTel.isEmptyOrNull ? '请选择搬家公司' : _selectTel)! .text .color(ktextSubColor) .size(36.sp) @@ -386,7 +386,7 @@ class _DetoCreatePageState extends State { ); } - bool _canSubmit(int weight, int approach, DateTime dateTime, String item) { + bool _canSubmit(int? weight, int approach, DateTime? dateTime, String? item) { if (weight == null) { return false; } else if (approach == null) { @@ -410,7 +410,7 @@ class _DetoCreatePageState extends State { body: ListView( padding: EdgeInsets.all(32.w), children: [ - _houseAddress(appProvider.selectedHouse.roomName), + _houseAddress(appProvider.selectedHouse!.roomName!), _getWeight(), _itemPicker('出户时间', datetime, () async { _date = await BeeDatePicker.timePicker(DateTime.now()); @@ -442,22 +442,22 @@ class _DetoCreatePageState extends State { onPressed: _canSubmit(_selectWeight, _selectApproach, _date, _itemName) ? () async { VoidCallback cancel = BotToast.showLoading(); - List urls = await NetUtil() + List urls = await NetUtil() .uploadFiles(_files, API.upload.uploadRepair); BaseModel baseModel = await ManagerFunc.articleOutSubmit( id: BeeParse.getEstateNameId( - userProvider.userDetailModel.estateNames[0]), + userProvider.userDetailModel!.estateNames![0]), name: _itemName, - weight: _selectWeight + 1, + weight: _selectWeight! + 1, approach: _selectApproach + 1, tel: _selectTel, time: datetime, urls: urls, ); - if (baseModel.status) { + if (baseModel.status!) { Get.back(); } else - BotToast.showText(text: baseModel.message); + BotToast.showText(text: baseModel.message!); cancel(); } : () { diff --git a/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart b/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart index 9bddbe91..73f7a95f 100644 --- a/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart +++ b/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart @@ -5,11 +5,11 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/animated/animated_scale.dart'; class CommonRadio extends StatefulWidget { - final T value; - final T groupValue; - final Widget text; - final double size; - CommonRadio({Key key, this.value, this.groupValue, this.text, this.size}) + final T? value; + final T? groupValue; + final Widget? text; + final double? size; + CommonRadio({Key? key, this.value, this.groupValue, this.text, this.size}) : super(key: key); @override @@ -19,7 +19,7 @@ class CommonRadio extends StatefulWidget { class _CommonRadioState extends State { bool get _selected => widget.value == widget.groupValue; double get smallSize { - return widget.size.isNull ? 24.w : (widget.size * 24 / 40); + return widget.size!.isNull! ? 24.w : (widget.size! * 24 / 40); } @override @@ -60,7 +60,7 @@ class _CommonRadioState extends State { ? [SizedBox()] : [ 10.w.widthBox, - widget.text, + widget.text!, 10.w.widthBox, ] ], diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index 17a0ac52..58475538 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -21,7 +21,7 @@ import 'package:aku_community/widget/buttons/radio_button.dart'; import 'widget/goods_info_card.dart'; class GoodsDetoPage extends StatefulWidget { - GoodsDetoPage({Key key}) : super(key: key); + GoodsDetoPage({Key? key}) : super(key: key); @override _GoodsDetoPageState createState() => _GoodsDetoPageState(); @@ -29,9 +29,9 @@ class GoodsDetoPage extends StatefulWidget { class _GoodsDetoPageState extends State { EasyRefreshController _refreshController = EasyRefreshController(); - List _select = []; + List _select = []; bool _isEdit = false; - bool _canSkew(int state) { + bool _canSkew(int? state) { switch (state) { case 1: case 2: @@ -79,11 +79,11 @@ class _GoodsDetoPageState extends State { ], body: Padding( padding: EdgeInsets.only(bottom: 98.w), - child: BeeListView( + child: BeeListView( controller: _refreshController, path: API.manager.articleOut, convert: (model) { - return model.tableList + return model.tableList! .map((e) => GoodsOutModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/goods_deto_page/select_move_company_page.dart b/lib/pages/goods_deto_page/select_move_company_page.dart index 4e415066..a28cf4f8 100644 --- a/lib/pages/goods_deto_page/select_move_company_page.dart +++ b/lib/pages/goods_deto_page/select_move_company_page.dart @@ -15,22 +15,22 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; class SelectMoveCompanyPage extends StatefulWidget { - SelectMoveCompanyPage({Key key}) : super(key: key); + SelectMoveCompanyPage({Key? key}) : super(key: key); @override _SelectMoveCompanyPageState createState() => _SelectMoveCompanyPageState(); } class _SelectMoveCompanyPageState extends State { - int _selected; - MovingCompanyModel _companyModel; - EasyRefreshController _controller; + int? _selected; + late MovingCompanyModel _companyModel; + EasyRefreshController? _controller; bool _onloading = true; - String get result { - if (_selected == _companyModel.appMovingCompanyVoList.length) { + String? get result { + if (_selected == _companyModel.appMovingCompanyVoList!.length) { return '已选择自己联系'; } else { - return _companyModel.appMovingCompanyVoList[_selected].tel; + return _companyModel.appMovingCompanyVoList![_selected!].tel; } } @@ -46,7 +46,7 @@ class _SelectMoveCompanyPageState extends State { super.dispose(); } - Widget _buildCard(int index, String name, String tel) { + Widget _buildCard(int index, String name, String? tel) { return GestureDetector( onTap: () { _selected = index; @@ -143,13 +143,13 @@ class _SelectMoveCompanyPageState extends State { : ListView( padding: EdgeInsets.all(32.w), children: [ - ..._companyModel.appMovingCompanyVoList + ..._companyModel.appMovingCompanyVoList! .map((e) => _buildCard( - _companyModel.appMovingCompanyVoList.indexOf(e), - e.name, + _companyModel.appMovingCompanyVoList!.indexOf(e), + e.name!, e.tel)) .toList(), - _buildForself(_companyModel.appMovingCompanyVoList.length) + _buildForself(_companyModel.appMovingCompanyVoList!.length) ].sepWidget(separate: BeeDivider.horizontal()), ), ), diff --git a/lib/pages/goods_deto_page/widget/goods_info_card.dart b/lib/pages/goods_deto_page/widget/goods_info_card.dart index 5d9a9801..f0f93c0f 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card.dart @@ -9,9 +9,9 @@ import 'package:aku_community/widget/views/horizontal_image_view.dart'; import 'goods_info_card_button.dart'; class GoodsInfoCard extends StatelessWidget { - final GoodsOutModel model; + final GoodsOutModel? model; GoodsInfoCard({ - Key key, + Key? key, this.model, }) : super(key: key); @@ -34,7 +34,7 @@ class GoodsInfoCard extends StatelessWidget { ); } - Color _getColor(int state) { + Color _getColor(int? state) { switch (state) { case 1: case 2: @@ -98,11 +98,11 @@ class GoodsInfoCard extends StatelessWidget { fontSize: 32.sp, color: Color(0xff333333)), ), - Text(BeeMap.fixState[model.status], + Text(BeeMap.fixState[model!.status!]!, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 28.sp, - color: _getColor(model.status))), + color: _getColor(model!.status))), ], ), ), @@ -117,10 +117,10 @@ class GoodsInfoCard extends StatelessWidget { BorderSide(color: Color(0xffeeeeee), width: 0.5)), ), child: Column(children: [ - _builTile('物品重量', BeeMap.goodsOutweight[model.weight]), - _builTile('出户时间', model.expectedTime), - _builTile('物品名称', model.name), - _builTile('搬运方式', BeeMap.goodsOutApproach[model.approach]), + _builTile('物品重量', BeeMap.goodsOutweight[model!.weight!]!), + _builTile('出户时间', model!.expectedTime!), + _builTile('物品名称', model!.name!), + _builTile('搬运方式', BeeMap.goodsOutApproach[model!.approach!]!), ]), ), Container( @@ -142,7 +142,7 @@ class GoodsInfoCard extends StatelessWidget { ), ), HorizontalImageView( - model.imgUrl.map((e) => e.url).toList()), + model!.imgUrl!.map((e) => e.url).toList()), ], ), ), @@ -150,8 +150,8 @@ class GoodsInfoCard extends StatelessWidget { ), ), GoodsInfoCardButton( - id: model.id, - tel: model.movingCompanyTel, + id: model!.id, + tel: model!.movingCompanyTel, ) ], ), diff --git a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart index 7e8ce334..d4377da1 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart @@ -12,9 +12,9 @@ import 'package:aku_community/pages/manager_func.dart'; import 'package:aku_community/utils/headers.dart'; class GoodsInfoCardButton extends StatelessWidget { - final String tel; - final int id; - GoodsInfoCardButton({Key key, this.tel, this.id}) : super(key: key); + final String? tel; + final int? id; + GoodsInfoCardButton({Key? key, this.tel, this.id}) : super(key: key); final List> _listButton = [ {'title': '查看二维码', 'icon': MaterialCommunityIcons.qrcode}, @@ -28,13 +28,13 @@ class GoodsInfoCardButton extends StatelessWidget { } } - void _showDialog(BuildContext context, String url) { + void _showDialog(BuildContext context, String? url) { showCupertinoDialog( context: context, builder: (context) { return CupertinoAlertDialog( title: Text( - url, + url!, style: TextStyle( fontSize: 34.sp, color: Color(0xff030303), @@ -96,10 +96,10 @@ class GoodsInfoCardButton extends StatelessWidget { case '查看二维码': ArticleQRModel _model = await ManagerFunc.getQRcode(id); - if (_model.status) { + if (_model.status!) { Get.to(() => DetoCodePage(id: id, model: _model)); } else { - BotToast.showText(text: _model.message); + BotToast.showText(text: _model.message!); } break; case '搬家公司': diff --git a/lib/pages/goods_manage_page/borrow/borrow_finsh_page.dart b/lib/pages/goods_manage_page/borrow/borrow_finsh_page.dart index 186586f3..71e9a0aa 100644 --- a/lib/pages/goods_manage_page/borrow/borrow_finsh_page.dart +++ b/lib/pages/goods_manage_page/borrow/borrow_finsh_page.dart @@ -10,9 +10,9 @@ import 'package:aku_community/pages/tab_navigator.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class BorrowFinshPage extends StatefulWidget { - final bool isSuccess; - final String failText; - BorrowFinshPage({Key key, this.isSuccess, this.failText}) : super(key: key); + final bool? isSuccess; + final String? failText; + BorrowFinshPage({Key? key, this.isSuccess, this.failText}) : super(key: key); @override _BorrowFinshPageState createState() => _BorrowFinshPageState(); @@ -30,19 +30,19 @@ class _BorrowFinshPageState extends State { SizedBox( width: 110.w, height: 110.w, - child: Image.asset(widget.isSuccess + child: Image.asset(widget.isSuccess! ? R.ASSETS_ICONS_BORROW_SUCCESS_PNG : R.ASSETS_ICONS_BORROW_FAILURE_PNG), ), 48.w.heightBox, - '${widget.isSuccess ? '出借成功' : '出借失败'}' + '${widget.isSuccess! ? '出借成功' : '出借失败'}' .text .color(ktextPrimary) .size(36.sp) .bold .make(), 16.w.heightBox, - '${widget.isSuccess ? '使用后请记得归还' : widget.failText}' + '${widget.isSuccess! ? '使用后请记得归还' : widget.failText}' .text .color(ktextSubColor) .size(26.sp) @@ -59,16 +59,16 @@ class _BorrowFinshPageState extends State { disabledElevation: 0, padding: EdgeInsets.symmetric(vertical: 24.w), minWidth: double.infinity, - onPressed: widget.isSuccess + onPressed: widget.isSuccess! ? () { Get.offAll(TabNavigator()); } : () { Get.back(); }, - child: '${widget.isSuccess ? '返回首页' : '重新提交'}' + child: '${widget.isSuccess! ? '返回首页' : '重新提交'}' .text - .color(widget.isSuccess ? ktextPrimary : Colors.white) + .color(widget.isSuccess! ? ktextPrimary : Colors.white) .size(36.sp) .make(), ) diff --git a/lib/pages/goods_manage_page/borrow/borrow_goods_detail_page.dart b/lib/pages/goods_manage_page/borrow/borrow_goods_detail_page.dart index 5fc2b919..5b1c5b1e 100644 --- a/lib/pages/goods_manage_page/borrow/borrow_goods_detail_page.dart +++ b/lib/pages/goods_manage_page/borrow/borrow_goods_detail_page.dart @@ -17,9 +17,9 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/radio_button.dart'; class BorrowGoodsDetailPage extends StatefulWidget { - final int articleId; - final List receiveIds; - BorrowGoodsDetailPage({Key key, this.articleId, this.receiveIds}) + final int? articleId; + final List? receiveIds; + BorrowGoodsDetailPage({Key? key, this.articleId, this.receiveIds}) : super(key: key); @override @@ -27,16 +27,16 @@ class BorrowGoodsDetailPage extends StatefulWidget { } class _BorrowGoodsDetailPageState extends State { - EasyRefreshController _easyRefreshController; - List _models; + EasyRefreshController? _easyRefreshController; + late List _models; bool _onload = true; - List _selectItems = []; - bool get allSelect => _selectItems.length == _models.length; + List? _selectItems = []; + bool get allSelect => _selectItems!.length == _models.length; @override void initState() { super.initState(); _easyRefreshController = EasyRefreshController(); - if (widget.receiveIds != null && widget.receiveIds.isNotEmpty) { + if (widget.receiveIds != null && widget.receiveIds!.isNotEmpty) { _selectItems = widget.receiveIds; } } @@ -55,7 +55,7 @@ class _BorrowGoodsDetailPageState extends State { firstRefresh: true, header: MaterialHeader(), onRefresh: () async { - List models = await getModels(); + List models = await (getModels()); _models = models.map((e) => ArticleBorrowDetailModel.fromJson(e)).toList(); _onload = false; @@ -75,11 +75,11 @@ class _BorrowGoodsDetailPageState extends State { return GestureDetector( onTap: () { if (allSelect) { - _selectItems.clear(); + _selectItems!.clear(); } else { - _selectItems.clear(); + _selectItems!.clear(); _models.forEach((element) { - _selectItems.add(element.id); + _selectItems!.add(element.id); }); } setState(() {}); @@ -125,7 +125,7 @@ class _BorrowGoodsDetailPageState extends State { '全选'.text.color(ktextSubColor).size(24.sp).make(), Spacer(), '已选择 '.richText.color(ktextPrimary).size(24.sp).withTextSpanChildren([ - '${_selectItems.length}' + '${_selectItems!.length}' .textSpan .size(32.sp) .color(ktextPrimary) @@ -163,7 +163,7 @@ class _BorrowGoodsDetailPageState extends State { await NetUtil().get(API.manager.articleBorrowFindDetail, params: { "articleId": widget.articleId, }); - return baseModel.data as List; + return baseModel.data as List?; } Widget _goodsCard(ArticleBorrowDetailModel model) { @@ -172,10 +172,10 @@ class _BorrowGoodsDetailPageState extends State { children: [ GestureDetector( onTap: () { - if (_selectItems.contains(model.id)) { - _selectItems.remove(model.id); + if (_selectItems!.contains(model.id)) { + _selectItems!.remove(model.id); } else { - _selectItems.add(model.id); + _selectItems!.add(model.id); } setState(() {}); }, diff --git a/lib/pages/goods_manage_page/borrow/borrow_goods_page.dart b/lib/pages/goods_manage_page/borrow/borrow_goods_page.dart index 7dd924c1..e03f2428 100644 --- a/lib/pages/goods_manage_page/borrow/borrow_goods_page.dart +++ b/lib/pages/goods_manage_page/borrow/borrow_goods_page.dart @@ -18,15 +18,15 @@ import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class BorrowGoodsPage extends StatefulWidget { - BorrowGoodsPage({Key key}) : super(key: key); + BorrowGoodsPage({Key? key}) : super(key: key); @override _BorrowGoodsPageState createState() => _BorrowGoodsPageState(); } class _BorrowGoodsPageState extends State { - EasyRefreshController _easyRefreshController; - List _receiveIds = []; + EasyRefreshController? _easyRefreshController; + List? _receiveIds = []; List _submitIds = []; List _counts = []; @override @@ -54,11 +54,11 @@ class _BorrowGoodsPageState extends State { padding: EdgeInsets.symmetric(horizontal: 32.w), ), ], - body: BeeListView( + body: BeeListView( path: API.manager.articleBorrow, controller: _easyRefreshController, convert: (models) { - return models.tableList + return models.tableList! .map((e) => ArticleBorrowModel.fromJson(e)) .toList(); }, @@ -194,17 +194,18 @@ class _BorrowGoodsPageState extends State { .withRounded(value: 6.w) .make() .onInkTap(() async { - _receiveIds.forEach((element) { + _receiveIds!.forEach((element) { _submitIds.remove(element); }); await Get.to(() => BorrowGoodsDetailPage( - articleId: model.id, - receiveIds: _receiveIds, - )).then((value) { + articleId: model.id, + receiveIds: _receiveIds, + ))! + .then((value) { _receiveIds = value; }); - _counts[index] = _receiveIds.length; - _submitIds.addAll(_receiveIds); + _counts[index] = _receiveIds!.length; + _submitIds.addAll(_receiveIds!); setState(() {}); }); } diff --git a/lib/pages/goods_manage_page/goods_manage_page.dart b/lib/pages/goods_manage_page/goods_manage_page.dart index 9e7a5ab3..18b22688 100644 --- a/lib/pages/goods_manage_page/goods_manage_page.dart +++ b/lib/pages/goods_manage_page/goods_manage_page.dart @@ -19,7 +19,7 @@ import 'package:aku_community/widget/buttons/bottom_button.dart'; class GoodsManagePage extends StatefulWidget { final bool isBorrow; - GoodsManagePage({Key key, this.isBorrow = true}) : super(key: key); + GoodsManagePage({Key? key, this.isBorrow = true}) : super(key: key); @override _GoodsManagePageState createState() => _GoodsManagePageState(); @@ -99,11 +99,11 @@ class _GoodsManagePageState extends State { padding: EdgeInsets.symmetric(horizontal: 32.w), ), ], - body: BeeListView( + body: BeeListView( path: API.manager.articleBorrow, controller: _easyRefreshController, convert: (models) { - return models.tableList + return models.tableList! .map((e) => ArticleBorrowModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart index 9d6c9a16..18deec8b 100644 --- a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart +++ b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart @@ -12,14 +12,14 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class MineGoodsPage extends StatefulWidget { - MineGoodsPage({Key key}) : super(key: key); + MineGoodsPage({Key? key}) : super(key: key); @override _MineGoodsPageState createState() => _MineGoodsPageState(); } class _MineGoodsPageState extends State { - EasyRefreshController _controller; + EasyRefreshController? _controller; @override void initState() { @@ -30,10 +30,10 @@ class _MineGoodsPageState extends State { @override void dispose() { super.dispose(); - _controller.dispose(); + _controller!.dispose(); } - InkWell _frmLoss(int id) { + InkWell _frmLoss(int? id) { return InkWell( onTap: () async { await ManagerFunc.fromLoss(id); @@ -118,7 +118,7 @@ class _MineGoodsPageState extends State { Container( margin: EdgeInsets.only(top: 16.w), child: Text( - '借用时长: ${_getDatelength(model.borrowDate)}', + '借用时长: ${_getDatelength(model.borrowDate!)}', style: TextStyle( fontSize: 24.sp, color: Color(0xff999999), @@ -147,7 +147,7 @@ class _MineGoodsPageState extends State { ? Container( margin: EdgeInsets.only(bottom: 9.w), child: Text( - '温馨提示:您的物品已借用${_getDatelength(model.borrowDate)},如果用完,请及时归还', + '温馨提示:您的物品已借用${_getDatelength(model.borrowDate!)},如果用完,请及时归还', style: TextStyle( fontSize: 22.sp, color: Color(0xff999999), @@ -187,11 +187,11 @@ class _MineGoodsPageState extends State { // ), // ), // ), - body: BeeListView( + body: BeeListView( path: API.manager.articleBorrowMylist, controller: _controller, convert: (model) { - return model.tableList + return model.tableList! .map((e) => MineGoodsModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/goods_manage_page/retrun/return_goods_detail_page.dart b/lib/pages/goods_manage_page/retrun/return_goods_detail_page.dart index 195acc7a..0946aaa3 100644 --- a/lib/pages/goods_manage_page/retrun/return_goods_detail_page.dart +++ b/lib/pages/goods_manage_page/retrun/return_goods_detail_page.dart @@ -17,17 +17,17 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/radio_button.dart'; class ReturnGoodsDetailPage extends StatefulWidget { - ReturnGoodsDetailPage({Key key}) : super(key: key); + ReturnGoodsDetailPage({Key? key}) : super(key: key); @override _ReturnGoodsDetailPageState createState() => _ReturnGoodsDetailPageState(); } class _ReturnGoodsDetailPageState extends State { - EasyRefreshController _easyRefreshController; - List _models; + EasyRefreshController? _easyRefreshController; + late List _models; bool _onload = true; - List _selectItems = []; + List _selectItems = []; bool get allSelect => _selectItems.length == _models.length; @override void initState() { @@ -49,7 +49,7 @@ class _ReturnGoodsDetailPageState extends State { firstRefresh: true, header: MaterialHeader(), onRefresh: () async { - List models = await getModels(); + List models = await (getModels()); _models = models.map((e) => ArticleReturnListModel.fromJson(e)).toList(); _onload = false; @@ -140,7 +140,7 @@ class _ReturnGoodsDetailPageState extends State { 'ids': _selectItems, }, showMessage: true); - if (baseModel.status) { + if (baseModel.status!) { Get.back(); } }, @@ -162,7 +162,7 @@ class _ReturnGoodsDetailPageState extends State { Future getModels() async { BaseModel baseModel = await NetUtil().get(API.manager.articleReturnList); - return baseModel.data as List; + return baseModel.data as List?; } Widget _goodsCard(ArticleReturnListModel model) { diff --git a/lib/pages/goods_manage_page/select_borrow_return_page.dart b/lib/pages/goods_manage_page/select_borrow_return_page.dart index dbac1332..6f7ce71b 100644 --- a/lib/pages/goods_manage_page/select_borrow_return_page.dart +++ b/lib/pages/goods_manage_page/select_borrow_return_page.dart @@ -11,7 +11,7 @@ import 'package:aku_community/pages/goods_manage_page/goods_manage_page.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class SelectBorrowReturnPage extends StatefulWidget { - SelectBorrowReturnPage({Key key}) : super(key: key); + SelectBorrowReturnPage({Key? key}) : super(key: key); @override _SelectBorrowReturnPageState createState() => _SelectBorrowReturnPageState(); diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index f993f970..6036afd7 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -30,7 +30,7 @@ import 'package:aku_community/widget/views/application_view.dart'; import 'widget/home_search.dart'; class HomePage extends StatefulWidget { - HomePage({Key key}) : super(key: key); + HomePage({Key? key}) : super(key: key); @override _HomePageState createState() => _HomePageState(); @@ -41,15 +41,15 @@ class _HomePageState extends State @override bool get wantKeepAlive => true; - ScrollController _scrollController; + ScrollController? _scrollController; - List data; + List? data; EasyRefreshController _refreshController = EasyRefreshController(); int page = 1; - ActivityItemModel _activityItemModel; + ActivityItemModel? _activityItemModel; List _boardItemModels = []; @override diff --git a/lib/pages/home/widget/animate_app_bar.dart b/lib/pages/home/widget/animate_app_bar.dart index a46e9b96..b5d2c57e 100644 --- a/lib/pages/home/widget/animate_app_bar.dart +++ b/lib/pages/home/widget/animate_app_bar.dart @@ -7,9 +7,9 @@ import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/utils/headers.dart'; class AnimateAppBar extends StatefulWidget with PreferredSizeWidget { - final ScrollController scrollController; - final List actions; - AnimateAppBar({Key key, this.scrollController, this.actions}) + final ScrollController? scrollController; + final List? actions; + AnimateAppBar({Key? key, this.scrollController, this.actions}) : super(key: key); @override @@ -24,14 +24,14 @@ class _AnimateAppBarState extends State { @override void initState() { super.initState(); - widget.scrollController.addListener(() { + widget.scrollController!.addListener(() { setState(() { - _bgColor = widget.scrollController.offset > 30 + _bgColor = widget.scrollController!.offset > 30 ? Color(0xFFFFBD00) - : widget.scrollController.offset < 0 + : widget.scrollController!.offset < 0 ? Colors.transparent : Color(0xFFFFBD00) - .withOpacity((widget.scrollController.offset / 30)); + .withOpacity((widget.scrollController!.offset / 30)); }); }); } @@ -40,7 +40,7 @@ class _AnimateAppBarState extends State { Widget build(BuildContext context) { final appProvider = Provider.of(context); return AppBar( - title: Text(S.of(context).tempPlotName), + title: Text(S.of(context)!.tempPlotName), backgroundColor: _bgColor, leading: Container( margin: EdgeInsets.only(left: 32.w), @@ -48,9 +48,9 @@ class _AnimateAppBarState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (appProvider?.location != null) + if (appProvider.location != null) Text( - appProvider?.location['city'] ?? '', + appProvider.location!['city'] as String? ?? '', style: TextStyle( fontWeight: FontWeight.w600, fontSize: 24.sp, diff --git a/lib/pages/home/widget/home_search.dart b/lib/pages/home/widget/home_search.dart index 30a83023..e341a70e 100644 --- a/lib/pages/home/widget/home_search.dart +++ b/lib/pages/home/widget/home_search.dart @@ -8,7 +8,7 @@ import 'package:aku_community/ui/search/bee_search.dart'; import 'package:aku_community/utils/headers.dart'; class HomeSearch extends StatefulWidget { - HomeSearch({Key key}) : super(key: key); + HomeSearch({Key? key}) : super(key: key); @override _HomeSearchState createState() => _HomeSearchState(); diff --git a/lib/pages/industry_committee/committee_mailbox/committee_mailbox_page.dart b/lib/pages/industry_committee/committee_mailbox/committee_mailbox_page.dart index b2da4999..935a1a11 100644 --- a/lib/pages/industry_committee/committee_mailbox/committee_mailbox_page.dart +++ b/lib/pages/industry_committee/committee_mailbox/committee_mailbox_page.dart @@ -5,7 +5,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class CommitteeMailboxPage extends StatefulWidget { - CommitteeMailboxPage({Key key}) : super(key: key); + CommitteeMailboxPage({Key? key}) : super(key: key); @override _CommitteeMailboxPageState createState() => _CommitteeMailboxPageState(); diff --git a/lib/pages/industry_committee/industry_committee_page.dart b/lib/pages/industry_committee/industry_committee_page.dart index 00c27e58..c6ce20d4 100644 --- a/lib/pages/industry_committee/industry_committee_page.dart +++ b/lib/pages/industry_committee/industry_committee_page.dart @@ -16,7 +16,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class IndustryCommitteePage extends StatefulWidget { - IndustryCommitteePage({Key key}) : super(key: key); + IndustryCommitteePage({Key? key}) : super(key: key); @override _IndustryCommitteePageState createState() => _IndustryCommitteePageState(); @@ -93,7 +93,7 @@ class _IndustryCommitteePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ [ - model.name.text.size(28.sp).color(ktextPrimary).make(), + model.name!.text.size(28.sp).color(ktextPrimary).make(), Spacer(), Container( height: 44.w, @@ -135,10 +135,10 @@ class _IndustryCommitteePageState extends State { return BeeScaffold( title: '业委会', systemStyle: SystemStyle.genStyle(bottom: Color(0xFF2A2A2A)), - body: BeeListView( + body: BeeListView( path: API.manager.commiteeStaff, convert: (model) { - return model.tableList + return model.tableList! .map((e) => CommitteeItemModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/life_pay/life_pay_bill_page/life_pay_bill_page.dart b/lib/pages/life_pay/life_pay_bill_page/life_pay_bill_page.dart index d177c25c..0b96538e 100644 --- a/lib/pages/life_pay/life_pay_bill_page/life_pay_bill_page.dart +++ b/lib/pages/life_pay/life_pay_bill_page/life_pay_bill_page.dart @@ -6,7 +6,7 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'widget/bill_card.dart'; class LifePayBillPage extends StatefulWidget { - LifePayBillPage({Key key}) : super(key: key); + LifePayBillPage({Key? key}) : super(key: key); @override _LifePayBillPageState createState() => _LifePayBillPageState(); diff --git a/lib/pages/life_pay/life_pay_bill_page/widget/bill_card.dart b/lib/pages/life_pay/life_pay_bill_page/widget/bill_card.dart index 71781866..f35c7ebb 100644 --- a/lib/pages/life_pay/life_pay_bill_page/widget/bill_card.dart +++ b/lib/pages/life_pay/life_pay_bill_page/widget/bill_card.dart @@ -5,7 +5,7 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class BillCard extends StatelessWidget { - BillCard({Key key}) : super(key: key); + BillCard({Key? key}) : super(key: key); final List> _listBill = [ {'title': '账单月份', 'value': '2020年1月'}, diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 69d0d5c7..43f217bc 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -21,20 +21,20 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bee_check_radio.dart'; class LifePayPage extends StatefulWidget { - LifePayPage({Key key}) : super(key: key); + LifePayPage({Key? key}) : super(key: key); @override _LifePayPageState createState() => _LifePayPageState(); } class SelectPay { - double payTotal; - int payCount; + double? payTotal; + int? payCount; SelectPay({this.payCount, this.payTotal}); } class _LifePayPageState extends State { - EasyRefreshController _controller; + EasyRefreshController? _controller; List _selectYears = []; List _models = []; List _selectPay = []; @@ -66,7 +66,7 @@ class _LifePayPageState extends State { GestureDetector( onTap: () { Get.to(() => PickMyHousePage()); - _controller.callRefresh(); + _controller!.callRefresh(); }, child: Row( children: [ @@ -81,7 +81,7 @@ class _LifePayPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ S - .of(context) + .of(context)! .tempPlotName .text .black @@ -89,7 +89,7 @@ class _LifePayPageState extends State { .bold .make(), 10.w.heightBox, - appProvider.selectedHouse.roomName.text.black + appProvider.selectedHouse!.roomName!.text.black .size(32.sp) .bold .make() @@ -153,7 +153,7 @@ class _LifePayPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - '${BeeParse.getCustomYears(model.years)}(${model.years})' + '${BeeParse.getCustomYears(model.years!)}(${model.years})' .text .color(ktextSubColor) .size(28.sp) @@ -188,8 +188,8 @@ class _LifePayPageState extends State { children: [ GestureDetector( onTap: () async { - List payMent = await Get.to( - () => LifePayDetailPage(model: _models[index])); + List payMent = await (Get.to( + () => LifePayDetailPage(model: _models[index]))); _selectPay[index].payCount = payMent[0]; _selectPay[index].payTotal = payMent[1]; setState(() {}); @@ -213,11 +213,11 @@ class _LifePayPageState extends State { double getPayTotal(LifePayModel list) { num total = 0; - for (var item in list.dailyPaymentTypeVos) { - total += ((item.detailedVoList[1].paymentPrice ?? 0) + - (item.detailedVoList[2].paymentPrice ?? 0)); + for (var item in list.dailyPaymentTypeVos!) { + total += ((item.detailedVoList![1].paymentPrice ?? 0) + + (item.detailedVoList![2].paymentPrice ?? 0)); } - return total; + return total as double; } @override @@ -240,20 +240,20 @@ class _LifePayPageState extends State { body: BeeListView( path: API.manager.dailyPaymentList, controller: _controller, - extraParams: {'estateId': appProvider.selectedHouse.estateId}, + extraParams: {'estateId': appProvider.selectedHouse!.estateId}, convert: (model) { List lifePayModels = - model.tableList.map((e) => LifePayModel.fromJson(e)).toList(); + model.tableList!.map((e) => LifePayModel.fromJson(e)).toList(); _selectPay.addAll(lifePayModels .map((e) => SelectPay( - payCount: e.dailyPaymentTypeVos.length, + payCount: e.dailyPaymentTypeVos!.length, payTotal: getPayTotal(e), )) .toList()); return lifePayModels; }, builder: (items) { - _models = items; + _models = items as List; return Column( children: [ _buildHouseCard(), @@ -297,8 +297,8 @@ class _LifePayPageState extends State { _totalCost = 0; _count = 0; for (var item in _selectPay) { - _totalCost += item.payTotal; - _count += item.payCount; + _totalCost += item.payTotal!; + _count += item.payCount!; } } setState(() {}); diff --git a/lib/pages/life_pay/life_pay_record_page.dart b/lib/pages/life_pay/life_pay_record_page.dart index 039251f4..38886cdd 100644 --- a/lib/pages/life_pay/life_pay_record_page.dart +++ b/lib/pages/life_pay/life_pay_record_page.dart @@ -13,14 +13,14 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class LifePayRecordPage extends StatefulWidget { - LifePayRecordPage({Key key}) : super(key: key); + LifePayRecordPage({Key? key}) : super(key: key); @override _LifePayRecordPageState createState() => _LifePayRecordPageState(); } class _LifePayRecordPageState extends State { - EasyRefreshController _refreshController; + EasyRefreshController? _refreshController; Map getPayType = {1: '支付宝', 2: '微信', 3: '现金', 4: 'pos'}; @override void initState() { @@ -42,7 +42,7 @@ class _LifePayRecordPageState extends State { path: API.manager.paymentRecord, controller: _refreshController, convert: (models) { - return models.tableList + return models.tableList! .map((e) => LifePayRecordModel.fromJson(e)) .toList(); }, @@ -64,7 +64,9 @@ class _LifePayRecordPageState extends State { .color(ktextSubColor) .make(), 32.w.heightBox, - ...items.map((e) => _buildRecordCard(e)).toList() + ...items + .map((e) => _buildRecordCard(e as LifePayRecordModel)) + .toList() ], ); }, @@ -77,13 +79,13 @@ class _LifePayRecordPageState extends State { children: [ Row( children: [ - model.chargesTemplateDetailName.text + model.chargesTemplateDetailName!.text .size(30.sp) .color(ktextPrimary) .bold .make(), Spacer(), - '${S.of(context).tempPlotName} ${model.roomName}' + '${S.of(context)!.tempPlotName} ${model.roomName}' .text .size(24.sp) .color(Color(0xFF999999)) @@ -107,7 +109,7 @@ class _LifePayRecordPageState extends State { children: [ '创建时间'.text.color(ktextSubColor).size(28.sp).make(), Spacer(), - '${DateUtil.formatDateStr(model.createDate, format: "yyyy/MM/dd HH:mm")}' + '${DateUtil.formatDateStr(model.createDate!, format: "yyyy/MM/dd HH:mm")}' .text .color(ktextPrimary) .size(28.sp) @@ -118,7 +120,7 @@ class _LifePayRecordPageState extends State { children: [ '付款方式'.text.color(ktextSubColor).size(28.sp).make(), Spacer(), - '${getPayType[model.payType]}' + '${getPayType[model.payType!]}' .text .color(ktextPrimary) .size(28.sp) diff --git a/lib/pages/life_pay/widget/life_pay_detail_page.dart b/lib/pages/life_pay/widget/life_pay_detail_page.dart index ba4e8b4f..d118dd5e 100644 --- a/lib/pages/life_pay/widget/life_pay_detail_page.dart +++ b/lib/pages/life_pay/widget/life_pay_detail_page.dart @@ -13,9 +13,9 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bee_check_radio.dart'; class LifePayDetailPage extends StatefulWidget { - final LifePayModel model; + final LifePayModel? model; LifePayDetailPage({ - Key key, + Key? key, this.model, }) : super(key: key); @@ -29,8 +29,8 @@ class _LifePayDetailPageState extends State { int _payNum = 0; int get listLength { int count = 0; - widget.model.dailyPaymentTypeVos.forEach((element) { - element.detailedVoList.forEach((element) { + widget.model!.dailyPaymentTypeVos!.forEach((element) { + element.detailedVoList!.forEach((element) { count++; }); }); @@ -44,36 +44,36 @@ class _LifePayDetailPageState extends State { @override void initState() { super.initState(); - for (var i = 0; i < widget.model.dailyPaymentTypeVos.length; i++) { + for (var i = 0; i < widget.model!.dailyPaymentTypeVos!.length; i++) { for (var j = 0; - j < widget.model.dailyPaymentTypeVos[i].detailedVoList.length; + j < widget.model!.dailyPaymentTypeVos![i].detailedVoList!.length; j++) { - String id = widget.model.dailyPaymentTypeVos[i].id.toString() + - widget.model.dailyPaymentTypeVos[i].detailedVoList[j].groupId + String id = widget.model!.dailyPaymentTypeVos![i].id.toString() + + widget.model!.dailyPaymentTypeVos![i].detailedVoList![j].groupId .toString(); if (!_selectItems.contains(id)) { _selectItems.add(id); _payNum += 1; _payTotal += widget - .model.dailyPaymentTypeVos[i].detailedVoList[j].paymentPrice + .model!.dailyPaymentTypeVos![i].detailedVoList![j].paymentPrice! .toDouble(); } } } } - Widget _buildTile(int groupId, int id, int years, double price) { + Widget _buildTile(int? groupId, int? id, int? years, double? price) { return GestureDetector( onTap: () { String item = id.toString() + groupId.toString(); if (_selectItems.contains(item)) { _selectItems.remove(item); _payNum -= 1; - _payTotal -= price.toDouble(); + _payTotal -= price!.toDouble(); } else { _selectItems.add(item); _payNum += 1; - _payTotal += price.toDouble(); + _payTotal += price!.toDouble(); } setState(() {}); @@ -108,9 +108,9 @@ class _LifePayDetailPageState extends State { children: [ Row( children: [ - model.name.text.black.size(30.sp).bold.make(), + model.name!.text.black.size(30.sp).bold.make(), Spacer(), - '${S.of(context).tempPlotName} ${appProvider.selectedHouse.estateId}' + '${S.of(context)!.tempPlotName} ${appProvider.selectedHouse!.estateId}' .text .color(ktextSubColor) .size(24.sp) @@ -118,9 +118,9 @@ class _LifePayDetailPageState extends State { ], ), 50.w.heightBox, - ...model.detailedVoList + ...model.detailedVoList! .map((e) => _buildTile( - e.groupId, model.id, widget.model.years, e.paymentPrice)) + e.groupId, model.id, widget.model!.years, e.paymentPrice)) .toList(), ], ), @@ -131,11 +131,11 @@ class _LifePayDetailPageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: - '${BeeParse.getCustomYears(widget.model.years)}-${widget.model.years}年明细', + '${BeeParse.getCustomYears(widget.model!.years!)}-${widget.model!.years}年明细', body: ListView( padding: EdgeInsets.only(top: 16.w), children: [ - ...widget.model.dailyPaymentTypeVos + ...widget.model!.dailyPaymentTypeVos! .map((e) => _buildCard(e)) .toList(), ], @@ -153,23 +153,23 @@ class _LifePayDetailPageState extends State { _payTotal = 0; } else { for (var i = 0; - i < widget.model.dailyPaymentTypeVos.length; + i < widget.model!.dailyPaymentTypeVos!.length; i++) { for (var j = 0; j < - widget.model.dailyPaymentTypeVos[i].detailedVoList + widget.model!.dailyPaymentTypeVos![i].detailedVoList! .length; j++) { String id = - widget.model.dailyPaymentTypeVos[i].id.toString() + - widget.model.dailyPaymentTypeVos[i] - .detailedVoList[j].groupId + widget.model!.dailyPaymentTypeVos![i].id.toString() + + widget.model!.dailyPaymentTypeVos![i] + .detailedVoList![j].groupId .toString(); if (!_selectItems.contains(id)) { _selectItems.add(id); _payNum += 1; - _payTotal += widget.model.dailyPaymentTypeVos[i] - .detailedVoList[j].paymentPrice + _payTotal += widget.model!.dailyPaymentTypeVos![i] + .detailedVoList![j].paymentPrice! .toDouble(); } } diff --git a/lib/pages/life_pay/widget/submit_bar.dart b/lib/pages/life_pay/widget/submit_bar.dart index 111f8c0f..58aa089f 100644 --- a/lib/pages/life_pay/widget/submit_bar.dart +++ b/lib/pages/life_pay/widget/submit_bar.dart @@ -5,8 +5,8 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class SubmitBar extends StatefulWidget { - final String title; - SubmitBar({Key key, this.title}) : super(key: key); + final String? title; + SubmitBar({Key? key, this.title}) : super(key: key); @override _SubmitBarState createState() => _SubmitBarState(); @@ -111,7 +111,7 @@ class _SubmitBarState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ _selectAll(), - _submitOrder(widget.title), + _submitOrder(widget.title!), ], ), ); diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 63825bae..3b1211c3 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -1,7 +1,3 @@ -// Package imports: - -import 'package:flutter/foundation.dart'; - import 'package:bot_toast/bot_toast.dart'; import 'package:dio/dio.dart'; import 'package:flustars/flustars.dart'; @@ -36,13 +32,13 @@ class ManagerFunc { return baseModel; } - static Future shareVisitor({ - @required int estateId, - String name, - String tel, - int sex, - String carNumber, - DateTime date, + static Future shareVisitor({ + required int? estateId, + String? name, + String? tel, + int? sex, + String? carNumber, + DateTime? date, }) async { final cancel = BotToast.showLoading(); Map params = { @@ -54,7 +50,7 @@ class ManagerFunc { if (carNumber != null) params.putIfAbsent('carNumber', () => carNumber); if (date != null) params.putIfAbsent('visitDateStart', () => NetUtil.getDate(date)); - Response response = await NetUtil().dio.post( + Response response = await NetUtil().dio!.post( API.manager.shareInvite, data: params, ); @@ -66,7 +62,7 @@ class ManagerFunc { } static reportRepairInsert( - int id, int type, String reportDetail, List fileUrls) async { + int? id, int type, String reportDetail, List fileUrls) async { BaseModel baseModel = await NetUtil().post( API.manager.reportRepairInsert, params: { @@ -80,7 +76,7 @@ class ManagerFunc { return baseModel; } - static reportRepairDelete(List ids) async { + static reportRepairDelete(List ids) async { BaseModel baseModel = await NetUtil().post( API.manager.reportRepairDelete, params: {'ids': ids}, @@ -89,8 +85,8 @@ class ManagerFunc { return baseModel; } - static Future reportRepairFindBYLD(int id) async { - Response response = await NetUtil().dio.get( + static Future reportRepairFindBYLD(int? id) async { + Response response = await NetUtil().dio!.get( API.manager.reportRepairFindBYLD, queryParameters: { 'repairId': id, @@ -99,7 +95,7 @@ class ManagerFunc { return FixedDetailModel.fromJson(response.data); } - static Future reportRepairCancel(int id) async { + static Future reportRepairCancel(int? id) async { BaseModel baseModel = await NetUtil().get(API.manager.reportRepairCancel, params: { 'repairId': id, @@ -109,7 +105,7 @@ class ManagerFunc { } static Future reportRepairEvaluate( - int id, int rate, String text) async { + int? id, int? rate, String text) async { BaseModel baseModel = await NetUtil().post( API.manager.reportRepairEvaluate, params: { @@ -122,7 +118,7 @@ class ManagerFunc { return baseModel; } - static Future reportRepairComplete(int id) async { + static Future reportRepairComplete(int? id) async { BaseModel baseModel = await NetUtil().get( API.manager.reportRepairComplete, params: { @@ -134,20 +130,20 @@ class ManagerFunc { } static Future getMovingCompanyTel() async { - Response response = await NetUtil().dio.get( + Response response = await NetUtil().dio!.get( API.manager.getMovingCompanyTel, ); return MovingCompanyModel.fromJson(response.data); } static Future articleOutSubmit({ - int id, - String name, - int weight, - int approach, - String tel, - String time, - List urls, + int? id, + String? name, + int? weight, + int? approach, + String? tel, + required String time, + List? urls, }) async { BaseModel baseModel = await NetUtil().post( API.manager.articleOutSubmit, @@ -166,8 +162,8 @@ class ManagerFunc { return baseModel; } - static Future getQRcode(int id) async { - Response response = await NetUtil().dio.get( + static Future getQRcode(int? id) async { + Response response = await NetUtil().dio!.get( API.manager.getQRcode, queryParameters: { 'articleOutId': id, @@ -176,7 +172,7 @@ class ManagerFunc { return ArticleQRModel.fromJson(response.data); } - static Future articleOutDelete(List ids) async { + static Future articleOutDelete(List ids) async { BaseModel baseModel = await NetUtil().post( API.manager.articleOutDelete, params: {'ids': ids}, @@ -185,7 +181,7 @@ class ManagerFunc { return baseModel; } - static Future fromLoss(int id) async { + static Future fromLoss(int? id) async { BaseModel baseModel = await NetUtil().post( API.manager.fromLoss, params: {'articleBorrowId': id}, @@ -202,7 +198,7 @@ class ManagerFunc { return baseModel; } - static Future voteDetail(int id) async { + static Future voteDetail(int? id) async { BaseModel baseModel = await NetUtil().get( API.manager.voteDetail, params: {'voteId': id}, @@ -211,7 +207,7 @@ class ManagerFunc { return VotingDetailModel.fromJson(baseModel.data); } - static Future vote(int voteId, int candleId) async { + static Future vote(int? voteId, int? candleId) async { BaseModel baseModel = await NetUtil().post(API.manager.vote, params: { 'voteId': voteId, 'candidateId': candleId, @@ -219,7 +215,7 @@ class ManagerFunc { return baseModel; } - static Future questionnairefindById(int id) async { + static Future questionnairefindById(int? id) async { BaseModel baseModel = await NetUtil().get( API.manager.questionnairefindById, params: { @@ -231,7 +227,7 @@ class ManagerFunc { } static Future questionnaireSubmit( - int id, List model) async { + int? id, List model) async { BaseModel baseModel = await NetUtil().post( API.manager.questionnaireSubmit, params: { diff --git a/lib/pages/message_center_page/comment_message/comment_message_page.dart b/lib/pages/message_center_page/comment_message/comment_message_page.dart index 8eb906f2..5b81aef3 100644 --- a/lib/pages/message_center_page/comment_message/comment_message_page.dart +++ b/lib/pages/message_center_page/comment_message/comment_message_page.dart @@ -17,14 +17,14 @@ import 'package:aku_community/widget/bee_divider.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class CommentMessagePage extends StatefulWidget { - CommentMessagePage({Key key}) : super(key: key); + CommentMessagePage({Key? key}) : super(key: key); @override _CommentMessagePageState createState() => _CommentMessagePageState(); } class _CommentMessagePageState extends State { - EasyRefreshController _easyRefreshController; + EasyRefreshController? _easyRefreshController; @override void initState() { super.initState(); @@ -51,7 +51,7 @@ class _CommentMessagePageState extends State { } else { return ((model.respondentName?.isEmptyOrNull ?? true) ? model.content - : '回复了${model.respondentName}:${model.content}') + : '回复了${model.respondentName}:${model.content}')! .text .black .size(28.sp) @@ -84,11 +84,11 @@ class _CommentMessagePageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.createName.text.black.size(36.sp).make(), + model.createName!.text.black.size(36.sp).make(), 10.w.heightBox, _messageContent(model), 16.w.heightBox, - getTime(model.createDate) + getTime(model.createDate!) .text .color(Color(0xFF999999)) .size(28.sp) @@ -114,11 +114,11 @@ class _CommentMessagePageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '评论通知', - body: BeeListView( + body: BeeListView( path: API.message.commentMessageList, controller: _easyRefreshController, convert: (models) { - return models.tableList + return models.tableList! .map((e) => CommentMessageModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/message_center_page/message_center_page.dart b/lib/pages/message_center_page/message_center_page.dart index c614200d..ed24e456 100644 --- a/lib/pages/message_center_page/message_center_page.dart +++ b/lib/pages/message_center_page/message_center_page.dart @@ -14,14 +14,14 @@ import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class MessageCenterPage extends StatefulWidget { - MessageCenterPage({Key key}) : super(key: key); + MessageCenterPage({Key? key}) : super(key: key); @override _MessageCenterPageState createState() => _MessageCenterPageState(); } class _MessageCenterPageState extends State { - EasyRefreshController _refreshController; + EasyRefreshController? _refreshController; @override void initState() { super.initState(); @@ -35,11 +35,11 @@ class _MessageCenterPageState extends State { } Widget _buildCard({ - String path, - String title, - String content, - int count, - VoidCallback onTap, + required String path, + required String title, + required String content, + int? count, + VoidCallback? onTap, }) { return InkWell( onTap: onTap, @@ -79,8 +79,8 @@ class _MessageCenterPageState extends State { actions: [ MaterialButton( onPressed: () async { - await NetUtil().dio.get(API.message.allRead); - _refreshController.callRefresh(); + await NetUtil().dio!.get(API.message.allRead); + _refreshController!.callRefresh(); setState(() {}); }, child: '全部已读'.text.size(28.sp).black.make(), @@ -109,7 +109,7 @@ class _MessageCenterPageState extends State { appProvider.messageCenterModel.commentTitle ?? '无评论通知消息', count: appProvider.messageCenterModel.commentCount ?? 0, onTap: () async { - await NetUtil().dio.get(API.message.allReadComment); + await NetUtil().dio!.get(API.message.allReadComment); Get.to(() => CommentMessagePage()); setState(() {}); }, diff --git a/lib/pages/message_center_page/message_func.dart b/lib/pages/message_center_page/message_func.dart index 50c15a6d..91b1c89f 100644 --- a/lib/pages/message_center_page/message_func.dart +++ b/lib/pages/message_center_page/message_func.dart @@ -4,7 +4,7 @@ import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; class MessageFunc { - static Future getSystemMessageDetial(int id) async { + static Future getSystemMessageDetial(int? id) async { BaseModel baseModel = await NetUtil().get(API.message.getSystemMessageDetial, params: { 'sysMessageId': id, diff --git a/lib/pages/message_center_page/refund_details.dart b/lib/pages/message_center_page/refund_details.dart index 966f63b1..b6d76800 100644 --- a/lib/pages/message_center_page/refund_details.dart +++ b/lib/pages/message_center_page/refund_details.dart @@ -5,8 +5,8 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class RefundDetails extends StatelessWidget { - final double statusHeight; - const RefundDetails({Key key, this.statusHeight}) : super(key: key); + final double? statusHeight; + const RefundDetails({Key? key, this.statusHeight}) : super(key: key); Container _containerHeader() { return Container( @@ -193,7 +193,7 @@ class RefundDetails extends StatelessWidget { return SingleChildScrollView( child: Container( height: - MediaQuery.of(context).size.height - kToolbarHeight - statusHeight, + MediaQuery.of(context).size.height - kToolbarHeight - statusHeight!, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/pages/message_center_page/system_message/system_message_detail_page.dart b/lib/pages/message_center_page/system_message/system_message_detail_page.dart index 4df65b01..81f8dc3e 100644 --- a/lib/pages/message_center_page/system_message/system_message_detail_page.dart +++ b/lib/pages/message_center_page/system_message/system_message_detail_page.dart @@ -8,8 +8,8 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class SystemMessageDetailPage extends StatefulWidget { - final int id; - SystemMessageDetailPage({Key key, this.id}) : super(key: key); + final int? id; + SystemMessageDetailPage({Key? key, this.id}) : super(key: key); @override _SystemMessageDetailPageState createState() => @@ -17,7 +17,7 @@ class SystemMessageDetailPage extends StatefulWidget { } class _SystemMessageDetailPageState extends State { - SystemMessageDetailModel _model; + late SystemMessageDetailModel _model; bool _onload = true; Widget _empty() { @@ -46,9 +46,9 @@ class _SystemMessageDetailPageState extends State { 20.w.heightBox, '系统通知'.text.black.bold.size(32.sp).make(), 5.w.heightBox, - _model.title.text.black.size(28.sp).isIntrinsic.make(), + _model.title!.text.black.size(28.sp).isIntrinsic.make(), 110.w.heightBox, - _model.content.text.black.size(28.sp).isIntrinsic.make(), + _model.content!.text.black.size(28.sp).isIntrinsic.make(), ], ), ), diff --git a/lib/pages/message_center_page/system_message/system_message_page.dart b/lib/pages/message_center_page/system_message/system_message_page.dart index a50ad98c..2d4eac15 100644 --- a/lib/pages/message_center_page/system_message/system_message_page.dart +++ b/lib/pages/message_center_page/system_message/system_message_page.dart @@ -16,14 +16,14 @@ import 'package:aku_community/widget/bee_divider.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class SystemMessagePage extends StatefulWidget { - SystemMessagePage({Key key}) : super(key: key); + SystemMessagePage({Key? key}) : super(key: key); @override _SystemMessagePageState createState() => _SystemMessagePageState(); } class _SystemMessagePageState extends State { - EasyRefreshController _refreshController; + EasyRefreshController? _refreshController; @override void initState() { super.initState(); @@ -39,7 +39,7 @@ class _SystemMessagePageState extends State { Widget _buildCard(SystemMessageModel model) { return InkWell( onTap: () async { - await NetUtil().dio.get(API.message.readMessage, queryParameters: { + await NetUtil().dio!.get(API.message.readMessage, queryParameters: { 'sysMessageId': model.id, }); Get.to(() => SystemMessageDetailPage(id: model.id)); @@ -58,8 +58,8 @@ class _SystemMessagePageState extends State { children: [ '系统通知'.text.black.bold.size(32.sp).make(), Spacer(), - BeeMap.messageRead[model.status].text - .color(BeeMap.messageIsRead[model.status] + BeeMap.messageRead[model.status!]!.text + .color(BeeMap.messageIsRead[model.status!]! ? Color(0xFF999999) : Colors.red) .size(32.sp) @@ -67,14 +67,14 @@ class _SystemMessagePageState extends State { ], ), 5.w.heightBox, - model.title.text.black + model.title!.text.black .size(28.sp) .maxLines(1) .isIntrinsic .ellipsis .make(), 5.w.heightBox, - model.content.text.black + model.content!.text.black .size(28.sp) .maxLines(1) .overflow(TextOverflow.ellipsis) @@ -103,11 +103,11 @@ class _SystemMessagePageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '系统通知', - body: BeeListView( + body: BeeListView( path: API.message.sysMessageList, controller: _refreshController, convert: (models) { - return models.tableList + return models.tableList! .map((e) => SystemMessageModel.fromJson(e)) .toList(); }, diff --git a/lib/pages/one_alarm/alarm_detail_page.dart b/lib/pages/one_alarm/alarm_detail_page.dart index 36b8f1a0..14bc3a0e 100644 --- a/lib/pages/one_alarm/alarm_detail_page.dart +++ b/lib/pages/one_alarm/alarm_detail_page.dart @@ -4,7 +4,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class AlarmDetailPage extends StatelessWidget { - const AlarmDetailPage({Key key}) : super(key: key); + const AlarmDetailPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/one_alarm/widget/alarm_page.dart b/lib/pages/one_alarm/widget/alarm_page.dart index 9bde1ba7..f93725c5 100644 --- a/lib/pages/one_alarm/widget/alarm_page.dart +++ b/lib/pages/one_alarm/widget/alarm_page.dart @@ -22,14 +22,14 @@ class PermissionUtil { } class AlarmPage extends StatefulWidget { - AlarmPage({Key key}) : super(key: key); + AlarmPage({Key? key}) : super(key: key); @override _AlarmPageState createState() => _AlarmPageState(); } class _AlarmPageState extends State { - AMapController _mapController; + AMapController? _mapController; Future _makephonenum(String url) async { (await canLaunch(url)) ? await launch(url) : throw 'Could not launch $url'; @@ -66,11 +66,11 @@ class _AlarmPageState extends State { final appProvider = Provider.of(context, listen: false); LatLng _target = LatLng( - appProvider.location['latitude'], - appProvider.location['longitude'], + appProvider.location!['latitude'] as double, + appProvider.location!['longitude'] as double, ); _mapController = controller; - _mapController.moveCamera( + _mapController!.moveCamera( CameraUpdate.newCameraPosition( CameraPosition(target: _target, zoom: 18), ), @@ -125,7 +125,7 @@ class _AlarmPageState extends State { child: Text( (appProvider.location == null) ? '加载中……' - : appProvider.location['address'], + : appProvider.location!['address'] as String, style: TextStyle( color: Color(0xff666666), fontSize: 28.sp, diff --git a/lib/pages/opening_code_page/opening_code_page.dart b/lib/pages/opening_code_page/opening_code_page.dart index c7c0d102..b02821f2 100644 --- a/lib/pages/opening_code_page/opening_code_page.dart +++ b/lib/pages/opening_code_page/opening_code_page.dart @@ -8,7 +8,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class OpeningCodePage extends StatefulWidget { - OpeningCodePage({Key key}) : super(key: key); + OpeningCodePage({Key? key}) : super(key: key); @override _OpeningCodePageState createState() => _OpeningCodePageState(); diff --git a/lib/pages/personal/change_nick_name_page.dart b/lib/pages/personal/change_nick_name_page.dart index a6544e63..8a2a6c70 100644 --- a/lib/pages/personal/change_nick_name_page.dart +++ b/lib/pages/personal/change_nick_name_page.dart @@ -9,20 +9,20 @@ import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class ChangeNickName extends StatefulWidget { - ChangeNickName({Key key}) : super(key: key); + ChangeNickName({Key? key}) : super(key: key); @override _ChangeNickNameState createState() => _ChangeNickNameState(); } class _ChangeNickNameState extends State { - TextEditingController _textEditingController; + TextEditingController? _textEditingController; @override void initState() { final userProvider = Provider.of(context, listen: false); super.initState(); _textEditingController = - TextEditingController(text: userProvider.userInfoModel.nickName); + TextEditingController(text: userProvider.userInfoModel!.nickName); } @override @@ -49,7 +49,7 @@ class _ChangeNickNameState extends State { controller: _textEditingController, decoration: InputDecoration( contentPadding: EdgeInsets.zero, - hintText: '${userProvider.userInfoModel.nickName}', + hintText: '${userProvider.userInfoModel!.nickName}', hintStyle: TextStyle(color: Color(0xFF999999), fontSize: 34.sp), border: UnderlineInputBorder( @@ -62,7 +62,7 @@ class _ChangeNickNameState extends State { 150.w.heightBox, MaterialButton( onPressed: () { - userProvider.setName(_textEditingController.text); + userProvider.setName(_textEditingController!.text); Get.back(); }, child: '保存'.text.black.size(32.sp).make(), diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index e34fc75b..061602f2 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -18,8 +18,8 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/views/application_view.dart'; class PersonalIndex extends StatefulWidget { - final bool isSign; - PersonalIndex({Key key, this.isSign}) : super(key: key); + final bool? isSign; + PersonalIndex({Key? key, this.isSign}) : super(key: key); @override _PersonalIndexState createState() => _PersonalIndexState(); @@ -72,7 +72,7 @@ class _PersonalIndexState extends State child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, image: API.image( - userProvider?.userInfoModel?.imgUrl ?? + userProvider.userInfoModel?.imgUrl ?? ''), height: 106.w, width: 106.w, diff --git a/lib/pages/personal/update_tel_page.dart b/lib/pages/personal/update_tel_page.dart index 5075d77f..578d3969 100644 --- a/lib/pages/personal/update_tel_page.dart +++ b/lib/pages/personal/update_tel_page.dart @@ -16,18 +16,18 @@ import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class UpdateTelPage extends StatefulWidget { - UpdateTelPage({Key key}) : super(key: key); + UpdateTelPage({Key? key}) : super(key: key); @override _UpdateTelPageState createState() => _UpdateTelPageState(); } class _UpdateTelPageState extends State { - TextEditingController _oldTelController; - TextEditingController _newTelController; - TextEditingController _codeController; - Timer _timer; - bool get validPhone => RegexUtil.isMobileSimple(_newTelController.text); + TextEditingController? _oldTelController; + TextEditingController? _newTelController; + TextEditingController? _codeController; + Timer? _timer; + bool get validPhone => RegexUtil.isMobileSimple(_newTelController!.text); bool get _canGetCode { bool timeActive = _timer?.isActive ?? false; return (!timeActive) && validPhone; @@ -51,9 +51,9 @@ class _UpdateTelPageState extends State { } startTick() { - _timer = Timer.periodic(Duration(seconds: 1), (_timer) { - if (_timer.tick >= 60) { - _timer.cancel(); + _timer = Timer.periodic(Duration(seconds: 1), (timer) { + if (timer.tick >= 60) { + _timer!.cancel(); _timer = null; } setState(() {}); @@ -107,12 +107,13 @@ class _UpdateTelPageState extends State { suffixIcon: MaterialButton( onPressed: _canGetCode ? () { - SignFunc.sendNewMessageCode(_newTelController.text); + SignFunc.sendNewMessageCode( + _newTelController!.text); startTick(); } : () {}, child: _timer?.isActive ?? false - ? '${60 - _timer.tick}' + ? '${60 - _timer!.tick}' .text .color(kPrimaryColor) .size(28.sp) @@ -168,15 +169,15 @@ class _UpdateTelPageState extends State { 64.w.heightBox, MaterialButton( onPressed: () { - if (TextUtil.isEmpty(_oldTelController.text)) { + if (TextUtil.isEmpty(_oldTelController!.text)) { BotToast.showText(text: '旧手机号不能为空'); - } else if (TextUtil.isEmpty(_newTelController.text)) { + } else if (TextUtil.isEmpty(_newTelController!.text)) { BotToast.showText(text: '新手机号不能为空'); - } else if (TextUtil.isEmpty(_codeController.text)) { + } else if (TextUtil.isEmpty(_codeController!.text)) { BotToast.showText(text: '验证码不能为空'); } else { - userProvider.updateTel(_oldTelController.text, - _newTelController.text, _codeController.text); + userProvider.updateTel(_oldTelController!.text, + _newTelController!.text, _codeController!.text); Get.back(); } }, diff --git a/lib/pages/personal/user_profile_page.dart b/lib/pages/personal/user_profile_page.dart index 444e558e..d4bce3bd 100644 --- a/lib/pages/personal/user_profile_page.dart +++ b/lib/pages/personal/user_profile_page.dart @@ -24,7 +24,7 @@ import 'package:aku_community/widget/picker/bee_date_picker.dart'; import 'package:aku_community/widget/picker/bee_image_picker.dart'; class UserProfilePage extends StatefulWidget { - UserProfilePage({Key key}) : super(key: key); + UserProfilePage({Key? key}) : super(key: key); @override _UserProfilePageState createState() => _UserProfilePageState(); @@ -32,7 +32,7 @@ class UserProfilePage extends StatefulWidget { class _UserProfilePageState extends State { int _sex = 1; - Widget _buildTile(String title, Widget suffix, {VoidCallback onPressed}) { + Widget _buildTile(String title, Widget suffix, {VoidCallback? onPressed}) { return MaterialButton( color: Colors.white, elevation: 0, @@ -49,7 +49,7 @@ class _UserProfilePageState extends State { 32.wb, title.text.make(), Spacer(), - suffix ?? SizedBox(), + suffix, 24.wb, Icon( CupertinoIcons.chevron_forward, @@ -65,7 +65,7 @@ class _UserProfilePageState extends State { _pickAvatar() async { final userProvider = Provider.of(context, listen: false); - File file = await BeeImagePicker.pick(title: '选择头像'); + File? file = await BeeImagePicker.pick(title: '选择头像'); if (file == null) return; else { @@ -73,10 +73,10 @@ class _UserProfilePageState extends State { Function cancel = BotToast.showLoading(); BaseFileModel model = await NetUtil().upload(API.upload.uploadAvatar, file); - if (model.status) + if (model.status!) userProvider.updateAvatar(model.url); else - BotToast.showText(text: model.message); + BotToast.showText(text: model.message!); cancel(); } } @@ -127,9 +127,9 @@ class _UserProfilePageState extends State { ), _buildTile( '性别', - userProvider.userInfoModel.sexValue.text.make(), + userProvider.userInfoModel!.sexValue.text.make(), onPressed: () async { - int result = await Get.bottomSheet(BeeCustomPicker( + int? result = await Get.bottomSheet(BeeCustomPicker( onPressed: () => Get.back(result: _sex), body: CupertinoPicker( itemExtent: 50, @@ -150,9 +150,9 @@ class _UserProfilePageState extends State { ), _buildTile( '出生日期', - userProvider.userInfoModel.birthdayValue.text.make(), + userProvider.userInfoModel!.birthdayValue.text.make(), onPressed: () async { - DateTime date = await BeeDatePicker.pick(DateTime.now()); + DateTime? date = await BeeDatePicker.pick(DateTime.now()); if (date != null) userProvider.setBirthday(date); }, ), diff --git a/lib/pages/personal/widget/refund_shop_card.dart b/lib/pages/personal/widget/refund_shop_card.dart index e52b3f9d..b8f469d1 100644 --- a/lib/pages/personal/widget/refund_shop_card.dart +++ b/lib/pages/personal/widget/refund_shop_card.dart @@ -5,8 +5,8 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class RefundShopCard extends StatelessWidget { - final String imagePath, content, specs; - RefundShopCard({Key key, this.imagePath, this.content, this.specs}) + final String? imagePath, content, specs; + RefundShopCard({Key? key, this.imagePath, this.content, this.specs}) : super(key: key); @override @@ -23,7 +23,7 @@ class RefundShopCard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ Image.asset( - imagePath, + imagePath!, height: 179.w, width: 173.w, fit: BoxFit.fill, @@ -35,7 +35,7 @@ class RefundShopCard extends StatelessWidget { Container( width: 458.w, child: Text( - content, + content!, overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( @@ -48,7 +48,7 @@ class RefundShopCard extends StatelessWidget { Container( width: 456.w, child: Text( - specs, + specs!, overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( diff --git a/lib/pages/personal/widget/refund_tile_card.dart b/lib/pages/personal/widget/refund_tile_card.dart index 6fcf919a..17a6222e 100644 --- a/lib/pages/personal/widget/refund_tile_card.dart +++ b/lib/pages/personal/widget/refund_tile_card.dart @@ -7,8 +7,8 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class RefundTileCard extends StatefulWidget { - final List> listTile; - RefundTileCard({Key key, this.listTile}) : super(key: key); + final List>? listTile; + RefundTileCard({Key? key, this.listTile}) : super(key: key); @override _RefundTileCardState createState() => _RefundTileCardState(); @@ -51,7 +51,7 @@ class _RefundTileCardState extends State { return Container( width: double.infinity, child: Column( - children: widget.listTile + children: widget.listTile! .map( (item) => InkWell( onTap: item['fun'], diff --git a/lib/pages/property/property_index.dart b/lib/pages/property/property_index.dart index 9c6fe21a..4819caca 100644 --- a/lib/pages/property/property_index.dart +++ b/lib/pages/property/property_index.dart @@ -18,7 +18,7 @@ import 'widget/property_card.dart'; //TODO CLEAN BOTTOM CODES. @Deprecated("sh*t property_index need to be cleaned.") class PropertyIndex extends StatefulWidget { - PropertyIndex({Key key}) : super(key: key); + PropertyIndex({Key? key}) : super(key: key); @override _PropertyIndexState createState() => _PropertyIndexState(); @@ -33,7 +33,7 @@ class _PropertyIndexState extends State EasyRefreshController _refreshController = EasyRefreshController(); int _page = 1; - int _pageCount = 0; + int? _pageCount = 0; List _models = []; Future> _getItems() async { BaseListModel model = await NetUtil().getList( @@ -44,7 +44,7 @@ class _PropertyIndexState extends State }, ); _pageCount = model.pageCount; - return model.tableList.map((e) => BoardItemModel.fromJson(e)).toList(); + return model.tableList!.map((e) => BoardItemModel.fromJson(e)).toList(); } @override @@ -71,7 +71,7 @@ class _PropertyIndexState extends State onLoad: () async { _page++; _models.addAll(await _getItems()); - if (_page >= _pageCount) _refreshController.finishLoad(noMore: true); + if (_page >= _pageCount!) _refreshController.finishLoad(noMore: true); setState(() {}); }, child: CustomScrollView( @@ -109,7 +109,7 @@ class _PropertyIndexState extends State delegate: SliverChildBuilderDelegate( (context, index) { final BoardItemModel model = _models[index]; - BoardItemModel preModel; + BoardItemModel? preModel; if (index >= 1) preModel = _models[index - 1]; return Padding( padding: EdgeInsets.only(bottom: 8.w), diff --git a/lib/pages/property/widget/property_card.dart b/lib/pages/property/widget/property_card.dart index cf071e3d..f3b6ac26 100644 --- a/lib/pages/property/widget/property_card.dart +++ b/lib/pages/property/widget/property_card.dart @@ -7,7 +7,7 @@ import 'package:url_launcher/url_launcher.dart'; import 'package:aku_community/utils/headers.dart'; class PropertyCard extends StatelessWidget { - PropertyCard({Key key}) : super(key: key); + PropertyCard({Key? key}) : super(key: key); final List> _listCard = [ { diff --git a/lib/pages/setting_page/about_page/about_page.dart b/lib/pages/setting_page/about_page/about_page.dart index c596d4a7..52fac45a 100644 --- a/lib/pages/setting_page/about_page/about_page.dart +++ b/lib/pages/setting_page/about_page/about_page.dart @@ -5,7 +5,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class AboutPage extends StatelessWidget { - const AboutPage({Key key}) : super(key: key); + const AboutPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/setting_page/account_manager_page.dart b/lib/pages/setting_page/account_manager_page.dart index 3647526f..db209bc7 100644 --- a/lib/pages/setting_page/account_manager_page.dart +++ b/lib/pages/setting_page/account_manager_page.dart @@ -8,7 +8,7 @@ import 'package:aku_community/pages/sign/sign_in_page.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class AccountManagerPage extends StatefulWidget { - AccountManagerPage({Key key}) : super(key: key); + AccountManagerPage({Key? key}) : super(key: key); @override _AccountManagerPageState createState() => _AccountManagerPageState(); diff --git a/lib/pages/setting_page/agreement_page/privacy_page.dart b/lib/pages/setting_page/agreement_page/privacy_page.dart index 6e9021df..6dac5289 100644 --- a/lib/pages/setting_page/agreement_page/privacy_page.dart +++ b/lib/pages/setting_page/agreement_page/privacy_page.dart @@ -4,7 +4,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class PrivacyPage extends StatefulWidget { - PrivacyPage({Key key}) : super(key: key); + PrivacyPage({Key? key}) : super(key: key); @override _PrivacyPageState createState() => _PrivacyPageState(); } diff --git a/lib/pages/setting_page/feedback_page/feedback_page.dart b/lib/pages/setting_page/feedback_page/feedback_page.dart index e9f7172f..b8966991 100644 --- a/lib/pages/setting_page/feedback_page/feedback_page.dart +++ b/lib/pages/setting_page/feedback_page/feedback_page.dart @@ -13,7 +13,7 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/picker/grid_image_picker.dart'; class FeedBackPage extends StatefulWidget { - FeedBackPage({Key key}) : super(key: key); + FeedBackPage({Key? key}) : super(key: key); @override _FeedBackPageState createState() => _FeedBackPageState(); @@ -67,8 +67,8 @@ class _FeedBackPageState extends State { Widget _inkWellSubmit() { return InkWell( onTap: () async { - if (_formKey.currentState.validate()) { - if (_files?.isNotEmpty ?? false) { + if (_formKey.currentState!.validate()) { + if (_files.isNotEmpty) { //TODO upload file } var cancelAction = BotToast.showLoading(); diff --git a/lib/pages/setting_page/invite_page/invite_page.dart b/lib/pages/setting_page/invite_page/invite_page.dart index 5df92cbe..de5e256e 100644 --- a/lib/pages/setting_page/invite_page/invite_page.dart +++ b/lib/pages/setting_page/invite_page/invite_page.dart @@ -7,7 +7,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class InvitePage extends StatelessWidget { - const InvitePage({Key key}) : super(key: key); + const InvitePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/setting_page/settings_page.dart b/lib/pages/setting_page/settings_page.dart index bfff0bed..b4220ff1 100644 --- a/lib/pages/setting_page/settings_page.dart +++ b/lib/pages/setting_page/settings_page.dart @@ -19,7 +19,7 @@ import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class SettingsPage extends StatefulWidget { - SettingsPage({Key key}) : super(key: key); + SettingsPage({Key? key}) : super(key: key); @override _SettingsPageState createState() => _SettingsPageState(); @@ -27,9 +27,9 @@ class SettingsPage extends StatefulWidget { class _SettingsPageState extends State { Widget _buildTile({ - String title, - VoidCallback onTap, - Widget suffix, + required String title, + VoidCallback? onTap, + Widget? suffix, }) { return MaterialButton( color: Colors.white, diff --git a/lib/pages/sign/sign_func.dart b/lib/pages/sign/sign_func.dart index 55015624..ddb2f5ae 100644 --- a/lib/pages/sign/sign_func.dart +++ b/lib/pages/sign/sign_func.dart @@ -32,7 +32,7 @@ class SignFunc { } static Future login(String phone, String code) async { - Response response = await NetUtil().dio.post( + Response response = await NetUtil().dio!.post( API.login.loginBySMS, data: {'tel': phone, 'code': code}, ); @@ -46,7 +46,7 @@ class SignFunc { .toList(); } - static Future> getUnitInfo(int id) async { + static Future> getUnitInfo(int? id) async { BaseModel model = await NetUtil().get( API.login.unitInfo, params: {"buildingId": id}, @@ -59,9 +59,9 @@ class SignFunc { ///注册 static Future signUp() async { final signUpProvider = - Provider.of(Get.context, listen: false); - final userProvider = Provider.of(Get.context, listen: false); - Response response = await NetUtil().dio.post( + Provider.of(Get.context!, listen: false); + final userProvider = Provider.of(Get.context!, listen: false); + Response response = await NetUtil().dio!.post( API.login.signUp, data: signUpProvider.toMap, ); @@ -73,13 +73,13 @@ class SignFunc { return false; } - static Future getUserInfo() async { + static Future getUserInfo() async { BaseModel baseModel = await NetUtil().get(API.user.userProfile); if (baseModel.data == null) return null; return UserInfoModel.fromJson(baseModel.data); } - static Future getUserDetail() async { + static Future getUserDetail() async { BaseModel baseModel = await NetUtil().get( API.user.userDetail, ); diff --git a/lib/pages/sign/sign_in_page.dart b/lib/pages/sign/sign_in_page.dart index 22b304ea..1af2533d 100644 --- a/lib/pages/sign/sign_in_page.dart +++ b/lib/pages/sign/sign_in_page.dart @@ -30,7 +30,7 @@ import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/utils/headers.dart'; class SignInPage extends StatefulWidget { - SignInPage({Key key}) : super(key: key); + SignInPage({Key? key}) : super(key: key); @override _SignInPageState createState() => _SignInPageState(); @@ -40,7 +40,7 @@ class _SignInPageState extends State { TextEditingController _phone = new TextEditingController(); TextEditingController _code = new TextEditingController(); - Timer _timer; + Timer? _timer; bool get validPhone => RegexUtil.isMobileSimple(_phone.text); bool get _canGetCode { @@ -59,7 +59,7 @@ class _SignInPageState extends State { ); } - Future _showLoginVerify() async { + Future _showLoginVerify() async { return await showCupertinoDialog( barrierDismissible: false, context: context, @@ -84,9 +84,9 @@ class _SignInPageState extends State { } _parseLogin(bool result) async { - final userProvider = Provider.of(Get.context, listen: false); + final userProvider = Provider.of(Get.context!, listen: false); final signUpProvider = - Provider.of(Get.context, listen: false); + Provider.of(Get.context!, listen: false); if (!result) return; CancelFunc cancel = BotToast.showLoading(); Response response = await SignFunc.login(_phone.text, _code.text); @@ -120,7 +120,7 @@ class _SignInPageState extends State { else if (TextUtil.isEmpty(_code.text)) BotToast.showText(text: '验证码不能为空'); else { - bool result = await _showLoginVerify(); + bool result = await (_showLoginVerify() as FutureOr); _parseLogin(result); } }, @@ -137,7 +137,7 @@ class _SignInPageState extends State { startTick() { _timer = Timer.periodic(Duration(seconds: 1), (timer) { if (timer.tick >= 60) { - _timer.cancel(); + _timer!.cancel(); _timer = null; } setState(() {}); @@ -145,11 +145,11 @@ class _SignInPageState extends State { } _buildTextField({ - String hint, - Widget prefix, - Widget suffix, + String? hint, + Widget? prefix, + Widget? suffix, TextInputType type = TextInputType.number, - TextEditingController controller, + TextEditingController? controller, }) { return Container( margin: EdgeInsets.symmetric(horizontal: 82.w), @@ -258,7 +258,7 @@ class _SignInPageState extends State { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, child: Text( _timer?.isActive ?? false - ? '${60 - _timer.tick}' + ? '${60 - _timer!.tick}' : '获取验证码', style: TextStyle( color: BaseStyle.color999999, diff --git a/lib/pages/sign/sign_up/sign_up_set_nickname_page.dart b/lib/pages/sign/sign_up/sign_up_set_nickname_page.dart index 582839e5..1ab1422b 100644 --- a/lib/pages/sign/sign_up/sign_up_set_nickname_page.dart +++ b/lib/pages/sign/sign_up/sign_up_set_nickname_page.dart @@ -15,7 +15,7 @@ import 'package:aku_community/provider/sign_up_provider.dart'; import 'package:aku_community/utils/headers.dart'; class SignUpSetNicknamePage extends StatefulWidget { - SignUpSetNicknamePage({Key key}) : super(key: key); + SignUpSetNicknamePage({Key? key}) : super(key: key); @override _SignUpSetNicknamePageState createState() => _SignUpSetNicknamePageState(); @@ -26,7 +26,7 @@ class _SignUpSetNicknamePageState extends State { TextEditingController _textEditingController = TextEditingController(); @override void dispose() { - _textEditingController?.dispose(); + _textEditingController.dispose(); super.dispose(); } @@ -72,7 +72,7 @@ class _SignUpSetNicknamePageState extends State { shape: StadiumBorder(), onPressed: () async { final cancel = BotToast.showLoading(); - if (_globalKey.currentState.validate()) { + if (_globalKey.currentState!.validate()) { final signUpProvider = Provider.of(context, listen: false); signUpProvider.setNickName(_textEditingController.text); diff --git a/lib/pages/sign/sign_up/sign_up_verify_page.dart b/lib/pages/sign/sign_up/sign_up_verify_page.dart index 21a0551c..0b057dc1 100644 --- a/lib/pages/sign/sign_up/sign_up_verify_page.dart +++ b/lib/pages/sign/sign_up/sign_up_verify_page.dart @@ -13,7 +13,7 @@ import 'package:aku_community/provider/sign_up_provider.dart'; import 'package:aku_community/utils/headers.dart'; class SignUpVerifyPage extends StatefulWidget { - SignUpVerifyPage({Key key}) : super(key: key); + SignUpVerifyPage({Key? key}) : super(key: key); @override _SignUpVerifyPageState createState() => _SignUpVerifyPageState(); @@ -57,7 +57,7 @@ class _SignUpVerifyPageState extends State { controller: _idNumberController, validator: (value) { if (TextUtil.isEmpty(value)) return '身份证号不能为空'; - if (!RegexUtil.isIDCard(value)) + if (!RegexUtil.isIDCard(value!)) return '身份证格式错误'; else return null; @@ -82,7 +82,7 @@ class _SignUpVerifyPageState extends State { final signUpProvider = Provider.of(context, listen: false); - if (_formKey.currentState.validate()) { + if (_formKey.currentState!.validate()) { bool result = await SignFunc.signUp(); if (result) Get.offAll(() => TabNavigator()); } diff --git a/lib/pages/splash/splash_page.dart b/lib/pages/splash/splash_page.dart index 346e18d3..e6fbf82c 100644 --- a/lib/pages/splash/splash_page.dart +++ b/lib/pages/splash/splash_page.dart @@ -20,7 +20,7 @@ import 'package:aku_community/utils/hive_store.dart'; //TODO splashPage class SplashPage extends StatefulWidget { - SplashPage({Key key}) : super(key: key); + SplashPage({Key? key}) : super(key: key); @override _SplashPageState createState() => _SplashPageState(); @@ -47,8 +47,8 @@ class _SplashPageState extends State { final appProvider = Provider.of(context, listen: false); appProvider.initApplications(); appProvider.startLocation(); - if (HiveStore.appBox.get('login') ?? false) { - await userProvider.setLogin(HiveStore.appBox.get('token')); + if (HiveStore.appBox!.get('login') ?? false) { + await userProvider.setLogin(HiveStore.appBox!.get('token')); } } diff --git a/lib/pages/tab_navigator.dart b/lib/pages/tab_navigator.dart index 880af4e0..6ccb5017 100644 --- a/lib/pages/tab_navigator.dart +++ b/lib/pages/tab_navigator.dart @@ -12,7 +12,7 @@ import 'property/property_index.dart'; class TabNavigator extends StatefulWidget { const TabNavigator({ - Key key, + Key? key, }) : super(key: key); @override _TabNavigatorState createState() => _TabNavigatorState(); @@ -20,9 +20,9 @@ class TabNavigator extends StatefulWidget { class _TabNavigatorState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + TabController? _tabController; int _currentIndex = 0; - DateTime _lastPressed; + DateTime? _lastPressed; //页面列表 List _pages = []; @@ -81,7 +81,7 @@ class _TabNavigatorState extends State body: WillPopScope( onWillPop: () async { if (_lastPressed == null || - DateTime.now().difference(_lastPressed) > Duration(seconds: 1)) { + DateTime.now().difference(_lastPressed!) > Duration(seconds: 1)) { //两次点击间隔超过1秒重新计算 _lastPressed = DateTime.now(); return false; @@ -103,7 +103,7 @@ class _TabNavigatorState extends State selectedFontSize: 20.sp, unselectedFontSize: 20.sp, onTap: (index) { - _tabController.animateTo(index, curve: Curves.easeInOutCubic); + _tabController!.animateTo(index, curve: Curves.easeInOutCubic); setFunc(() => _currentIndex = index); }, ); diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index cd727a2f..ca6afd51 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/base/base_style.dart'; @@ -17,23 +16,22 @@ import 'package:aku_community/pages/things_page/widget/add_fixed_submit_page.dar import 'package:aku_community/pages/things_page/widget/bee_list_view.dart'; import 'package:aku_community/pages/things_page/widget/fixed_check_box.dart'; import 'package:aku_community/pages/things_page/widget/fixed_detail_page.dart'; -import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/utils/bee_map.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:aku_community/widget/views/horizontal_image_view.dart'; class FixedSubmitPage extends StatefulWidget { - FixedSubmitPage({Key key}) : super(key: key); + FixedSubmitPage({Key? key}) : super(key: key); @override _FixedSubmitPageState createState() => _FixedSubmitPageState(); } class _FixedSubmitPageState extends State { - EasyRefreshController _easyRefreshController; + EasyRefreshController? _easyRefreshController; bool _isEdit = false; - List _selected = []; + List _selected = []; @override void initState() { super.initState(); @@ -46,7 +44,7 @@ class _FixedSubmitPageState extends State { super.dispose(); } - Color _getColor(int state) { + Color _getColor(int? state) { switch (state) { case 1: case 2: @@ -62,7 +60,7 @@ class _FixedSubmitPageState extends State { } } - bool _canSkew(int state) { + bool _canSkew(int? state) { switch (state) { case 1: case 2: @@ -101,13 +99,13 @@ class _FixedSubmitPageState extends State { padding: EdgeInsets.fromLTRB(24.w, 24.w, 24.w, 0), child: Row( children: [ - BeeMap.fixTag[model.type].text + BeeMap.fixTag[model.type!]!.text .color(ktextPrimary) .bold .size(32.sp) .make(), Spacer(), - BeeMap.fixState[model.status].text + BeeMap.fixState[model.status!]!.text .color(_getColor(model.status)) .size(24.sp) .make(), @@ -129,7 +127,7 @@ class _FixedSubmitPageState extends State { padding: EdgeInsets.symmetric( horizontal: 24.w, ), - child: model.reportDetail.text + child: model.reportDetail!.text .color(ktextSubColor) .size(28.sp) .ellipsis @@ -138,9 +136,9 @@ class _FixedSubmitPageState extends State { // 16.hb, Padding( padding: EdgeInsets.only(left: 8.w), - child: model.imgUrls.length != 0 - ? HorizontalImageView(List.generate(model.imgUrls.length, - (index) => model.imgUrls[index].url)) + child: model.imgUrls!.length != 0 + ? HorizontalImageView(List.generate(model.imgUrls!.length, + (index) => model.imgUrls![index].url)) : SizedBox(), ), ], @@ -204,7 +202,7 @@ class _FixedSubmitPageState extends State { await ManagerFunc.reportRepairDelete(_selected); Get.back(); _selected.clear(); - _easyRefreshController.callRefresh(); + _easyRefreshController!.callRefresh(); }, ) ], @@ -213,7 +211,6 @@ class _FixedSubmitPageState extends State { @override Widget build(BuildContext context) { - UserProvider userProvider = Provider.of(context); return BeeScaffold( systemStyle: SystemStyle.yellowBottomBar, title: '报事报修', @@ -227,11 +224,11 @@ class _FixedSubmitPageState extends State { setState(() {}); }) ], - body: BeeListView( + body: BeeListView( controller: _easyRefreshController, path: API.manager.fixedSubmit, convert: (model) { - return model.tableList + return model.tableList! .map((e) => FixedSubmitModel.fromJson(e)) .toList(); }, @@ -260,8 +257,8 @@ class _FixedSubmitPageState extends State { Get.dialog(_showDeletDialog()); } : () async { - bool needRefresh = await Get.to(() => AddFixedSubmitPage()); - if (needRefresh == null) _easyRefreshController.callRefresh(); + bool? needRefresh = await Get.to(() => AddFixedSubmitPage()); + if (needRefresh == null) _easyRefreshController!.callRefresh(); }, child: _isEdit ? '删除订单'.text.bold.size(32.sp).make() diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index bf44523d..27f4528c 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -26,17 +26,17 @@ import 'package:aku_community/widget/picker/bee_house_picker.dart'; import 'package:aku_community/widget/picker/grid_image_picker.dart'; class AddFixedSubmitPage extends StatefulWidget { - AddFixedSubmitPage({Key key}) : super(key: key); + AddFixedSubmitPage({Key? key}) : super(key: key); @override _AddFixedSubmitPageState createState() => _AddFixedSubmitPageState(); } class _AddFixedSubmitPageState extends State { - TextEditingController _textEditingController; - String reportText; + TextEditingController? _textEditingController; + String? reportText; List _buttons = ['公区保修', '家庭维修']; - int _selectType; + int? _selectType; List _files = []; @override void initState() { @@ -161,7 +161,7 @@ class _AddFixedSubmitPageState extends State { ); } - bool _canSubmit(int seletType, String text) { + bool _canSubmit(int? seletType, String text) { if (seletType == null) { return false; } else if (text.isEmpty) { @@ -187,20 +187,20 @@ class _AddFixedSubmitPageState extends State { ], ), bottomNavi: BottomButton( - onPressed: _canSubmit(_selectType, _textEditingController.text) + onPressed: _canSubmit(_selectType, _textEditingController!.text) ? () async { VoidCallback cancel = BotToast.showLoading(); - List urls = await NetUtil() + List urls = await NetUtil() .uploadFiles(_files, API.upload.uploadRepair); BaseModel baseModel = await ManagerFunc.reportRepairInsert( - appProvider.selectedHouse.estateId, - _selectType + 1, - _textEditingController.text, + appProvider.selectedHouse!.estateId, + _selectType! + 1, + _textEditingController!.text, urls); - if (baseModel.status) { + if (baseModel.status!) { Get.off(FinishFixedSubmitPage()); } else - BotToast.showText(text: baseModel.message); + BotToast.showText(text: baseModel.message!); cancel(); } : () { diff --git a/lib/pages/things_page/widget/bee_list_view.dart b/lib/pages/things_page/widget/bee_list_view.dart index bb717ff3..8a179286 100644 --- a/lib/pages/things_page/widget/bee_list_view.dart +++ b/lib/pages/things_page/widget/bee_list_view.dart @@ -30,7 +30,7 @@ class BeeListView extends StatefulWidget { final String path; ///same as EasyRefreshController - final EasyRefreshController controller; + final EasyRefreshController? controller; ///转换器 /// @@ -56,13 +56,13 @@ class BeeListView extends StatefulWidget { final int size; ///额外的参数 - final Map extraParams; + final Map? extraParams; BeeListView({ - Key key, - @required this.path, - @required this.controller, - @required this.convert, - @required this.builder, + Key? key, + required this.path, + required this.controller, + required this.convert, + required this.builder, this.size = 10, this.extraParams, }) : super(key: key); @@ -74,7 +74,7 @@ class BeeListView extends StatefulWidget { class _BeeListViewState extends State { int _pageNum = 1; BaseListModel _model = BaseListModel.zero(); - List _models = []; + List _models = []; Map get _params { Map tempMap = { 'pageNum': _pageNum, @@ -96,7 +96,7 @@ class _BeeListViewState extends State { widget.path, params: _params, ); - _models = widget.convert(_model); + _models = widget.convert(_model) as List; widget.controller?.resetLoadState(); if (mounted) setState(() {}); }, @@ -107,9 +107,9 @@ class _BeeListViewState extends State { widget.path, params: _params, ); - _models.addAll(widget.convert(_model) as List); - if (_pageNum >= _model.pageCount) - widget.controller.finishLoad(noMore: true); + _models.addAll(widget.convert(_model) as List); + if (_pageNum >= _model.pageCount!) + widget.controller!.finishLoad(noMore: true); setState(() {}); }, child: widget.builder(_models), diff --git a/lib/pages/things_page/widget/finish_fixed_submit_page.dart b/lib/pages/things_page/widget/finish_fixed_submit_page.dart index 9a1c24bc..3de9e2a3 100644 --- a/lib/pages/things_page/widget/finish_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/finish_fixed_submit_page.dart @@ -8,7 +8,7 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class FinishFixedSubmitPage extends StatelessWidget { - const FinishFixedSubmitPage({Key key}) : super(key: key); + const FinishFixedSubmitPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/things_page/widget/fixed_check_box.dart b/lib/pages/things_page/widget/fixed_check_box.dart index d10124c2..f0b5de04 100644 --- a/lib/pages/things_page/widget/fixed_check_box.dart +++ b/lib/pages/things_page/widget/fixed_check_box.dart @@ -5,8 +5,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:aku_community/base/base_style.dart'; class FixedCheckBox extends StatefulWidget { - final Function(bool isSelect) onChanged; - FixedCheckBox({Key key, this.onChanged}) : super(key: key); + final Function(bool isSelect)? onChanged; + FixedCheckBox({Key? key, this.onChanged}) : super(key: key); @override _FixedCheckBoxState createState() => _FixedCheckBoxState(); @@ -22,7 +22,7 @@ class _FixedCheckBoxState extends State { setState(() { _isSelected = !_isSelected; }); - widget.onChanged(_isSelected); + widget.onChanged!(_isSelected); }, child: AnimatedContainer( duration: Duration(milliseconds: 300), diff --git a/lib/pages/things_page/widget/fixed_detail_page.dart b/lib/pages/things_page/widget/fixed_detail_page.dart index 8418f08c..8fcaf755 100644 --- a/lib/pages/things_page/widget/fixed_detail_page.dart +++ b/lib/pages/things_page/widget/fixed_detail_page.dart @@ -20,10 +20,10 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/views/horizontal_image_view.dart'; class FixedDetailPage extends StatefulWidget { - final int id; + final int? id; FixedDetailPage( this.id, { - Key key, + Key? key, }) : super(key: key); @override @@ -40,10 +40,10 @@ class _FixedDetailPageState extends State { bool _onLoading = true; EasyRefreshController _easyRefreshController = EasyRefreshController(); FixedDetailModel _model = FixedDetailModel(); - bool get showRepairCard => _model?.appDispatchListVo != null; - bool get showProcessCard => _model.appProcessRecordVo.isNotEmpty; + bool get showRepairCard => _model.appDispatchListVo != null; + bool get showProcessCard => _model.appProcessRecordVo!.isNotEmpty; - bool _canComplete(int state) { + bool _canComplete(int? state) { switch (state) { case 1: case 2: @@ -59,7 +59,7 @@ class _FixedDetailPageState extends State { } } - Color _getColor(int state) { + Color _getColor(int? state) { switch (state) { case 1: case 2: @@ -99,13 +99,13 @@ class _FixedDetailPageState extends State { borderRadius: BorderRadius.circular(36.w), color: Colors.transparent, ), - child: BeeMap.fixTag[model.appReportRepairVo.type].text.black + child: BeeMap.fixTag[model.appReportRepairVo!.type!]!.text.black .size(20.sp) .make(), ), Spacer(), - BeeMap.fixState[model.appReportRepairVo.status].text - .color(_getColor(_model.appReportRepairVo.status)) + BeeMap.fixState[model.appReportRepairVo!.status!]!.text + .color(_getColor(_model.appReportRepairVo!.status)) .size(24.sp) .bold .make() @@ -119,7 +119,7 @@ class _FixedDetailPageState extends State { 24.w.heightBox, Padding( padding: EdgeInsets.symmetric(horizontal: 28.w), - child: model.appReportRepairVo.reportDetail.text.black + child: model.appReportRepairVo!.reportDetail!.text.black .size(28.sp) .maxLines(8) .overflow(TextOverflow.ellipsis) @@ -128,7 +128,7 @@ class _FixedDetailPageState extends State { Padding( padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 8.w), child: HorizontalImageView( - model.appReportRepairVo.imgUrls.map((e) => e.url).toList()), + model.appReportRepairVo!.imgUrls!.map((e) => e.url).toList()), ) ], ), @@ -157,14 +157,14 @@ class _FixedDetailPageState extends State { children: [ '订单编号'.text.color(ktextSubColor).size(28.sp).make(), Spacer(), - model.appDispatchListVo.code.text.black.size(28.sp).make(), + model.appDispatchListVo!.code!.text.black.size(28.sp).make(), ], ), Row( children: [ '下单时间'.text.color(ktextSubColor).size(28.sp).make(), Spacer(), - model.appDispatchListVo.orderDate.text.black + model.appDispatchListVo!.orderDate!.text.black .size(28.sp) .make() ], @@ -173,14 +173,14 @@ class _FixedDetailPageState extends State { children: [ '派单类型'.text.color(ktextSubColor).size(28.sp).make(), Spacer(), - model.appDispatchListVo.type.text.black.size(28.sp).make(), + model.appDispatchListVo!.type!.text.black.size(28.sp).make(), ], ), Row( children: [ '维修人员'.text.color(ktextSubColor).size(28.sp).make(), Spacer(), - model.appDispatchListVo.operatorName.text.black + model.appDispatchListVo!.operatorName!.text.black .size(28.sp) .make(), ], @@ -189,7 +189,7 @@ class _FixedDetailPageState extends State { children: [ '分配人'.text.color(ktextSubColor).size(28.sp).make(), Spacer(), - model.appDispatchListVo.distributorName.text.black + model.appDispatchListVo!.distributorName!.text.black .size(28.sp) .make(), ], @@ -215,15 +215,15 @@ class _FixedDetailPageState extends State { 24.w.heightBox, BeeDivider.horizontal(), 24.w.heightBox, - ...model.appProcessRecordVo + ...model.appProcessRecordVo! .map((e) => Row( children: [ - BeeMap.processClass[e.operationType].text + BeeMap.processClass[e.operationType!]!.text .color(ktextSubColor) .size(28.sp) .make(), Spacer(), - e.operationDate.text.black.size(28.sp).make(), + e.operationDate!.text.black.size(28.sp).make(), ], )) .toList() @@ -249,11 +249,11 @@ class _FixedDetailPageState extends State { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onPressed: () async { CancelModel _cancel = - _allowCancel(_model.appReportRepairVo.status); + _allowCancel(_model.appReportRepairVo!.status); if (_cancel.cancel) { BotToast.showLoading(); await ManagerFunc.reportRepairCancel( - _model.appReportRepairVo.id); + _model.appReportRepairVo!.id); BotToast.closeAllLoading(); Get.back(); } else { @@ -364,7 +364,7 @@ class _FixedDetailPageState extends State { ); } - CancelModel _allowCancel(int state) { + CancelModel _allowCancel(int? state) { switch (state) { case 1: case 2: @@ -465,12 +465,12 @@ class _FixedDetailPageState extends State { disabledColor: kDarkSubColor, disabledTextColor: ktextPrimary.withOpacity(0.8), minWidth: 375.w, - onPressed: _canComplete(_model.appReportRepairVo.status) + onPressed: _canComplete(_model.appReportRepairVo!.status) ? () async { BaseModel baseModel = await ManagerFunc.reportRepairComplete( - _model.appReportRepairVo.id); - if (baseModel.status) { + _model.appReportRepairVo!.id); + if (baseModel.status!) { Get.back(); Get.back(); } diff --git a/lib/pages/things_page/widget/fixed_evaluate_page.dart b/lib/pages/things_page/widget/fixed_evaluate_page.dart index e1074b2e..1cc39ec7 100644 --- a/lib/pages/things_page/widget/fixed_evaluate_page.dart +++ b/lib/pages/things_page/widget/fixed_evaluate_page.dart @@ -15,15 +15,15 @@ import 'package:aku_community/widget/bee_scaffold.dart'; class FixedEvaluatePage extends StatefulWidget { final FixedDetailModel model; - FixedEvaluatePage(this.model, {Key key}) : super(key: key); + FixedEvaluatePage(this.model, {Key? key}) : super(key: key); @override _FixedEvaluatePageState createState() => _FixedEvaluatePageState(); } class _FixedEvaluatePageState extends State { - int _rating; - TextEditingController _textEditingController; + int? _rating; + TextEditingController? _textEditingController; @override void initState() { super.initState(); @@ -32,7 +32,7 @@ class _FixedEvaluatePageState extends State { @override void dispose() { - _textEditingController.dispose(); + _textEditingController!.dispose(); super.dispose(); } @@ -105,14 +105,14 @@ class _FixedEvaluatePageState extends State { 100.w.heightBox, MaterialButton( onPressed: () async { - if (_textEditingController.text.isEmpty) { + if (_textEditingController!.text.isEmpty) { BotToast.showText(text: '评价内容不能为空!'); } else { BaseModel baseModel = await ManagerFunc.reportRepairEvaluate( - widget.model.appReportRepairVo.id, + widget.model.appReportRepairVo!.id, _rating, - _textEditingController.text); - if (baseModel.status) { + _textEditingController!.text); + if (baseModel.status!) { Get.back(); } } diff --git a/lib/pages/visitor_access_page/visitor_access_page.dart b/lib/pages/visitor_access_page/visitor_access_page.dart index b83881fb..33e81a2e 100644 --- a/lib/pages/visitor_access_page/visitor_access_page.dart +++ b/lib/pages/visitor_access_page/visitor_access_page.dart @@ -20,7 +20,7 @@ import 'package:aku_community/widget/common_input.dart'; import 'package:aku_community/widget/picker/bee_date_picker.dart'; class VisitorAccessPage extends StatefulWidget { - VisitorAccessPage({Key key}) : super(key: key); + VisitorAccessPage({Key? key}) : super(key: key); @override _VisitorAccessPageState createState() => _VisitorAccessPageState(); @@ -29,7 +29,7 @@ class VisitorAccessPage extends StatefulWidget { class _VisitorAccessPageState extends State { TextEditingController _userName = new TextEditingController(); TextEditingController _userCarNum = new TextEditingController(); - DateTime dateTime; + DateTime? dateTime; int _selectSex = 1; GlobalKey formKey = GlobalKey(); @@ -192,7 +192,7 @@ class _VisitorAccessPageState extends State { Widget _selectTime() { return InkWell( onTap: () async { - DateTime date = await BeeDatePicker.pick(DateTime.now()); + DateTime? date = await BeeDatePicker.pick(DateTime.now()); if (date != null) dateTime = date; setState(() {}); }, @@ -239,15 +239,15 @@ class _VisitorAccessPageState extends State { } Widget _create( - int id, - int type, - String tel, + int? id, + int? type, + String? tel, ) { final appProvider = Provider.of(context); return MaterialButton( onPressed: () async { - String result = await ManagerFunc.shareVisitor( - estateId: appProvider.selectedHouse.estateId, + String? result = await ManagerFunc.shareVisitor( + estateId: appProvider.selectedHouse!.estateId, name: _userName.text, sex: _selectSex, carNumber: _userCarNum.text, @@ -315,8 +315,8 @@ class _VisitorAccessPageState extends State { child: Column( children: [ _buildHouseCard( - S.of(context).tempPlotName, - appProvider.selectedHouse.roomName, + S.of(context)!.tempPlotName, + appProvider.selectedHouse!.roomName!, ), _input( '访客姓名', @@ -338,9 +338,9 @@ class _VisitorAccessPageState extends State { _selectTime(), SizedBox(height: 64.w), _create( - appProvider.selectedHouse.estateId, - userProvider.userDetailModel.type, - userProvider.userDetailModel.tel, + appProvider.selectedHouse!.estateId, + userProvider.userDetailModel!.type, + userProvider.userDetailModel!.tel, ), _tips(), ], diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index ac03a5e6..314f0dab 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart' show IterableExtension; import 'package:flutter/material.dart'; import 'package:amap_flutter_location/amap_flutter_location.dart'; @@ -46,8 +47,8 @@ class AppProvider extends ChangeNotifier { ///初始化我的应用 initApplications() { - if (HiveStore.appBox.containsKey('app')) - _myApplications = (HiveStore.appBox.get('app') as List) + if (HiveStore.appBox!.containsKey('app')) + _myApplications = (HiveStore.appBox!.get('app') as List) .map((e) => AO.fromRaw(e)) .toList(); notifyListeners(); @@ -61,14 +62,15 @@ class AppProvider extends ChangeNotifier { _myApplications.insert(0, app); _myApplications.removeLast(); } - HiveStore.appBox.put('app', _myApplications.map((e) => e.title).toList()); + HiveStore.appBox!.put('app', _myApplications.map((e) => e.title).toList()); notifyListeners(); } ///移除我的应用 removeApplication(AO obj) { if (_myApplications.remove(obj)) { - HiveStore.appBox.put('app', _myApplications.map((e) => e.title).toList()); + HiveStore.appBox! + .put('app', _myApplications.map((e) => e.title).toList()); notifyListeners(); } } @@ -82,15 +84,15 @@ class AppProvider extends ChangeNotifier { notifyListeners(); } - RealTimeWeatherModel _weatherModel; - RealTimeWeatherModel get weatherModel => _weatherModel; + RealTimeWeatherModel? _weatherModel; + RealTimeWeatherModel? get weatherModel => _weatherModel; String get weatherTemp => _weatherModel?.result?.realtime?.temperature?.toStringAsFixed(0) ?? ''; String get weatherType { if (_weatherModel?.result?.realtime?.skycon == null) return ''; - switch (_weatherModel.result.realtime.skycon) { + switch (_weatherModel!.result!.realtime!.skycon) { case 'CLEAR_DAY': case 'CLEAR_NIGHT': return '晴'; @@ -134,9 +136,9 @@ class AppProvider extends ChangeNotifier { } } - Map _location; - Map get location => _location; - AMapFlutterLocation _aMapFlutterLocation; + Map? _location; + Map? get location => _location; + late AMapFlutterLocation _aMapFlutterLocation; startLocation() { _aMapFlutterLocation = AMapFlutterLocation(); @@ -161,7 +163,7 @@ class AppProvider extends ChangeNotifier { // Location get location => _location; getWeather() async { Response response = await Dio().get( - 'https://api.caiyunapp.com/v2.5/${AppConfig.caiYunAPI}/${_location['longitude']},${_location['latitude']}/realtime.json', + 'https://api.caiyunapp.com/v2.5/${AppConfig.caiYunAPI}/${_location!['longitude']},${_location!['latitude']}/realtime.json', ); LoggerData.addData(response); _weatherModel = RealTimeWeatherModel.fromJson(response.data); @@ -169,11 +171,11 @@ class AppProvider extends ChangeNotifier { } /// 消息中心 - MessageCenterModel _messageCenterModel; + MessageCenterModel? _messageCenterModel; MessageCenterModel get messageCenterModel => _messageCenterModel ?? MessageCenterModel.zero(); getMessageCenter() async { - Response response = await NetUtil().dio.get(API.message.center); + Response response = await NetUtil().dio!.get(API.message.center); _messageCenterModel = MessageCenterModel.fromJson(response.data); notifyListeners(); } @@ -185,27 +187,25 @@ class AppProvider extends ChangeNotifier { ///更新房屋列表 updateHouses(List items) { - if (items == null) return; if (items.isEmpty) return; - _selectedHouse = items.firstWhere( + _selectedHouse = items.firstWhereOrNull( (element) => element.id == (_selectedHouse?.id ?? -1), - orElse: () => null, ); _houses = items; notifyListeners(); } - HouseModel _selectedHouse; + HouseModel? _selectedHouse; ///选中的房屋 - HouseModel get selectedHouse { - if (_houses?.isEmpty ?? true) return null; + HouseModel? get selectedHouse { + if (_houses.isEmpty) return null; if (_selectedHouse == null) _selectedHouse = _houses.first; return _selectedHouse; } ///设置当前选中的房屋 - setCurrentHouse(HouseModel model) { + setCurrentHouse(HouseModel? model) { _selectedHouse = model; notifyListeners(); } @@ -214,7 +214,7 @@ class AppProvider extends ChangeNotifier { List get carParkingModels => _carParkingModels; Future updateCarParkingModels() async { BaseModel baseModel = await NetUtil().get(API.user.carParkingList); - if (baseModel?.data == null) return []; + if (baseModel.data == null) return []; _carParkingModels = (baseModel.data as List) .map((e) => CarParkingModel.fromJson(e)) .toList(); @@ -225,7 +225,7 @@ class AppProvider extends ChangeNotifier { List get carModels => _carModels; Future updateCarModels() async { BaseModel baseModel = await NetUtil().get(API.user.carList); - if (baseModel?.data == null) return []; + if (baseModel.data == null) return []; _carModels = (baseModel.data as List) .map((e) => CarParkingModel.fromJson(e)) .toList(); diff --git a/lib/provider/sign_up_provider.dart b/lib/provider/sign_up_provider.dart index 1015381d..9c9839a2 100644 --- a/lib/provider/sign_up_provider.dart +++ b/lib/provider/sign_up_provider.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; class SignUpProvider extends ChangeNotifier { - String _nickName; - String get nickName => _nickName; + String? _nickName; + String? get nickName => _nickName; - String _tel; - String get tel => _tel; + String? _tel; + String? get tel => _tel; Map get toMap => { 'nickName': _nickName, diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index ba2eea4f..bfdaacb1 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -18,12 +18,12 @@ class UserProvider extends ChangeNotifier { bool _isLogin = false; bool get isLogin => _isLogin; bool get isNotLogin => !_isLogin; - Future setLogin(int token) async { - final appProvider = Provider.of(Get.context, listen: false); + Future setLogin(int? token) async { + final appProvider = Provider.of(Get.context!, listen: false); _isLogin = true; - NetUtil().dio.options.headers.putIfAbsent('App-Admin-Token', () => token); - HiveStore.appBox.put('token', token); - HiveStore.appBox.put('login', true); + NetUtil().dio!.options.headers.putIfAbsent('App-Admin-Token', () => token); + HiveStore.appBox!.put('token', token); + HiveStore.appBox!.put('login', true); await updateProfile(); await updateUserDetail(); await appProvider.updateHouses(await HouseFunc.houses); @@ -31,16 +31,16 @@ class UserProvider extends ChangeNotifier { } logout() { - final appProvider = Provider.of(Get.context, listen: false); + final appProvider = Provider.of(Get.context!, listen: false); appProvider.setCurrentHouse(null); _isLogin = false; _token = null; _userInfoModel = null; _userDetailModel = null; NetUtil().get(API.user.logout, showMessage: true); - NetUtil().dio.options.headers.remove('App-Admin-Token'); - HiveStore.appBox.delete('token'); - HiveStore.appBox.delete('login'); + NetUtil().dio!.options.headers.remove('App-Admin-Token'); + HiveStore.appBox!.delete('token'); + HiveStore.appBox!.delete('login'); notifyListeners(); } @@ -54,14 +54,14 @@ class UserProvider extends ChangeNotifier { notifyListeners(); } - String _token; + String? _token; String get token => _token ?? ''; - UserInfoModel _userInfoModel; - UserInfoModel get userInfoModel => _userInfoModel; + UserInfoModel? _userInfoModel; + UserInfoModel? get userInfoModel => _userInfoModel; - UserDetailModel _userDetailModel; - UserDetailModel get userDetailModel => _userDetailModel; + UserDetailModel? _userDetailModel; + UserDetailModel? get userDetailModel => _userDetailModel; ///设置性别 Future setSex(int sex) async { @@ -70,8 +70,8 @@ class UserProvider extends ChangeNotifier { params: {'sex': sex}, showMessage: true, ); - if (baseModel.status) { - _userInfoModel.sex = sex; + if (baseModel.status!) { + _userInfoModel!.sex = sex; notifyListeners(); } } @@ -85,8 +85,8 @@ class UserProvider extends ChangeNotifier { }, showMessage: true, ); - if (baseModel.status) { - _userInfoModel.birthday = + if (baseModel.status!) { + _userInfoModel!.birthday = DateUtil.formatDate(date, format: "yyyy-MM-dd HH:mm:ss"); notifyListeners(); } @@ -99,8 +99,8 @@ class UserProvider extends ChangeNotifier { params: {'nickName': name}, showMessage: true, ); - if (baseModel.status) { - _userInfoModel.nickName = name; + if (baseModel.status!) { + _userInfoModel!.nickName = name; notifyListeners(); } } @@ -112,14 +112,14 @@ class UserProvider extends ChangeNotifier { params: {'oldTel': oldTel, 'newTel': newTel, 'code': code}, showMessage: true, ); - if (baseModel.status) { - _userInfoModel.tel = newTel; + if (baseModel.status!) { + _userInfoModel!.tel = newTel; notifyListeners(); } } ///修改头像 - Future updateAvatar(String path) async { + Future updateAvatar(String? path) async { BaseModel model = await NetUtil().post( API.user.udpdateAvatar, params: { @@ -127,7 +127,7 @@ class UserProvider extends ChangeNotifier { }, showMessage: true, ); - if (model.status) { + if (model.status!) { await updateProfile(); } } diff --git a/lib/ui/community/activity/activity_card.dart b/lib/ui/community/activity/activity_card.dart index 1f702116..447f0085 100644 --- a/lib/ui/community/activity/activity_card.dart +++ b/lib/ui/community/activity/activity_card.dart @@ -13,19 +13,19 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/others/stack_avatar.dart'; class ActivityCard extends StatelessWidget { - final ActivityItemModel model; + final ActivityItemModel? model; const ActivityCard({ - Key key, - @required this.model, + Key? key, + required this.model, }) : super(key: key); - bool get outdate => model.end.compareTo(DateTime.now()) == -1; + bool get outdate => model!.end!.compareTo(DateTime.now()) == -1; Widget build(BuildContext context) { return MaterialButton( clipBehavior: Clip.antiAlias, color: Colors.white, padding: EdgeInsets.zero, - onPressed: () => Get.to(() => ActivityDetailPage(id: model.id)), + onPressed: () => Get.to(() => ActivityDetailPage(id: model!.id)), elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.w), @@ -37,22 +37,22 @@ class ActivityCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ImgModel.first(model.imgUrls) == null + ImgModel.first(model!.imgUrls) == null ? SizedBox() : Hero( - tag: ImgModel.first(model.imgUrls), + tag: ImgModel.first(model!.imgUrls), child: Material( color: Colors.grey, child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: API.image(ImgModel.first(model.imgUrls)), + image: API.image(ImgModel.first(model!.imgUrls)), height: 210.w, width: double.infinity, fit: BoxFit.cover, ), ), ), - model.title.text + model!.title!.text .size(28.sp) .black .bold @@ -60,16 +60,16 @@ class ActivityCard extends StatelessWidget { .pSymmetric(h: 24.w, v: 16.w), [ '地 点:'.text.size(24.sp).color(Color(0xFF999999)).make(), - model.location.text.size(24.sp).make(), + model!.location!.text.size(24.sp).make(), ].row().pSymmetric(h: 24.w), 6.hb, [ '活动时间:'.text.size(24.sp).color(Color(0xFF999999)).make(), '${DateUtil.formatDate( - model.begin, + model!.begin, format: 'MM月dd日 HH:mm', )}至${DateUtil.formatDate( - model.end, + model!.end, format: 'MM月dd日 HH:mm', )}' .text @@ -77,7 +77,7 @@ class ActivityCard extends StatelessWidget { .make(), ].row().pSymmetric(h: 24.w), [ - StackAvatar(avatars: model.headImgURls.map((e) => e.url).toList()), + StackAvatar(avatars: model!.headImgURls!.map((e) => e.url).toList()), Spacer(), MaterialButton( elevation: 0, @@ -90,7 +90,7 @@ class ActivityCard extends StatelessWidget { onPressed: outdate ? null : () { - Get.to(() => ActivityDetailPage(id: model.id)); + Get.to(() => ActivityDetailPage(id: model!.id)); }, child: outdate ? '已结束'.text.size(20.sp).bold.make() diff --git a/lib/ui/community/activity/activity_detail_page.dart b/lib/ui/community/activity/activity_detail_page.dart index 1e053498..49e7603e 100644 --- a/lib/ui/community/activity/activity_detail_page.dart +++ b/lib/ui/community/activity/activity_detail_page.dart @@ -21,15 +21,15 @@ import 'package:aku_community/widget/others/stack_avatar.dart'; import 'package:aku_community/widget/picker/bee_image_preview.dart'; class ActivityDetailPage extends StatefulWidget { - final int id; - ActivityDetailPage({Key key, @required this.id}) : super(key: key); + final int? id; + ActivityDetailPage({Key? key, required this.id}) : super(key: key); @override _ActivityDetailPageState createState() => _ActivityDetailPageState(); } class _ActivityDetailPageState extends State { - ActivityDetailModel model; + ActivityDetailModel? model; EasyRefreshController _refreshController = EasyRefreshController(); bool get outdate => (model?.registEndDate ?? DateTime(0)).compareTo(DateTime.now()) == -1; @@ -62,7 +62,7 @@ class _ActivityDetailPageState extends State { ); @override void dispose() { - _refreshController?.dispose(); + _refreshController.dispose(); super.dispose(); } @@ -97,19 +97,19 @@ class _ActivityDetailPageState extends State { ? SizedBox() : ListView( children: [ - model.title.text + model!.title!.text .size(32.sp) .bold .make() .pSymmetric(h: 32.w, v: 24.w), 48.hb, - ...model.imgUrls + ...model!.imgUrls! .map((e) => GestureDetector( onTap: () { BeeImagePreview.toPath(path: e.url); }, child: Hero( - tag: e.url, + tag: e.url!, child: Container( decoration: BoxDecoration( color: Colors.black12, @@ -126,28 +126,28 @@ class _ActivityDetailPageState extends State { ).pSymmetric(h: 32.w)) .toList(), 44.hb, - model.content.text.size(28.sp).make().pSymmetric(h: 32.w), + model!.content!.text.size(28.sp).make().pSymmetric(h: 32.w), 44.hb, _buildTile( '开始时间', DateUtil.formatDate( - model.startDate, + model!.startDate, format: 'yyyy年MM月dd日 HH:mm', ), ), _buildTile( '结束时间', DateUtil.formatDate( - model.endDate, + model!.endDate, format: 'yyyy年MM月dd日 HH:mm', ), ), - _buildTile('地 点', model.location), + _buildTile('地 点', model!.location!), _buildTile('参与人数', '不限'), _buildTile( '报名截止', DateUtil.formatDate( - model.registEndDate, + model!.registEndDate, format: 'yyyy年MM月dd日 HH:mm', ), ), @@ -163,10 +163,10 @@ class _ActivityDetailPageState extends State { child: Row( children: [ StackAvatar( - avatars: model.headImgURls.map((e) => e.url).toList(), + avatars: model!.headImgURls!.map((e) => e.url).toList(), ), Spacer(), - '已有${model.countRegistration}人参加' + '已有${model!.countRegistration}人参加' .text .size(28.sp) .make(), diff --git a/lib/ui/community/activity/activity_list_page.dart b/lib/ui/community/activity/activity_list_page.dart index e1ce9836..8b2d0b5a 100644 --- a/lib/ui/community/activity/activity_list_page.dart +++ b/lib/ui/community/activity/activity_list_page.dart @@ -10,7 +10,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class ActivityListPage extends StatefulWidget { - ActivityListPage({Key key}) : super(key: key); + ActivityListPage({Key? key}) : super(key: key); @override _ActivityListPageState createState() => _ActivityListPageState(); @@ -20,7 +20,7 @@ class _ActivityListPageState extends State { EasyRefreshController _refreshController = EasyRefreshController(); @override void dispose() { - _refreshController?.dispose(); + _refreshController.dispose(); super.dispose(); } @@ -28,11 +28,11 @@ class _ActivityListPageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '往期精彩', - body: BeeListView( + body: BeeListView( controller: _refreshController, path: API.community.activityList, convert: (model) => - model.tableList.map((e) => ActivityItemModel.fromJson(e)).toList(), + model.tableList!.map((e) => ActivityItemModel.fromJson(e)).toList(), builder: (items) { return ListView.separated( padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w), diff --git a/lib/ui/community/activity/activity_people_list_page.dart b/lib/ui/community/activity/activity_people_list_page.dart index ac10c890..c71e1335 100644 --- a/lib/ui/community/activity/activity_people_list_page.dart +++ b/lib/ui/community/activity/activity_people_list_page.dart @@ -11,8 +11,8 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class ActivityPeopleListPage extends StatefulWidget { - final int id; - ActivityPeopleListPage({Key key, @required this.id}) : super(key: key); + final int? id; + ActivityPeopleListPage({Key? key, required this.id}) : super(key: key); @override _ActivityPeopleListPageState createState() => _ActivityPeopleListPageState(); @@ -22,7 +22,7 @@ class _ActivityPeopleListPageState extends State { EasyRefreshController _refreshController = EasyRefreshController(); @override void dispose() { - _refreshController?.dispose(); + _refreshController.dispose(); super.dispose(); } @@ -30,11 +30,11 @@ class _ActivityPeopleListPageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '参与人员', - body: BeeListView( + body: BeeListView( controller: _refreshController, path: API.community.activityPeopleList, extraParams: {'activityId': widget.id}, - convert: (model) => model.tableList + convert: (model) => model.tableList! .map((e) => ActivityPeopleModel.fromJson(e)) .toList(), builder: (items) { @@ -53,9 +53,9 @@ class _ActivityPeopleListPageState extends State { width: 60.w, ), 18.wb, - model.name.text.size(28.sp).make(), + model.name!.text.size(28.sp).make(), Spacer(), - model.tel.text.size(28.sp).make(), + model.tel!.text.size(28.sp).make(), ], ); }, diff --git a/lib/ui/community/community_func.dart b/lib/ui/community/community_func.dart index 76938a93..ac01f305 100644 --- a/lib/ui/community/community_func.dart +++ b/lib/ui/community/community_func.dart @@ -5,13 +5,13 @@ import 'package:aku_community/utils/network/base_list_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; class CommunityFunc { - static Future activity() async { + static Future activity() async { BaseListModel model = await NetUtil().getList( API.community.activityList, params: {'pageNum': 1, 'size': 1}, ); - if (model.tableList.length == 0) return null; - return ActivityItemModel.fromJson(model.tableList.first); + if (model.tableList!.length == 0) return null; + return ActivityItemModel.fromJson(model.tableList!.first); } static Future> board() async { @@ -19,7 +19,7 @@ class CommunityFunc { API.community.boardList, params: {'pageNum': 1, 'size': 5}, ); - if (model.tableList.length == 0) return []; - return model.tableList.map((e) => BoardItemModel.fromJson(e)).toList(); + if (model.tableList!.length == 0) return []; + return model.tableList!.map((e) => BoardItemModel.fromJson(e)).toList(); } } diff --git a/lib/ui/community/community_views/add_new_event_page.dart b/lib/ui/community/community_views/add_new_event_page.dart index 9f42d520..3b26c3a6 100644 --- a/lib/ui/community/community_views/add_new_event_page.dart +++ b/lib/ui/community/community_views/add_new_event_page.dart @@ -18,16 +18,16 @@ import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/picker/grid_image_picker.dart'; class AddNewEventPage extends StatefulWidget { - final int initTopic; - final String topicName; - AddNewEventPage({Key key}) + final int? initTopic; + final String? topicName; + AddNewEventPage({Key? key}) : initTopic = null, topicName = null, super(key: key); AddNewEventPage.topic({ - Key key, - @required this.initTopic, - @required this.topicName, + Key? key, + required this.initTopic, + required this.topicName, }) : super(key: key); @override @@ -38,13 +38,13 @@ class _AddNewEventPageState extends State { bool _commentable = true; List _files = []; TextEditingController _textEditingController = TextEditingController(); - HotTopicModel _hotTopicModel; + HotTopicModel? _hotTopicModel; ///发表动态 _addEvent() async { VoidCallback cancel = BotToast.showLoading(); final String content = _textEditingController.text; - List imgs; + List? imgs; if (_files.isNotEmpty) { imgs = await NetUtil().uploadFiles(_files, API.upload.uploadEvent); } @@ -59,7 +59,7 @@ class _AddNewEventPageState extends State { params.putIfAbsent('gambitId', () => widget.initTopic); } else { params.putIfAbsent( - 'gambitId', () => _hotTopicModel == null ? -1 : _hotTopicModel.id); + 'gambitId', () => _hotTopicModel == null ? -1 : _hotTopicModel!.id); } BaseModel baseModel = await NetUtil().post( @@ -68,7 +68,7 @@ class _AddNewEventPageState extends State { showMessage: true, ); cancel(); - if (baseModel.status) { + if (baseModel.status!) { Get.back(result: true); } } @@ -122,7 +122,7 @@ class _AddNewEventPageState extends State { } Widget _renderTopic(HotTopicModel model) { - bool sameModel = model.id == _hotTopicModel?.id ?? -1; + bool sameModel = model.id == (_hotTopicModel?.id ?? -1); return MaterialButton( elevation: 0, color: sameModel ? kPrimaryColor : Colors.white, @@ -130,7 +130,7 @@ class _AddNewEventPageState extends State { _hotTopicModel = model; setState(() {}); }, - child: model.name.text.size(34.sp).black.make(), + child: model.name!.text.size(34.sp).black.make(), shape: StadiumBorder( side: BorderSide( color: Color(0xFF999999), diff --git a/lib/ui/community/community_views/community_page.dart b/lib/ui/community/community_views/community_page.dart index bafca03f..54e20ebd 100644 --- a/lib/ui/community/community_views/community_page.dart +++ b/lib/ui/community/community_views/community_page.dart @@ -16,7 +16,7 @@ import 'package:aku_community/widget/buttons/column_action_button.dart'; import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; class CommunityPage extends StatefulWidget { - CommunityPage({Key key}) : super(key: key); + CommunityPage({Key? key}) : super(key: key); @override _CommunityPageState createState() => _CommunityPageState(); @@ -24,7 +24,7 @@ class CommunityPage extends StatefulWidget { class _CommunityPageState extends State with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { - TabController _tabController; + TabController? _tabController; List _tabs = []; GlobalKey topicKey = GlobalKey(); @@ -68,17 +68,17 @@ class _CommunityPageState extends State fab: FloatingActionButton( onPressed: () async { if (LoginUtil.isNotLogin) return; - bool result = await Get.to(() => AddNewEventPage()); + bool? result = await Get.to(() => AddNewEventPage()); if (result == true) { - switch (_tabController.index) { + switch (_tabController!.index) { case 0: - newKey.currentState.refresh(); + newKey.currentState!.refresh(); break; case 1: - topicKey.currentState.refresh(); + topicKey.currentState!.refresh(); break; case 2: - myKey.currentState.refresh(); + myKey.currentState!.refresh(); break; } } diff --git a/lib/ui/community/community_views/event_detail_page.dart b/lib/ui/community/community_views/event_detail_page.dart index b190ad74..47826b71 100644 --- a/lib/ui/community/community_views/event_detail_page.dart +++ b/lib/ui/community/community_views/event_detail_page.dart @@ -10,10 +10,10 @@ import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class EventDetailPage extends StatefulWidget { - final int themeId; + final int? themeId; EventDetailPage({ - Key key, - @required this.themeId, + Key? key, + required this.themeId, }) : super(key: key); @override @@ -22,7 +22,7 @@ class EventDetailPage extends StatefulWidget { class _EventDetailPageState extends State { EasyRefreshController _refreshController = EasyRefreshController(); - EventItemModel _model; + EventItemModel? _model; @override Widget build(BuildContext context) { return BeeScaffold( diff --git a/lib/ui/community/community_views/my_community_view.dart b/lib/ui/community/community_views/my_community_view.dart index 147a6399..15267bdc 100644 --- a/lib/ui/community/community_views/my_community_view.dart +++ b/lib/ui/community/community_views/my_community_view.dart @@ -9,7 +9,7 @@ import 'package:aku_community/ui/community/community_views/widgets/my_event_card import 'package:aku_community/utils/headers.dart'; class MyCommunityView extends StatefulWidget { - MyCommunityView({Key key}) : super(key: key); + MyCommunityView({Key? key}) : super(key: key); @override MyCommunityViewState createState() => MyCommunityViewState(); @@ -20,17 +20,17 @@ class MyCommunityViewState extends State EasyRefreshController _refreshController = EasyRefreshController(); refresh() { - _refreshController?.callRefresh(); + _refreshController.callRefresh(); } @override Widget build(BuildContext context) { super.build(context); - return BeeListView( + return BeeListView( path: API.community.myEvent, controller: _refreshController, convert: (model) { - return model.tableList + return model.tableList! .map((e) => MyEventItemModel.fromJson(e)) .toList(); }, @@ -39,7 +39,7 @@ class MyCommunityViewState extends State padding: EdgeInsets.symmetric(vertical: 10.w), itemBuilder: (context, index) { final MyEventItemModel model = items[index]; - MyEventItemModel preModel; + MyEventItemModel? preModel; if (index >= 1) preModel = items[index - 1]; return MyEventCard(model: model, preModel: preModel); }, diff --git a/lib/ui/community/community_views/new_community_view.dart b/lib/ui/community/community_views/new_community_view.dart index 2f9e252b..46c04a68 100644 --- a/lib/ui/community/community_views/new_community_view.dart +++ b/lib/ui/community/community_views/new_community_view.dart @@ -8,7 +8,7 @@ import 'package:aku_community/pages/things_page/widget/bee_list_view.dart'; import 'package:aku_community/ui/community/community_views/widgets/chat_card.dart'; class NewCommunityView extends StatefulWidget { - NewCommunityView({Key key}) : super(key: key); + NewCommunityView({Key? key}) : super(key: key); @override NewCommunityViewState createState() => NewCommunityViewState(); @@ -19,12 +19,12 @@ class NewCommunityViewState extends State EasyRefreshController _refreshController = EasyRefreshController(); refresh() { - _refreshController?.callRefresh(); + _refreshController.callRefresh(); } @override void dispose() { - _refreshController?.dispose(); + _refreshController.dispose(); super.dispose(); } @@ -35,7 +35,7 @@ class NewCommunityViewState extends State path: API.community.newEventList, controller: _refreshController, convert: (model) { - return model.tableList.map((e) => EventItemModel.fromJson(e)).toList(); + return model.tableList!.map((e) => EventItemModel.fromJson(e)).toList(); }, builder: (items) { return ListView.builder( diff --git a/lib/ui/community/community_views/topic/topic_community_view.dart b/lib/ui/community/community_views/topic/topic_community_view.dart index f0f5ef3a..443cbf4e 100644 --- a/lib/ui/community/community_views/topic/topic_community_view.dart +++ b/lib/ui/community/community_views/topic/topic_community_view.dart @@ -13,7 +13,7 @@ import 'package:aku_community/ui/community/community_views/topic/topic_detail_pa import 'package:aku_community/utils/headers.dart'; class TopicCommunityView extends StatefulWidget { - TopicCommunityView({Key key}) : super(key: key); + TopicCommunityView({Key? key}) : super(key: key); @override TopicCommunityViewState createState() => TopicCommunityViewState(); @@ -23,7 +23,7 @@ class TopicCommunityViewState extends State with AutomaticKeepAliveClientMixin { EasyRefreshController _refreshController = EasyRefreshController(); refresh() { - _refreshController?.callRefresh(); + _refreshController.callRefresh(); } _buildItem(CommunityTopicModel model) { @@ -81,14 +81,14 @@ class TopicCommunityViewState extends State Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - (model?.title ?? '') + (model.title ?? '') .text .maxLines(2) .size(28.sp) .bold .overflow(TextOverflow.ellipsis) .make(), - (model?.content ?? '') + (model.content ?? '') .text .maxLines(1) .size(22.sp) @@ -104,7 +104,7 @@ class TopicCommunityViewState extends State width: 24.w, ), 12.wb, - '${model?.activityNum}' + '${model.activityNum}' .text .maxLines(1) .size(22.sp) @@ -121,11 +121,11 @@ class TopicCommunityViewState extends State @override Widget build(BuildContext context) { super.build(context); - return BeeListView( + return BeeListView( path: API.community.topicList, controller: _refreshController, convert: (model) { - return model.tableList + return model.tableList! .map((e) => CommunityTopicModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/community/community_views/topic/topic_detail_page.dart b/lib/ui/community/community_views/topic/topic_detail_page.dart index 0986d449..408bea08 100644 --- a/lib/ui/community/community_views/topic/topic_detail_page.dart +++ b/lib/ui/community/community_views/topic/topic_detail_page.dart @@ -16,9 +16,9 @@ import 'package:aku_community/ui/community/community_views/widgets/chat_card.dar import 'package:aku_community/utils/login_util.dart'; class TopicDetailPage extends StatefulWidget { - final CommunityTopicModel model; + final CommunityTopicModel? model; - TopicDetailPage({Key key, this.model}) : super(key: key); + TopicDetailPage({Key? key, this.model}) : super(key: key); @override _TopicDetailPageState createState() => _TopicDetailPageState(); @@ -28,7 +28,7 @@ class _TopicDetailPageState extends State { EasyRefreshController _refreshController = EasyRefreshController(); @override void dispose() { - _refreshController?.dispose(); + _refreshController.dispose(); super.dispose(); } @@ -41,31 +41,31 @@ class _TopicDetailPageState extends State { heroTag: 'event_add', onPressed: () async { if (LoginUtil.isNotLogin) return; - bool result = await Get.to(() => AddNewEventPage.topic( - topicName: widget.model.summary, - initTopic: widget.model.id, + bool? result = await Get.to(() => AddNewEventPage.topic( + topicName: widget.model!.summary, + initTopic: widget.model!.id, )); }, child: Icon(Icons.add), ), body: BeeListView( convert: (model) { - return model.tableList + return model.tableList! .map((e) => EventItemModel.fromJson(e)) .toList(); }, path: API.community.eventByTopicId, - extraParams: {'gambitId': widget.model.id}, + extraParams: {'gambitId': widget.model!.id}, controller: _refreshController, builder: (items) { return CustomScrollView( slivers: [ SliverPersistentHeader( delegate: TopicSliverHeader( - id: widget.model.id, - title: widget.model.summary, - imgPath: ImgModel.first(widget.model.imgUrl), - subTitle: widget.model.content, + id: widget.model!.id, + title: widget.model!.summary, + imgPath: ImgModel.first(widget.model!.imgUrl), + subTitle: widget.model!.content, ), pinned: true, floating: true, diff --git a/lib/ui/community/community_views/topic/topic_sliver_header.dart b/lib/ui/community/community_views/topic/topic_sliver_header.dart index a206b322..a45541f6 100644 --- a/lib/ui/community/community_views/topic/topic_sliver_header.dart +++ b/lib/ui/community/community_views/topic/topic_sliver_header.dart @@ -7,16 +7,16 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_back_button.dart'; class TopicSliverHeader extends SliverPersistentHeaderDelegate { - final String imgPath; - final String title; - final String subTitle; - final int id; + final String? imgPath; + final String? title; + final String? subTitle; + final int? id; TopicSliverHeader({ this.imgPath, this.title, this.subTitle, - @required this.id, + required this.id, }); _buildOverlay(double shrinkOffset) { @@ -59,7 +59,7 @@ class TopicSliverHeader extends SliverPersistentHeaderDelegate { opacity: 1 - _offset(shrinkOffset), child: SizedBox( width: 500.w, - child: subTitle.text + child: subTitle!.text .size(24.sp) .maxLines(2) .white diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index 49827fdf..18fe1163 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -22,16 +22,16 @@ import 'package:aku_community/widget/picker/bee_image_preview.dart'; import 'package:aku_community/widget/views/bee_grid_image_view.dart'; class ChatCard extends StatefulWidget { - final EventItemModel model; + final EventItemModel? model; - final VoidCallback onDelete; + final VoidCallback? onDelete; final bool hideLine; final bool canTap; ChatCard({ - Key key, - @required this.model, + Key? key, + required this.model, this.onDelete, this.hideLine = false, this.canTap = true, @@ -44,12 +44,12 @@ class ChatCard extends StatefulWidget { class _ChatCardState extends State { bool get _isMyself { final userProvider = Provider.of(context, listen: false); - return (userProvider?.userInfoModel?.id ?? -1) == widget.model.createId; + return (userProvider.userInfoModel?.id ?? -1) == widget.model!.createId; } _renderImage() { - if (widget.model.imgUrls.isEmpty) return SizedBox(); - if (widget.model.imgUrls.length == 1) + if (widget.model!.imgUrls!.isEmpty) return SizedBox(); + if (widget.model!.imgUrls!.length == 1) return MaterialButton( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, padding: EdgeInsets.zero, @@ -60,8 +60,8 @@ class _ChatCardState extends State { ), onPressed: () { BeeImagePreview.toPath( - path: ImgModel.first(widget.model.imgUrls), - tag: ImgModel.first(widget.model.imgUrls), + path: ImgModel.first(widget.model!.imgUrls), + tag: ImgModel.first(widget.model!.imgUrls), ); }, child: ConstrainedBox( @@ -70,17 +70,17 @@ class _ChatCardState extends State { maxWidth: 300.w, ), child: Hero( - tag: ImgModel.first(widget.model.imgUrls), + tag: ImgModel.first(widget.model!.imgUrls), child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: API.image(ImgModel.first(widget.model.imgUrls)), + image: API.image(ImgModel.first(widget.model!.imgUrls)), ), ), ), ); else return BeeGridImageView( - urls: widget.model.imgUrls.map((e) => e.url).toList()); + urls: widget.model!.imgUrls!.map((e) => e.url).toList()); } _buildMoreButton() { @@ -121,28 +121,28 @@ class _ChatCardState extends State { cancel(); await NetUtil().get( API.community.like, - params: {'themeId': widget.model.id}, + params: {'themeId': widget.model!.id}, showMessage: true, ); setState(() { - if (widget.model.isLike == 0) { - widget.model.likeNames.add( + if (widget.model!.isLike == 0) { + widget.model!.likeNames!.add( LikeNames( id: Random().nextInt(1000), - name: userProvider.userInfoModel.nickName, + name: userProvider.userInfoModel!.nickName, ), ); } else { - widget.model.likeNames.removeWhere((element) => + widget.model!.likeNames!.removeWhere((element) => element.name == - userProvider.userInfoModel.nickName); + userProvider.userInfoModel!.nickName); } - widget.model.isLike = - (widget.model.isLike == 1) ? 0 : 1; + widget.model!.isLike = + (widget.model!.isLike == 1) ? 0 : 1; }); }, child: [ - widget.model.isLike == 1 + widget.model!.isLike == 1 ? Icon(Icons.favorite, size: 30.w, color: Colors.red) : Icon(Icons.favorite_border, size: 30.w), @@ -156,10 +156,10 @@ class _ChatCardState extends State { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onPressed: () { - if (widget.model.isComment == 1) + if (widget.model!.isComment == 1) SendAChat.send( parentId: 0, - themeId: widget.model.id, + themeId: widget.model!.id, ); else BotToast.showText(text: '不可评论'); @@ -213,8 +213,8 @@ class _ChatCardState extends State { children: [ Icon(Icons.favorite_border_rounded, size: 24.w), 14.wb, - ...widget.model.likeNames - .map((e) => e.name.text.make()) + ...widget.model!.likeNames! + .map((e) => e.name!.text.make()) .toList() .sepWidget(separate: ','.text.make()), ], @@ -225,7 +225,7 @@ class _ChatCardState extends State { _renderComment() { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: widget.model.gambitThemeCommentVoList.map((e) { + children: widget.model!.gambitThemeCommentVoList!.map((e) { StringBuffer buffer = StringBuffer(); buffer.write(e.createName); if (e.parentName != null) buffer.write('回复${e.parentName}'); @@ -236,7 +236,7 @@ class _ChatCardState extends State { style: Theme.of(context).textTheme.subtitle2, ), onTap: () { - SendAChat.send(parentId: e.id, themeId: widget.model.id); + SendAChat.send(parentId: e.id, themeId: widget.model!.id); }, ); }).toList(), @@ -244,8 +244,8 @@ class _ChatCardState extends State { } _renderLikeAndComment() { - if (widget.model.likeNames.isEmpty && - widget.model.gambitThemeCommentVoList.isEmpty) return SizedBox(); + if (widget.model!.likeNames!.isEmpty && + widget.model!.gambitThemeCommentVoList!.isEmpty) return SizedBox(); return Material( borderRadius: BorderRadius.circular(8.w), color: Color(0xFFF7F7F7), @@ -255,12 +255,12 @@ class _ChatCardState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.model.likeNames.isEmpty ? SizedBox() : _renderLike(), - (widget.model.likeNames.isNotEmpty && - widget.model.gambitThemeCommentVoList.isNotEmpty) + widget.model!.likeNames!.isEmpty ? SizedBox() : _renderLike(), + (widget.model!.likeNames!.isNotEmpty && + widget.model!.gambitThemeCommentVoList!.isNotEmpty) ? Divider(height: 1.w, thickness: 1.w) : SizedBox(), - widget.model.gambitThemeCommentVoList.isEmpty + widget.model!.gambitThemeCommentVoList!.isEmpty ? SizedBox() : _renderComment(), ], @@ -286,7 +286,7 @@ class _ChatCardState extends State { padding: EdgeInsets.zero, onPressed: widget.canTap ? () { - Get.to(() => EventDetailPage(themeId: widget.model.id)); + Get.to(() => EventDetailPage(themeId: widget.model!.id)); } : null, child: Row( @@ -299,7 +299,7 @@ class _ChatCardState extends State { child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, image: - API.image(ImgModel.first(widget.model.headSculptureImgUrl)), + API.image(ImgModel.first(widget.model!.headSculptureImgUrl)), height: 86.w, width: 86.w, fit: BoxFit.cover, @@ -310,7 +310,7 @@ class _ChatCardState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ [ - widget.model.createName.text.black + widget.model!.createName!.text.black .size(36.sp) .make() .expand(), @@ -325,7 +325,7 @@ class _ChatCardState extends State { ), ]; }, - onSelected: (_) async { + onSelected: (dynamic _) async { if (LoginUtil.isNotLogin) return; VoidCallback cancel = BotToast.showLoading(); await Future.delayed( @@ -336,13 +336,13 @@ class _ChatCardState extends State { ), ].row(), 6.hb, - widget.model.content.text.size(32.sp).black.make(), + widget.model!.content!.text.size(32.sp).black.make(), 20.hb, _renderImage(), - widget.model.gambitTitle?.isEmpty ?? true + widget.model!.gambitTitle?.isEmpty ?? true ? SizedBox() : Chip( - label: '#${widget.model.gambitTitle}' + label: '#${widget.model!.gambitTitle}' .text .size(22.sp) .make(), @@ -357,7 +357,7 @@ class _ChatCardState extends State { Row( children: [ 64.hb, - BeeDateUtil(widget.model.date) + BeeDateUtil(widget.model!.date) .timeAgo .text .size(28.sp) @@ -366,7 +366,7 @@ class _ChatCardState extends State { _isMyself ? TextButton( onPressed: () async { - bool result = + bool? result = await Get.dialog(CupertinoAlertDialog( title: '你确定删除吗'.text.isIntrinsic.make(), actions: [ @@ -388,10 +388,10 @@ class _ChatCardState extends State { if (result == true) { await NetUtil().get( API.community.deleteMyEvent, - params: {'themeId': widget.model.id}, + params: {'themeId': widget.model!.id}, showMessage: true, ); - if (widget.onDelete != null) widget.onDelete(); + if (widget.onDelete != null) widget.onDelete!(); } }, child: '删除'.text.black.size(28.sp).make(), diff --git a/lib/ui/community/community_views/widgets/my_event_card.dart b/lib/ui/community/community_views/widgets/my_event_card.dart index 3a0f616a..ffd71e4f 100644 --- a/lib/ui/community/community_views/widgets/my_event_card.dart +++ b/lib/ui/community/community_views/widgets/my_event_card.dart @@ -14,23 +14,23 @@ import 'package:aku_community/widget/picker/bee_image_preview.dart'; class MyEventCard extends StatelessWidget { final MyEventItemModel model; - final MyEventItemModel preModel; + final MyEventItemModel? preModel; const MyEventCard({ - Key key, - @required this.model, - @required this.preModel, + Key? key, + required this.model, + required this.preModel, }) : super(key: key); bool get isFirst => preModel == null; - bool get notSameYear => model.date.year != (preModel?.date?.year ?? 0); + bool get notSameYear => model.date!.year != (preModel?.date?.year ?? 0); BeeDateUtil get beeDate => BeeDateUtil(model.date); bool get sameDay => - model.date.year == (preModel?.date?.year ?? 0) && - model.date.month == (preModel?.date?.month ?? 0) && - model.date.day == (preModel?.date?.day ?? 0); + model.date!.year == (preModel?.date?.year ?? 0) && + model.date!.month == (preModel?.date?.month ?? 0) && + model.date!.day == (preModel?.date?.day ?? 0); Widget title() { if (beeDate.sameDay) return '今天'.text.size(52.sp).bold.make(); @@ -40,8 +40,8 @@ class MyEventCard extends StatelessWidget { return Row( mainAxisSize: MainAxisSize.min, children: [ - model.date.day.toString().text.size(52.sp).bold.make(), - '${model.date.month}月'.text.size(36.sp).make(), + model.date!.day.toString().text.size(52.sp).bold.make(), + '${model.date!.month}月'.text.size(36.sp).make(), ], ); } @@ -52,8 +52,8 @@ class MyEventCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - (notSameYear && model.date.year != DateTime.now().year) - ? '${model.date.year}年' + (notSameYear && model.date!.year != DateTime.now().year) + ? '${model.date!.year}年' .text .bold .size(52.sp) @@ -73,7 +73,7 @@ class MyEventCard extends StatelessWidget { alignment: Alignment.topLeft, child: sameDay ? SizedBox() : title(), ), - model.imgUrl.length == 0 + model.imgUrl!.length == 0 ? SizedBox(height: 152.w) : GestureDetector( onTap: () { @@ -98,7 +98,7 @@ class MyEventCard extends StatelessWidget { ), ), 10.wb, - model.content.text.make().expand(), + model.content!.text.make().expand(), ], ), ), diff --git a/lib/ui/community/community_views/widgets/send_a_chat.dart b/lib/ui/community/community_views/widgets/send_a_chat.dart index 3ea0ddcd..bfa4d503 100644 --- a/lib/ui/community/community_views/widgets/send_a_chat.dart +++ b/lib/ui/community/community_views/widgets/send_a_chat.dart @@ -9,16 +9,16 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/network/net_util.dart'; class SendAChat extends StatefulWidget { - final FocusNode node; - SendAChat({Key key, this.node}) : super(key: key); + final FocusNode? node; + SendAChat({Key? key, this.node}) : super(key: key); static Future send({ - @required int parentId, - @required int themeId, + required int? parentId, + required int? themeId, }) async { FocusNode node = FocusNode(); node.requestFocus(); - String result = await Get.bottomSheet( + String? result = await Get.bottomSheet( SendAChat(node: node), barrierColor: Colors.transparent, ); @@ -45,7 +45,7 @@ class _SendAChatState extends State { TextEditingController _textEditingController = TextEditingController(); @override void dispose() { - _textEditingController?.dispose(); + _textEditingController.dispose(); super.dispose(); } diff --git a/lib/ui/community/facility/facility_page.dart b/lib/ui/community/facility/facility_page.dart index 2d27eb44..73791eb8 100644 --- a/lib/ui/community/facility/facility_page.dart +++ b/lib/ui/community/facility/facility_page.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class FacilityPage extends StatefulWidget { - FacilityPage({Key key}) : super(key: key); + FacilityPage({Key? key}) : super(key: key); @override _FacilityPageState createState() => _FacilityPageState(); diff --git a/lib/ui/community/facility/pick_facility_page.dart b/lib/ui/community/facility/pick_facility_page.dart index 5f8fe1b3..74f9fafc 100644 --- a/lib/ui/community/facility/pick_facility_page.dart +++ b/lib/ui/community/facility/pick_facility_page.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class PickFacilityPage extends StatefulWidget { - PickFacilityPage({Key key}) : super(key: key); + PickFacilityPage({Key? key}) : super(key: key); @override _PickFacilityPageState createState() => _PickFacilityPageState(); diff --git a/lib/ui/community/notice/notice_card.dart b/lib/ui/community/notice/notice_card.dart index 1882295d..fa316748 100644 --- a/lib/ui/community/notice/notice_card.dart +++ b/lib/ui/community/notice/notice_card.dart @@ -14,33 +14,33 @@ import 'package:aku_community/widget/picker/bee_image_preview.dart'; class NoticeCard extends StatelessWidget { final BoardItemModel model; - final BoardItemModel preModel; + final BoardItemModel? preModel; const NoticeCard({ - Key key, - @required this.model, - @required this.preModel, + Key? key, + required this.model, + required this.preModel, }) : super(key: key); bool get sameDay => - model.releaseDate.year == (preModel?.releaseDate?.year ?? 0) && - model.releaseDate.month == (preModel?.releaseDate?.month ?? 0) && - model.releaseDate.day == (preModel?.releaseDate?.day ?? 0); + model.releaseDate!.year == (preModel?.releaseDate?.year ?? 0) && + model.releaseDate!.month == (preModel?.releaseDate?.month ?? 0) && + model.releaseDate!.day == (preModel?.releaseDate?.day ?? 0); bool get isYesterday { DateTime now = DateTime.now(); DateTime yestoday = DateTime(now.year, now.month, now.day - 1); - return yestoday.year == model.releaseDate.year && - yestoday.month == model.releaseDate.month && - yestoday.day == model.releaseDate.day; + return yestoday.year == model.releaseDate!.year && + yestoday.month == model.releaseDate!.month && + yestoday.day == model.releaseDate!.day; } bool get isFirst => preModel == null; bool get notSameYear => - model.releaseDate.year != (preModel?.releaseDate?.year ?? 0); + model.releaseDate!.year != (preModel?.releaseDate?.year ?? 0); Widget title() { - if (DateUtil.isToday(model.releaseDate.millisecond)) + if (DateUtil.isToday(model.releaseDate!.millisecond)) return '今天'.text.size(52.sp).bold.make(); if (isYesterday) return '昨天'.text.size(52.sp).bold.make(); @@ -48,8 +48,8 @@ class NoticeCard extends StatelessWidget { return Row( mainAxisSize: MainAxisSize.min, children: [ - model.releaseDate.day.toString().text.size(52.sp).bold.make(), - '${model.releaseDate.month}月'.text.size(36.sp).make(), + model.releaseDate!.day.toString().text.size(52.sp).bold.make(), + '${model.releaseDate!.month}月'.text.size(36.sp).make(), ], ); } @@ -60,8 +60,8 @@ class NoticeCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - (notSameYear && model.releaseDate.year != DateTime.now().year) - ? '${model.releaseDate.year}年' + (notSameYear && model.releaseDate!.year != DateTime.now().year) + ? '${model.releaseDate!.year}年' .text .bold .size(52.sp) @@ -81,7 +81,7 @@ class NoticeCard extends StatelessWidget { alignment: Alignment.topLeft, child: sameDay ? SizedBox() : title(), ), - model.imgUrls.length == 0 + model.imgUrls!.length == 0 ? SizedBox(height: 152.w) : GestureDetector( onTap: () { @@ -109,7 +109,7 @@ class NoticeCard extends StatelessWidget { ), ), 10.wb, - model.title.text.make().expand(), + model.title!.text.make().expand(), ], ), ), diff --git a/lib/ui/community/notice/notice_detail_page.dart b/lib/ui/community/notice/notice_detail_page.dart index bf3b6e23..f7a38175 100644 --- a/lib/ui/community/notice/notice_detail_page.dart +++ b/lib/ui/community/notice/notice_detail_page.dart @@ -16,8 +16,8 @@ import 'package:aku_community/widget/picker/bee_image_preview.dart'; import 'package:aku_community/widget/views/%20bee_download_view.dart'; class NoticeDetailPage extends StatefulWidget { - final int id; - NoticeDetailPage({Key key, @required this.id}) : super(key: key); + final int? id; + NoticeDetailPage({Key? key, required this.id}) : super(key: key); @override _NoticeDetailPageState createState() => _NoticeDetailPageState(); @@ -25,13 +25,13 @@ class NoticeDetailPage extends StatefulWidget { class _NoticeDetailPageState extends State { EasyRefreshController _refreshController = EasyRefreshController(); - BoardDetailModel model; + BoardDetailModel? model; Widget get emptyWidget => Column( children: [], ); - Widget docView(String title, String path) { + Widget docView(String? title, String? path) { if (title?.isEmpty ?? true) return SizedBox(); return Container( margin: EdgeInsets.only(right: 113.w), @@ -42,7 +42,7 @@ class _NoticeDetailPageState extends State { padding: EdgeInsets.symmetric(horizontal: 32.w), child: Row( children: [ - title.text.size(32.sp).make().expand(), + title!.text.size(32.sp).make().expand(), Image.asset( R.ASSETS_ICONS_FILE_PNG, height: 52.w, @@ -51,7 +51,7 @@ class _NoticeDetailPageState extends State { ], ), onPressed: () async { - String result = await Get.dialog(BeeDownloadView(file: path)); + String? result = await Get.dialog(BeeDownloadView(file: path)); if (result != null) OpenFile.open(result); }, shape: RoundedRectangleBorder( @@ -85,16 +85,16 @@ class _NoticeDetailPageState extends State { : ListView( padding: EdgeInsets.all(32.w), children: [ - model.title.text.size(32.sp).bold.make(), + model!.title!.text.size(32.sp).bold.make(), 50.hb, - ...model.imgUrls + ...model!.imgUrls! .map( (e) => GestureDetector( onTap: () { BeeImagePreview.toPath(path: e.url, tag: e.url); }, child: Hero( - tag: e.url, + tag: e.url!, child: Container( clipBehavior: Clip.antiAlias, decoration: BoxDecoration( @@ -112,9 +112,9 @@ class _NoticeDetailPageState extends State { ) .toList(), 44.hb, - model.content.text.size(28.sp).make(), + model!.content!.text.size(28.sp).make(), 43.hb, - docView(model.fileDocName, model.fileDocUrl), + docView(model!.fileDocName, model!.fileDocUrl), ], ), ).material(color: Colors.white), diff --git a/lib/ui/community/notice/notice_page.dart b/lib/ui/community/notice/notice_page.dart index 9f030267..db918c2d 100644 --- a/lib/ui/community/notice/notice_page.dart +++ b/lib/ui/community/notice/notice_page.dart @@ -10,7 +10,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class NoticePage extends StatefulWidget { - NoticePage({Key key}) : super(key: key); + NoticePage({Key? key}) : super(key: key); @override _NoticePageState createState() => _NoticePageState(); @@ -22,17 +22,17 @@ class _NoticePageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '社区公告', - body: BeeListView( + body: BeeListView( controller: _refreshController, path: API.community.boardList, convert: (model) => - model.tableList.map((e) => BoardItemModel.fromJson(e)).toList(), + model.tableList!.map((e) => BoardItemModel.fromJson(e)).toList(), builder: (items) { return ListView.separated( padding: EdgeInsets.symmetric(vertical: 32.w), itemBuilder: (context, index) { final BoardItemModel model = items[index]; - BoardItemModel preModel; + BoardItemModel? preModel; if (index >= 1) preModel = items[index - 1]; return NoticeCard( model: model, diff --git a/lib/ui/community/public_infomation_page.dart b/lib/ui/community/public_infomation_page.dart index 576310c5..19e00d96 100644 --- a/lib/ui/community/public_infomation_page.dart +++ b/lib/ui/community/public_infomation_page.dart @@ -4,7 +4,7 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; class PublicInfomationPage extends StatefulWidget { - PublicInfomationPage({Key key}) : super(key: key); + PublicInfomationPage({Key? key}) : super(key: key); @override _PublicInfomationPageState createState() => _PublicInfomationPageState(); @@ -13,7 +13,7 @@ class PublicInfomationPage extends StatefulWidget { class _PublicInfomationPageState extends State with TickerProviderStateMixin { static const pubTabs = ['全部', '政务', '生活', '医疗', '教育']; - TabController _tabController; + TabController? _tabController; @override void initState() { super.initState(); diff --git a/lib/ui/home/application/all_application.dart b/lib/ui/home/application/all_application.dart index 78dd4ac2..a5becbd2 100644 --- a/lib/ui/home/application/all_application.dart +++ b/lib/ui/home/application/all_application.dart @@ -14,7 +14,7 @@ import 'package:aku_community/utils/login_util.dart'; import 'package:aku_community/widget/bee_back_button.dart'; class AllApplicationPage extends StatefulWidget { - AllApplicationPage({Key key}) : super(key: key); + AllApplicationPage({Key? key}) : super(key: key); @override _AllApplicationPageState createState() => _AllApplicationPageState(); diff --git a/lib/ui/home/home_notification.dart b/lib/ui/home/home_notification.dart index 9f40b58d..b242d1ae 100644 --- a/lib/ui/home/home_notification.dart +++ b/lib/ui/home/home_notification.dart @@ -12,7 +12,7 @@ import 'package:aku_community/utils/headers.dart'; class HomeNotification extends StatefulWidget { final List items; - HomeNotification({Key key, @required this.items}) : super(key: key); + HomeNotification({Key? key, required this.items}) : super(key: key); @override _HomeNotificationState createState() => _HomeNotificationState(); @@ -40,7 +40,7 @@ class _HomeNotificationState extends State { pause: Duration(milliseconds: 2000), animatedTexts: widget.items .map((e) => RotateAnimatedText( - e.title, + e.title!, duration: Duration(milliseconds: 3000), )) .toList(), diff --git a/lib/ui/home/home_title.dart b/lib/ui/home/home_title.dart index ca18d577..f72727f4 100644 --- a/lib/ui/home/home_title.dart +++ b/lib/ui/home/home_title.dart @@ -12,10 +12,10 @@ class HomeTitle extends StatelessWidget { final VoidCallback onTap; const HomeTitle({ - Key key, - @required this.title, - @required this.suffixTitle, - @required this.onTap, + Key? key, + required this.title, + required this.suffixTitle, + required this.onTap, }) : super(key: key); @override diff --git a/lib/ui/manager/advice/advice_add_comment_page.dart b/lib/ui/manager/advice/advice_add_comment_page.dart index 4e1d0a40..c128b0d2 100644 --- a/lib/ui/manager/advice/advice_add_comment_page.dart +++ b/lib/ui/manager/advice/advice_add_comment_page.dart @@ -12,8 +12,8 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; class AdviceAddCommentPage extends StatefulWidget { - final int id; - AdviceAddCommentPage({Key key, @required this.id}) : super(key: key); + final int? id; + AdviceAddCommentPage({Key? key, required this.id}) : super(key: key); @override _AdviceAddCommentPageState createState() => _AdviceAddCommentPageState(); @@ -25,7 +25,7 @@ class _AdviceAddCommentPageState extends State { @override void dispose() { - _textEditingController?.dispose(); + _textEditingController.dispose(); super.dispose(); } @@ -66,7 +66,7 @@ class _AdviceAddCommentPageState extends State { ), bottomNavi: BottomButton( onPressed: () async { - if (_formKey.currentState.validate()) { + if (_formKey.currentState!.validate()) { BaseModel baseModel = await NetUtil().post( API.manager.adviceQuestion, params: { @@ -76,7 +76,7 @@ class _AdviceAddCommentPageState extends State { }, showMessage: true, ); - if (baseModel.status) { + if (baseModel.status!) { Get.back(result: true); } } diff --git a/lib/ui/manager/advice/advice_card.dart b/lib/ui/manager/advice/advice_card.dart index 66facb7f..bd5cc639 100644 --- a/lib/ui/manager/advice/advice_card.dart +++ b/lib/ui/manager/advice/advice_card.dart @@ -12,8 +12,8 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/views/horizontal_image_view.dart'; class AdviceCard extends StatefulWidget { - final SuggestionOrComplainModel model; - AdviceCard({Key key, this.model}) : super(key: key); + final SuggestionOrComplainModel? model; + AdviceCard({Key? key, this.model}) : super(key: key); @override _AdviceCardState createState() => _AdviceCardState(); @@ -21,14 +21,14 @@ class AdviceCard extends StatefulWidget { class _AdviceCardState extends State { ///1.未反馈,2.反馈中,3.已反馈 - String get statusValue => { + String? get statusValue => { 1: '未反馈', 2: '反馈中', 3: '已反馈', - }[widget.model.status]; + }[widget.model!.status!]; Widget _buildRating() { - if (widget.model.score == null) + if (widget.model!.score == null) return SizedBox(); else return [ @@ -41,7 +41,7 @@ class _AdviceCardState extends State { Icons.star_rounded, color: kPrimaryColor, ), - rating: widget.model.score / 2, + rating: widget.model!.score! / 2, itemSize: 40.w, ), 24.wb, @@ -66,10 +66,10 @@ class _AdviceCardState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ DateUtil.formatDate( - widget.model.createDate, + widget.model!.createDate, format: 'yyyy年MM月dd日', ).text.size(32.sp).black.bold.make(), - statusValue.text.size(24.sp).color(Color(0xFFFF8200)).make(), + statusValue!.text.size(24.sp).color(Color(0xFFFF8200)).make(), ], ).pSymmetric(h: 28.w), Divider( @@ -79,9 +79,9 @@ class _AdviceCardState extends State { thickness: 1.w, color: Color(0xFFE8E8E8), ), - widget.model.content.text.size(28.w).black.make().pSymmetric(h: 28.w), - HorizontalImageView(widget.model.imgUrls.map((e) => e.url).toList()), - widget.model.score == null + widget.model!.content!.text.size(28.w).black.make().pSymmetric(h: 28.w), + HorizontalImageView(widget.model!.imgUrls!.map((e) => e.url).toList()), + widget.model!.score == null ? SizedBox() : Divider( indent: 32.w, diff --git a/lib/ui/manager/advice/advice_detail_page.dart b/lib/ui/manager/advice/advice_detail_page.dart index 5eb7bf6e..3aebcf7a 100644 --- a/lib/ui/manager/advice/advice_detail_page.dart +++ b/lib/ui/manager/advice/advice_detail_page.dart @@ -21,8 +21,8 @@ import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:aku_community/widget/views/bee_grid_image_view.dart'; class AdviceDetailPage extends StatefulWidget { - final SuggestionOrComplainModel model; - AdviceDetailPage({Key key, @required this.model}) : super(key: key); + final SuggestionOrComplainModel? model; + AdviceDetailPage({Key? key, required this.model}) : super(key: key); @override _AdviceDetailPageState createState() => _AdviceDetailPageState(); @@ -31,9 +31,9 @@ class AdviceDetailPage extends StatefulWidget { class _AdviceDetailPageState extends State { bool _loading = true; EasyRefreshController _refreshController = EasyRefreshController(); - AdviceDetailModel _model; + late AdviceDetailModel _model; String get adviceValue { - switch (widget.model.type) { + switch (widget.model!.type) { case 1: return '咨询'; case 2: @@ -78,7 +78,7 @@ class _AdviceDetailPageState extends State { color: Color(0xFFD8D8D8), ), BeeGridImageView( - urls: widget.model.imgUrls.map((e) => e.url).toList(), + urls: widget.model!.imgUrls!.map((e) => e.url).toList(), padding: EdgeInsets.only(right: 100.w), ), ], @@ -104,7 +104,7 @@ class _AdviceDetailPageState extends State { children: [ '$type\的回复'.text.size(38.sp).bold.make(), 28.hb, - item.content.text.size(28.sp).color(ktextSubColor).make(), + item.content!.text.size(28.sp).color(ktextSubColor).make(), 24.hb, DateUtil.formatDate(item.date, format: 'yyyy年MM月dd日 HH:mm') .text @@ -122,13 +122,13 @@ class _AdviceDetailPageState extends State { children: [ '您的$adviceValue'.text.black.bold.size(38.sp).make(), 30.hb, - _model.appAdviceDetailVo.appAdviceVo.content.text + _model.appAdviceDetailVo!.appAdviceVo!.content!.text .color(ktextSubColor) .size(28.sp) .make(), 24.hb, DateUtil.formatDate( - _model.appAdviceDetailVo.appAdviceVo.date, + _model.appAdviceDetailVo!.appAdviceVo!.date, format: 'yyyy年MM月dd日 HH:mm', ).text.size(24.sp).color(Color(0xFF999999)).make(), Divider( @@ -137,7 +137,7 @@ class _AdviceDetailPageState extends State { color: Color(0xFFD8D8D8), ), BeeGridImageView( - urls: widget.model.imgUrls.map((e) => e.url).toList(), + urls: widget.model!.imgUrls!.map((e) => e.url).toList(), padding: EdgeInsets.only(right: 100.w), ), Divider( @@ -145,16 +145,16 @@ class _AdviceDetailPageState extends State { thickness: 1.w, color: Color(0xFFD8D8D8), ), - ..._model.appAdviceDetailVo.appAdviceContentVos + ..._model.appAdviceDetailVo!.appAdviceContentVos! .map((e) => _buildAdviceContent(e)) - .toList(), + .toList() as Iterable, ], ); } @override void dispose() { - _refreshController?.dispose(); + _refreshController.dispose(); super.dispose(); } @@ -166,7 +166,7 @@ class _AdviceDetailPageState extends State { actions: [ TextButton( onPressed: () => - Get.to(() => AdviceEvaluatePage(id: widget.model.id)), + Get.to(() => AdviceEvaluatePage(id: widget.model!.id)), child: '评价'.text.make(), ), ], @@ -176,9 +176,9 @@ class _AdviceDetailPageState extends State { controller: _refreshController, header: MaterialHeader(), onRefresh: () async { - Response res = await NetUtil().dio.get( + Response res = await NetUtil().dio!.get( API.manager.adviceDetail, - queryParameters: {'adviceId': widget.model.id}, + queryParameters: {'adviceId': widget.model!.id}, ); _model = AdviceDetailModel.fromJson(res.data); _loading = false; @@ -188,7 +188,7 @@ class _AdviceDetailPageState extends State { bottomNavi: BottomButton( onPressed: () async { bool result = - await Get.to(() => AdviceAddCommentPage(id: widget.model.id)); + await (Get.to(() => AdviceAddCommentPage(id: widget.model!.id))); if (result && mounted) _refreshController.callRefresh(); }, child: '继续提问'.text.bold.make(), diff --git a/lib/ui/manager/advice/advice_evaluate_page.dart b/lib/ui/manager/advice/advice_evaluate_page.dart index fba4f651..9c39e8c2 100644 --- a/lib/ui/manager/advice/advice_evaluate_page.dart +++ b/lib/ui/manager/advice/advice_evaluate_page.dart @@ -12,8 +12,8 @@ import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class AdviceEvaluatePage extends StatefulWidget { - final int id; - AdviceEvaluatePage({Key key, @required this.id}) : super(key: key); + final int? id; + AdviceEvaluatePage({Key? key, required this.id}) : super(key: key); @override _AdviceEvaluatePageState createState() => _AdviceEvaluatePageState(); @@ -72,7 +72,7 @@ class _AdviceEvaluatePageState extends State { params: {'id': widget.id, 'score': _rating}, showMessage: true, ); - if (baseModel.status) { + if (baseModel.status!) { Get.back(); Get.back(); } diff --git a/lib/ui/manager/advice/advice_page.dart b/lib/ui/manager/advice/advice_page.dart index e0d7f489..d9b473fc 100644 --- a/lib/ui/manager/advice/advice_page.dart +++ b/lib/ui/manager/advice/advice_page.dart @@ -26,7 +26,7 @@ enum AdviceType { class AdvicePage extends StatefulWidget { final AdviceType type; - AdvicePage({Key key, @required this.type}) : super(key: key); + AdvicePage({Key? key, required this.type}) : super(key: key); @override _AdvicePageState createState() => _AdvicePageState(); @@ -34,45 +34,36 @@ class AdvicePage extends StatefulWidget { class _AdvicePageState extends State with TickerProviderStateMixin { EasyRefreshController _refreshController = EasyRefreshController(); - TabController _tabController; + TabController? _tabController; bool _selectedMode = false; - List _selectedItems = []; + List _selectedItems = []; String get title { switch (widget.type) { case AdviceType.SUGGESTION: return '建议咨询'; - break; case AdviceType.COMPLAIN: return '投诉表扬'; - break; } - return ''; } List get tabs { switch (widget.type) { case AdviceType.SUGGESTION: return ['您的建议', '您的咨询']; - break; case AdviceType.COMPLAIN: return ['您的投诉', '您的表扬']; - break; } - return []; } int adviceValue(int index) { switch (widget.type) { case AdviceType.SUGGESTION: return index == 0 ? 2 : 1; - break; case AdviceType.COMPLAIN: return index == 0 ? 3 : 4; - break; } - return 0; } @override @@ -108,11 +99,11 @@ class _AdvicePageState extends State with TickerProviderStateMixin { body: TabBarView( controller: _tabController, children: List.generate(2, (index) { - return BeeListView( + return BeeListView( path: API.manager.advice, extraParams: {'adviceType': adviceValue(index)}, controller: _refreshController, - convert: (model) => model.tableList + convert: (model) => model.tableList! .map((e) => SuggestionOrComplainModel.fromJson(e)) .toList(), builder: (items) { @@ -177,10 +168,10 @@ class _AdvicePageState extends State with TickerProviderStateMixin { ), secondChild: BottomButton( onPressed: () async { - bool needRefresh = await Get.to( + bool? needRefresh = await Get.to( () => NewAdvicePage( type: widget.type, - initType: _tabController.index, + initType: _tabController!.index, ), ); if (needRefresh == true) { diff --git a/lib/ui/manager/advice/new_advice_page.dart b/lib/ui/manager/advice/new_advice_page.dart index 97e6cd9a..b670b90b 100644 --- a/lib/ui/manager/advice/new_advice_page.dart +++ b/lib/ui/manager/advice/new_advice_page.dart @@ -25,7 +25,7 @@ import 'package:aku_community/widget/picker/grid_image_picker.dart'; class NewAdvicePage extends StatefulWidget { final AdviceType type; final int initType; - NewAdvicePage({Key key, @required this.type, @required this.initType}) + NewAdvicePage({Key? key, required this.type, required this.initType}) : super(key: key); @override @@ -33,7 +33,7 @@ class NewAdvicePage extends StatefulWidget { } class _NewAdvicePageState extends State { - int _type; + int? _type; List _files = []; TextEditingController _editingController = TextEditingController(); GlobalKey _formKey = GlobalKey(); @@ -99,7 +99,7 @@ class _NewAdvicePageState extends State { ///添加建议咨询/投诉表扬 信息 Future addAdvice(int type, List files, String content) async { VoidCallback cancel = BotToast.showLoading(); - List urls = + List urls = await NetUtil().uploadFiles(files, API.upload.uploadAdvice); BaseModel baseModel = await NetUtil().post( API.manager.addAdvice, @@ -111,7 +111,7 @@ class _NewAdvicePageState extends State { showMessage: true, ); cancel(); - if (baseModel.status) { + if (baseModel.status!) { Get.back(result: true); } } @@ -146,7 +146,7 @@ class _NewAdvicePageState extends State { width: 60.w, ), 40.wb, - '${S.of(context).tempPlotName}\n${appProvider.selectedHouse.roomName}' + '${S.of(context)!.tempPlotName}\n${appProvider.selectedHouse!.roomName}' .text .size(32.sp) .black @@ -204,7 +204,7 @@ class _NewAdvicePageState extends State { bottomNavi: BottomButton( onPressed: () { VoidCallback cancel = BotToast.showLoading(); - if (_formKey.currentState.validate()) { + if (_formKey.currentState!.validate()) { int type = 1; switch (widget.type) { case AdviceType.SUGGESTION: diff --git a/lib/ui/manager/questionnaire/questionnaire_detail_page.dart b/lib/ui/manager/questionnaire/questionnaire_detail_page.dart index 1ea233d3..3715a8a7 100644 --- a/lib/ui/manager/questionnaire/questionnaire_detail_page.dart +++ b/lib/ui/manager/questionnaire/questionnaire_detail_page.dart @@ -22,9 +22,9 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; class QuestionnaireDetailPage extends StatefulWidget { - final int id; - final int status; - QuestionnaireDetailPage({Key key, this.id, this.status}) : super(key: key); + final int? id; + final int? status; + QuestionnaireDetailPage({Key? key, this.id, this.status}) : super(key: key); @override _QuestionnaireDetailPageState createState() => @@ -32,7 +32,7 @@ class QuestionnaireDetailPage extends StatefulWidget { } class _QuestionnaireDetailPageState extends State { - QuestionnaireDetialModel _model; + late QuestionnaireDetialModel _model; bool _onload = true; List _submitModels = []; @@ -40,7 +40,7 @@ class _QuestionnaireDetailPageState extends State { return Container(); } - Widget _expandedCheck(String title, List answers, + Widget _expandedCheck(String title, List? answers, List submitModels, int index) { return Container( width: double.infinity, @@ -60,15 +60,15 @@ class _QuestionnaireDetailPageState extends State { Get.back(); }, ), - actions: answers + actions: answers! .map((e) => CupertinoActionSheetAction( onPressed: () { - submitModels[index].choiceAnswer.first = e.id; + submitModels[index].choiceAnswer!.first = e.id; submitModels[index].shortAnswer = e.answer; Get.back(); setState(() {}); }, - child: e.answer.text.black + child: e.answer!.text.black .size(28.sp) .isIntrinsic .make())) @@ -150,43 +150,43 @@ class _QuestionnaireDetailPageState extends State { case 1: return QuestionnaireSingleCheck( title: questionModel.topic, - selected: submitModels[index].choiceAnswer.first, + selected: submitModels[index].choiceAnswer!.first, onPressed: (id) { - submitModels[index].choiceAnswer.first = id; + submitModels[index].choiceAnswer!.first = id; setState(() {}); }, answers: questionModel.questionnaireChoiceVoList); case 2: - submitModels[index].choiceAnswer.remove(-1); + submitModels[index].choiceAnswer!.remove(-1); return QuestionnaireRadioCheck( title: questionModel.topic, selected: submitModels[index].choiceAnswer, answers: questionModel.questionnaireChoiceVoList, onPressed: (id) { - if (submitModels[index].choiceAnswer.contains(id)) { - submitModels[index].choiceAnswer.remove(id); + if (submitModels[index].choiceAnswer!.contains(id)) { + submitModels[index].choiceAnswer!.remove(id); } else { - submitModels[index].choiceAnswer.add(id); + submitModels[index].choiceAnswer!.add(id); } setState(() {}); }, ); case 3: - return _expandedCheck(questionModel.topic, + return _expandedCheck(questionModel.topic!, questionModel.questionnaireChoiceVoList, submitModels, index); case 4: return QuestionnaireTruefalse( title: questionModel.topic, - selected: submitModels[index].choiceAnswer.first, + selected: submitModels[index].choiceAnswer!.first, onPressed: (id) { - submitModels[index].choiceAnswer.first = id; + submitModels[index].choiceAnswer!.first = id; setState(() {}); }, ); case 5: - return _shortAnswer(questionModel.topic, submitModels, index); + return _shortAnswer(questionModel.topic!, submitModels, index); default: return Container(); @@ -204,7 +204,7 @@ class _QuestionnaireDetailPageState extends State { onRefresh: () async { _model = await ManagerFunc.questionnairefindById(widget.id); _onload = false; - _submitModels = _model.questionnaireTopicVoList + _submitModels = _model.questionnaireTopicVoList! .map((e) => AppQuestionnaireAnswerSubmits( topicId: e.id, choiceAnswer: [-1], @@ -235,21 +235,21 @@ class _QuestionnaireDetailPageState extends State { Container( width: double.infinity, alignment: Alignment.center, - child: _model.title.text + child: _model.title!.text .color(ktextPrimary) .size(32.sp) .bold .make()), 36.w.heightBox, - _model.description.text + _model.description!.text .color(ktextPrimary) .size(28.sp) .make(), 130.w.heightBox, ...List.generate( - _model.questionnaireTopicVoList.length, + _model.questionnaireTopicVoList!.length, (index) => _topicWidget( - _model.questionnaireTopicVoList[index], + _model.questionnaireTopicVoList![index], _submitModels, index)).sepWidget(separate: 80.w.heightBox), ], diff --git a/lib/ui/manager/questionnaire/questionnaire_page.dart b/lib/ui/manager/questionnaire/questionnaire_page.dart index 3316ddbc..5643c2ec 100644 --- a/lib/ui/manager/questionnaire/questionnaire_page.dart +++ b/lib/ui/manager/questionnaire/questionnaire_page.dart @@ -15,7 +15,7 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/others/stack_avatar.dart'; class QuestionnairePage extends StatefulWidget { - QuestionnairePage({Key key}) : super(key: key); + QuestionnairePage({Key? key}) : super(key: key); @override _QuestionnairePageState createState() => _QuestionnairePageState(); @@ -28,7 +28,7 @@ class _QuestionnairePageState extends State { super.initState(); } - String _getButtonText(int status) { + String _getButtonText(int? status) { switch (status) { case 1: case 2: @@ -79,9 +79,9 @@ class _QuestionnairePageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.title.text.black.size(28.sp).make(), + model.title!.text.black.size(28.sp).make(), 6.w.heightBox, - model.description.text + model.description!.text .color(ktextSubColor) .size(28.sp) .maxLines(1) @@ -101,10 +101,10 @@ class _QuestionnairePageState extends State { color: ktextPrimary, fontSize: 24.sp, ), - text: DateUtil.formatDateStr(model.beginDate, + text: DateUtil.formatDateStr(model.beginDate!, format: "MM月dd日 HH:mm") + '至' + - DateUtil.formatDateStr(model.endDate, + DateUtil.formatDateStr(model.endDate!, format: "MM月dd日 HH:mm"), ), ])), @@ -116,7 +116,7 @@ class _QuestionnairePageState extends State { Row( children: [ StackAvatar( - avatars: model.headImgURls.map((e) => e.url).toList()), + avatars: model.headImgURls!.map((e) => e.url).toList()), 26.w.widthBox, '${model.answerNum}人已参加'.text.black.size(20.sp).make(), Spacer(), @@ -151,7 +151,7 @@ class _QuestionnairePageState extends State { @override void dispose() { - _easyRefreshController?.dispose(); + _easyRefreshController.dispose(); super.dispose(); } @@ -159,11 +159,11 @@ class _QuestionnairePageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '问卷调查', - body: BeeListView( + body: BeeListView( path: API.manager.questionnaireList, controller: _easyRefreshController, convert: (model) { - return model.tableList + return model.tableList! .map((e) => QuestionnaireModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/manager/questionnaire/questionnaire_siglecheck.dart b/lib/ui/manager/questionnaire/questionnaire_siglecheck.dart index f076cffa..c2acf5b8 100644 --- a/lib/ui/manager/questionnaire/questionnaire_siglecheck.dart +++ b/lib/ui/manager/questionnaire/questionnaire_siglecheck.dart @@ -5,16 +5,16 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/buttons/bee_single_check.dart'; class QuestionnaireSingleCheck extends StatefulWidget { - final String title; - final List answers; - final int selected; - final Function(int id) onPressed; + final String? title; + final List? answers; + final int? selected; + final Function(int? id) onPressed; QuestionnaireSingleCheck( - {Key key, - @required this.title, - @required this.answers, - @required this.selected, - @required this.onPressed}) + {Key? key, + required this.title, + required this.answers, + required this.selected, + required this.onPressed}) : super(key: key); @override @@ -30,7 +30,7 @@ class _QuestionnaireSingleCheckState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.title.text.black.size(32.sp).bold.make(), + widget.title!.text.black.size(32.sp).bold.make(), 64.w.heightBox, Padding( padding: EdgeInsets.symmetric(horizontal: 96.w), @@ -40,7 +40,7 @@ class _QuestionnaireSingleCheckState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...widget.answers.oddList().map((e) { + ...widget.answers!.oddList().map((e) { return Row( children: [ GestureDetector( @@ -53,7 +53,7 @@ class _QuestionnaireSingleCheckState extends State { ), ), 16.w.widthBox, - e.answer.text.black.size(28.sp).make(), + e.answer!.text.black.size(28.sp).make(), ], ); }).toList(), @@ -62,7 +62,7 @@ class _QuestionnaireSingleCheckState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...widget.answers.evenList().map((e) { + ...widget.answers!.evenList().map((e) { return Row( children: [ GestureDetector( @@ -75,7 +75,7 @@ class _QuestionnaireSingleCheckState extends State { ), ), 16.w.widthBox, - e.answer.text.black.size(28.sp).make(), + e.answer!.text.black.size(28.sp).make(), ], ); }).toList(), diff --git a/lib/ui/manager/questionnaire/questionnaire_truefalse.dart b/lib/ui/manager/questionnaire/questionnaire_truefalse.dart index 45a863dd..86dad16e 100644 --- a/lib/ui/manager/questionnaire/questionnaire_truefalse.dart +++ b/lib/ui/manager/questionnaire/questionnaire_truefalse.dart @@ -6,10 +6,10 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/buttons/bee_single_check.dart'; class QuestionnaireTruefalse extends StatefulWidget { - final String title; - final int selected; - final Function(int id) onPressed; - QuestionnaireTruefalse({Key key, this.title, this.selected, this.onPressed}) + final String? title; + final int? selected; + final Function(int id)? onPressed; + QuestionnaireTruefalse({Key? key, this.title, this.selected, this.onPressed}) : super(key: key); @override @@ -24,7 +24,7 @@ class _QuestionnaireTruefalseState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.title.text.black.size(32.sp).bold.make(), + widget.title!.text.black.size(32.sp).bold.make(), 64.w.heightBox, Padding( padding: EdgeInsets.symmetric(horizontal: 96.w), @@ -35,7 +35,7 @@ class _QuestionnaireTruefalseState extends State { children: [ GestureDetector( onTap: () { - widget.onPressed(1); + widget.onPressed!(1); }, child: BeeSingleCheck( value: 1, @@ -50,7 +50,7 @@ class _QuestionnaireTruefalseState extends State { children: [ GestureDetector( onTap: () { - widget.onPressed(0); + widget.onPressed!(0); }, child: BeeSingleCheck( value: 0, diff --git a/lib/ui/manager/questionnaire/questionnarie_raido_check.dart b/lib/ui/manager/questionnaire/questionnarie_raido_check.dart index 4241e7d0..c473f1fe 100644 --- a/lib/ui/manager/questionnaire/questionnarie_raido_check.dart +++ b/lib/ui/manager/questionnaire/questionnarie_raido_check.dart @@ -5,16 +5,16 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/buttons/bee_check_radio.dart'; class QuestionnaireRadioCheck extends StatefulWidget { - final String title; - final List answers; - final List selected; - final Function(int id) onPressed; + final String? title; + final List? answers; + final List? selected; + final Function(int? id) onPressed; QuestionnaireRadioCheck( - {Key key, - @required this.title, - @required this.answers, - @required this.selected, - @required this.onPressed}) + {Key? key, + required this.title, + required this.answers, + required this.selected, + required this.onPressed}) : super(key: key); @override @@ -30,7 +30,7 @@ class _QuestionnaireRadioCheckState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.title.text.black.size(32.sp).bold.make(), + widget.title!.text.black.size(32.sp).bold.make(), 64.w.heightBox, Padding( padding: EdgeInsets.symmetric(horizontal: 96.w), @@ -40,7 +40,7 @@ class _QuestionnaireRadioCheckState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...widget.answers.oddList().map((e) { + ...widget.answers!.oddList().map((e) { return Row( children: [ GestureDetector( @@ -53,7 +53,7 @@ class _QuestionnaireRadioCheckState extends State { ), ), 16.w.widthBox, - e.answer.text.black.size(28.sp).make(), + e.answer!.text.black.size(28.sp).make(), ], ); }).toList(), @@ -62,7 +62,7 @@ class _QuestionnaireRadioCheckState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...widget.answers.evenList().map((e) { + ...widget.answers!.evenList().map((e) { return Row( children: [ GestureDetector( @@ -75,7 +75,7 @@ class _QuestionnaireRadioCheckState extends State { ), ), 16.w.widthBox, - e.answer.text.black.size(28.sp).make(), + e.answer!.text.black.size(28.sp).make(), ], ); }).toList(), diff --git a/lib/ui/manager/questionnaire/submit_complish_page.dart b/lib/ui/manager/questionnaire/submit_complish_page.dart index 168fc545..accec6c8 100644 --- a/lib/ui/manager/questionnaire/submit_complish_page.dart +++ b/lib/ui/manager/questionnaire/submit_complish_page.dart @@ -9,9 +9,9 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class SubmitComplishPage extends StatelessWidget { - final bool status; - final String message; - const SubmitComplishPage({Key key, this.status, this.message}) + final bool? status; + final String? message; + const SubmitComplishPage({Key? key, this.status, this.message}) : super(key: key); @override @@ -28,19 +28,19 @@ class SubmitComplishPage extends StatelessWidget { height: 110.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(55.w), - color: this.status ? kPrimaryColor : kDangerColor, + color: this.status! ? kPrimaryColor : kDangerColor, ), child: Icon( - this.status + this.status! ? CupertinoIcons.checkmark : CupertinoIcons.multiply, size: 100.w, ), ), 48.w.heightBox, - (this.status ? '提交成功' : '提交失败').text.size(36.sp).black.bold.make(), + (this.status! ? '提交成功' : '提交失败').text.size(36.sp).black.bold.make(), 16.w.heightBox, - (this.status ? '您的建议我们已经收到,感谢填写' : this.message) + (this.status! ? '您的建议我们已经收到,感谢填写' : this.message)! .text .color(ktextSubColor) .size(26.sp) @@ -56,7 +56,7 @@ class SubmitComplishPage extends StatelessWidget { onPressed: () { Get.back(); }, - child: (this.status ? '返回' : '重新提交') + child: (this.status! ? '返回' : '重新提交') .text .color(ktextPrimary) .size(36.sp) diff --git a/lib/ui/manager/visitor/visitor_list_item.dart b/lib/ui/manager/visitor/visitor_list_item.dart index 850cc9ab..06161edf 100644 --- a/lib/ui/manager/visitor/visitor_list_item.dart +++ b/lib/ui/manager/visitor/visitor_list_item.dart @@ -11,7 +11,7 @@ import 'package:aku_community/utils/headers.dart'; class VisitorListItem extends StatefulWidget { final VisitorListItemModel model; - VisitorListItem({Key key, @required this.model}) : super(key: key); + VisitorListItem({Key? key, required this.model}) : super(key: key); @override _VisitorListItemState createState() => _VisitorListItemState(); @@ -28,7 +28,7 @@ class _VisitorListItemState extends State { return buffer.toString(); } - bool get outDate => DateTime.now().isAfter(widget.model.date); + bool get outDate => DateTime.now().isAfter(widget.model.date!); _buildSuffix() { if (outDate) return MaterialButton( diff --git a/lib/ui/manager/visitor/visitor_passport_page.dart b/lib/ui/manager/visitor/visitor_passport_page.dart index e0e1e946..7b1755c5 100644 --- a/lib/ui/manager/visitor/visitor_passport_page.dart +++ b/lib/ui/manager/visitor/visitor_passport_page.dart @@ -21,7 +21,7 @@ import 'package:aku_community/widget/buttons/bottom_button.dart'; class VisitorPassportPage extends StatefulWidget { final VisitorListItemModel model; - VisitorPassportPage({Key key, @required this.model}) : super(key: key); + VisitorPassportPage({Key? key, required this.model}) : super(key: key); @override _VisitorPassportPageState createState() => _VisitorPassportPageState(); @@ -70,7 +70,7 @@ class _VisitorPassportPageState extends State { width: 40.w, ), 16.wb, - widget.model.name.text + widget.model.name!.text .size(36.sp) .bold .overflow(TextOverflow.ellipsis) @@ -85,7 +85,7 @@ class _VisitorPassportPageState extends State { width: 40.w, ), 16.wb, - (widget.model.drive ? '无车辆信息' : widget.model.carNum) + (widget.model.drive ? '无车辆信息' : widget.model.carNum)! .text .size(36.sp) .bold @@ -135,11 +135,11 @@ class _VisitorPassportPageState extends State { bottomNavigationBar: BottomButton( onPressed: () async { VoidCallback cancel = BotToast.showLoading(); - RenderRepaintBoundary boundary = - _repaintKey.currentContext.findRenderObject(); + RenderRepaintBoundary boundary = _repaintKey.currentContext! + .findRenderObject() as RenderRepaintBoundary; ui.Image image = await boundary.toImage(pixelRatio: 3); ByteData byteData = - await image.toByteData(format: ui.ImageByteFormat.png); + (await (image.toByteData(format: ui.ImageByteFormat.png)))!; Uint8List png = byteData.buffer.asUint8List(); cancel(); shareToWeChat(WeChatShareImageModel( diff --git a/lib/ui/manager/visitor/visitor_record_page.dart b/lib/ui/manager/visitor/visitor_record_page.dart index 903ccd62..020f9484 100644 --- a/lib/ui/manager/visitor/visitor_record_page.dart +++ b/lib/ui/manager/visitor/visitor_record_page.dart @@ -6,7 +6,7 @@ import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; class VisitorRecordPage extends StatefulWidget { - VisitorRecordPage({Key key}) : super(key: key); + VisitorRecordPage({Key? key}) : super(key: key); @override _VisitorRecordPageState createState() => _VisitorRecordPageState(); @@ -14,7 +14,7 @@ class VisitorRecordPage extends StatefulWidget { class _VisitorRecordPageState extends State with TickerProviderStateMixin { - TabController _controller; + TabController? _controller; //导航标签 List _tabs = ['未到访客', '已到访客']; @@ -26,7 +26,7 @@ class _VisitorRecordPageState extends State @override void dispose() { - _controller.dispose(); + _controller!.dispose(); super.dispose(); } diff --git a/lib/ui/manager/visitor/visitor_record_view.dart b/lib/ui/manager/visitor/visitor_record_view.dart index 44c87778..dd27b9cc 100644 --- a/lib/ui/manager/visitor/visitor_record_view.dart +++ b/lib/ui/manager/visitor/visitor_record_view.dart @@ -11,7 +11,7 @@ import 'package:aku_community/utils/headers.dart'; class VisitorRecordView extends StatefulWidget { ///访客状态(1.未到,2.已到) final int type; - VisitorRecordView({Key key, @required this.type}) : super(key: key); + VisitorRecordView({Key? key, required this.type}) : super(key: key); @override _VisitorRecordViewState createState() => _VisitorRecordViewState(); @@ -22,18 +22,18 @@ class _VisitorRecordViewState extends State { @override void dispose() { - _refreshController?.dispose(); + _refreshController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { - return BeeListView( + return BeeListView( controller: _refreshController, path: API.manager.visitorAccessList, extraParams: {'visitorStatus': widget.type}, convert: (model) { - return model.tableList + return model.tableList! .map((e) => VisitorListItemModel.fromJson(e)) .toList(); }, diff --git a/lib/ui/profile/car/car_manage_card.dart b/lib/ui/profile/car/car_manage_card.dart index d8282af3..70cefc1e 100644 --- a/lib/ui/profile/car/car_manage_card.dart +++ b/lib/ui/profile/car/car_manage_card.dart @@ -5,7 +5,7 @@ import 'package:aku_community/utils/headers.dart'; class CarManageCard extends StatelessWidget { final CarParkingModel model; - const CarManageCard({Key key, @required this.model}) : super(key: key); + const CarManageCard({Key? key, required this.model}) : super(key: key); String get _assetImage { return model.outdated @@ -29,17 +29,17 @@ class CarManageCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.code, + model.code!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 36.sp, ), ), Text( - S.of(context).tempPlotName, + S.of(context)!.tempPlotName, style: Theme.of(context) .textTheme - .subtitle2 + .subtitle2! .copyWith(color: Color(0xFF999999)), ), Spacer(), @@ -50,13 +50,13 @@ class CarManageCard extends StatelessWidget { children: [ Text( '类型', - style: Theme.of(context).textTheme.bodyText1.copyWith( + style: Theme.of(context).textTheme.bodyText1!.copyWith( color: Color(0xFF666666), ), ), Text( model.carTypeName, - style: Theme.of(context).textTheme.subtitle2.copyWith( + style: Theme.of(context).textTheme.subtitle2!.copyWith( fontWeight: FontWeight.bold, ), ), @@ -67,13 +67,13 @@ class CarManageCard extends StatelessWidget { children: [ Text( '到期时间', - style: Theme.of(context).textTheme.bodyText1.copyWith( + style: Theme.of(context).textTheme.bodyText1!.copyWith( color: Color(0xFF666666), ), ), Text( model.dateName, - style: Theme.of(context).textTheme.subtitle2.copyWith( + style: Theme.of(context).textTheme.subtitle2!.copyWith( fontWeight: FontWeight.bold, ), ), diff --git a/lib/ui/profile/car/car_manage_page.dart b/lib/ui/profile/car/car_manage_page.dart index 00a79fce..444c4907 100644 --- a/lib/ui/profile/car/car_manage_page.dart +++ b/lib/ui/profile/car/car_manage_page.dart @@ -9,7 +9,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class CarManagePage extends StatefulWidget { - CarManagePage({Key key}) : super(key: key); + CarManagePage({Key? key}) : super(key: key); @override _CarManagePageState createState() => _CarManagePageState(); diff --git a/lib/ui/profile/car_parking/car_parking_card.dart b/lib/ui/profile/car_parking/car_parking_card.dart index 3576f5ad..ee0b3ea2 100644 --- a/lib/ui/profile/car_parking/car_parking_card.dart +++ b/lib/ui/profile/car_parking/car_parking_card.dart @@ -5,7 +5,7 @@ import 'package:aku_community/utils/headers.dart'; class CarparkingCard extends StatelessWidget { final CarParkingModel model; - const CarparkingCard({Key key, @required this.model}) : super(key: key); + const CarparkingCard({Key? key, required this.model}) : super(key: key); String get _assetImage { return model.outdated @@ -29,17 +29,17 @@ class CarparkingCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.code, + model.code!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 36.sp, ), ), Text( - S.of(context).tempPlotName, + S.of(context)!.tempPlotName, style: Theme.of(context) .textTheme - .subtitle2 + .subtitle2! .copyWith(color: Color(0xFF999999)), ), Spacer(), @@ -50,13 +50,13 @@ class CarparkingCard extends StatelessWidget { children: [ Text( '类型', - style: Theme.of(context).textTheme.bodyText1.copyWith( + style: Theme.of(context).textTheme.bodyText1!.copyWith( color: Color(0xFF666666), ), ), Text( model.typeName, - style: Theme.of(context).textTheme.subtitle2.copyWith( + style: Theme.of(context).textTheme.subtitle2!.copyWith( fontWeight: FontWeight.bold, ), ), @@ -67,13 +67,13 @@ class CarparkingCard extends StatelessWidget { children: [ Text( '到期时间', - style: Theme.of(context).textTheme.bodyText1.copyWith( + style: Theme.of(context).textTheme.bodyText1!.copyWith( color: Color(0xFF666666), ), ), Text( model.dateName, - style: Theme.of(context).textTheme.subtitle2.copyWith( + style: Theme.of(context).textTheme.subtitle2!.copyWith( fontWeight: FontWeight.bold, ), ), diff --git a/lib/ui/profile/car_parking/car_parking_page.dart b/lib/ui/profile/car_parking/car_parking_page.dart index e690b783..4681bc5e 100644 --- a/lib/ui/profile/car_parking/car_parking_page.dart +++ b/lib/ui/profile/car_parking/car_parking_page.dart @@ -9,7 +9,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class CarParkingPage extends StatefulWidget { - CarParkingPage({Key key}) : super(key: key); + CarParkingPage({Key? key}) : super(key: key); @override _CarParkingPageState createState() => _CarParkingPageState(); diff --git a/lib/ui/profile/car_parking/manage_car_parking_page.dart b/lib/ui/profile/car_parking/manage_car_parking_page.dart index 65c27348..051373bf 100644 --- a/lib/ui/profile/car_parking/manage_car_parking_page.dart +++ b/lib/ui/profile/car_parking/manage_car_parking_page.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class ManageCarParkingPage extends StatefulWidget { - ManageCarParkingPage({Key key}) : super(key: key); + ManageCarParkingPage({Key? key}) : super(key: key); @override _ManageCarParkingPageState createState() => _ManageCarParkingPageState(); diff --git a/lib/ui/profile/car_parking/mange_card_parking_card.dart b/lib/ui/profile/car_parking/mange_card_parking_card.dart index 0bddd13d..84420ac3 100644 --- a/lib/ui/profile/car_parking/mange_card_parking_card.dart +++ b/lib/ui/profile/car_parking/mange_card_parking_card.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class ManageCarParkingCard extends StatelessWidget { - const ManageCarParkingCard({Key key}) : super(key: key); + const ManageCarParkingCard({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/profile/house/add_house_page.dart b/lib/ui/profile/house/add_house_page.dart index 6d3c6960..26832544 100644 --- a/lib/ui/profile/house/add_house_page.dart +++ b/lib/ui/profile/house/add_house_page.dart @@ -16,7 +16,7 @@ import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class AddHousePage extends StatefulWidget { - AddHousePage({Key key}) : super(key: key); + AddHousePage({Key? key}) : super(key: key); @override _AddHousePageState createState() => _AddHousePageState(); @@ -26,9 +26,9 @@ class _AddHousePageState extends State { TextEditingController _nameController = TextEditingController(); TextEditingController _idController = TextEditingController(); GlobalKey _formKey = GlobalKey(); - HouseItem _item; - int _roleType; - DateTimeRange _range; + HouseItem? _item; + int? _roleType; + DateTimeRange? _range; TextStyle get _hintStyle => TextStyle( fontSize: 36.sp, @@ -48,8 +48,8 @@ class _AddHousePageState extends State { _roleType != null && _rentCheck; _renderTile({ - String title, - Widget item, + required String title, + Widget? item, }) { return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -65,9 +65,9 @@ class _AddHousePageState extends State { } _renderTextField({ - String hintText, - TextEditingController controller, - FormFieldValidator validator, + String? hintText, + TextEditingController? controller, + FormFieldValidator? validator, }) { return TextFormField( controller: controller, @@ -88,9 +88,9 @@ class _AddHousePageState extends State { } _renderPicker({ - @required String text, - @required String hintText, - VoidCallback onTap, + required String? text, + required String hintText, + VoidCallback? onTap, }) { bool showText = text?.isNotEmpty ?? false; return MaterialButton( @@ -100,7 +100,7 @@ class _AddHousePageState extends State { child: Row( children: [ Text( - showText ? text : hintText, + showText ? text! : hintText, style: showText ? _textStyle : _hintStyle, ), Spacer(), @@ -124,12 +124,12 @@ class _AddHousePageState extends State { return MaterialButton( padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 30.w), onPressed: () async { - DateTimeRange range = await showDateRangePicker( + DateTimeRange? range = await showDateRangePicker( context: context, builder: (context, child) { return Theme( data: ThemeData(primarySwatch: Colors.yellow), - child: child, + child: child!, ); }, firstDate: DateTime.now().subtract(Duration(days: 30)), @@ -152,8 +152,8 @@ class _AddHousePageState extends State { @override void dispose() { - _nameController?.dispose(); - _idController?.dispose(); + _nameController.dispose(); + _idController.dispose(); super.dispose(); } @@ -170,7 +170,7 @@ class _AddHousePageState extends State { _renderTile( title: '小区名称', item: _renderPicker( - text: S.of(context).tempPlotName, + text: S.of(context)!.tempPlotName, hintText: '请选择小区', // 跳转到选择小区页面 // TODO 小区页面 @@ -185,7 +185,7 @@ class _AddHousePageState extends State { text: _item?.houseName, hintText: '请选择楼栋、单元、室', onTap: () async { - HouseItem tempItem = await Get.to(() => PickBuildingPage()); + HouseItem? tempItem = await Get.to(() => PickBuildingPage()); if (tempItem != null) _item = tempItem; setState(() {}); }, @@ -197,7 +197,7 @@ class _AddHousePageState extends State { text: PickRolePage.getType(_roleType), hintText: '请选择身份', onTap: () async { - int role = + int? role = await Get.to(() => PickRolePage(init: _roleType)); if (role != null) { _roleType = role; @@ -247,7 +247,7 @@ class _AddHousePageState extends State { child: Text('提交审核'), onPressed: _buttonCanTap ? () { - if (_formKey.currentState.validate()) { + if (_formKey.currentState!.validate()) { _identifyHouse(); } } @@ -262,7 +262,7 @@ class _AddHousePageState extends State { _identifyHouse() async { Map params = { - 'estateId': _item.house.value, + 'estateId': _item!.house.value, 'name': _nameController.text, 'type': _roleType, 'idType': 1, @@ -270,8 +270,8 @@ class _AddHousePageState extends State { }; if (_roleType == 3) { params.putIfAbsent( - 'effectiveTimeStart', () => NetUtil.getDate(_range.start)); - params.putIfAbsent('effectiveTimeEnd', () => NetUtil.getDate(_range.end)); + 'effectiveTimeStart', () => NetUtil.getDate(_range!.start)); + params.putIfAbsent('effectiveTimeEnd', () => NetUtil.getDate(_range!.end)); } VoidCallback cancel = BotToast.showLoading(); BaseModel model = await NetUtil().post( @@ -280,6 +280,6 @@ class _AddHousePageState extends State { showMessage: true, ); cancel(); - if (model.status) Get.back(result: true); + if (model.status!) Get.back(result: true); } } diff --git a/lib/ui/profile/house/house_card.dart b/lib/ui/profile/house/house_card.dart index c75e6b7d..70fde43e 100644 --- a/lib/ui/profile/house/house_card.dart +++ b/lib/ui/profile/house/house_card.dart @@ -13,22 +13,22 @@ enum CardAuthType { } class HouseCard extends StatelessWidget { - final HouseModel model; + final HouseModel? model; final CardAuthType type; const HouseCard({ - Key key, - @required this.model, - @required this.type, + Key? key, + required this.model, + required this.type, }) : super(key: key); const HouseCard.fail({ - Key key, - @required this.model, + Key? key, + required this.model, }) : type = CardAuthType.FAIL, super(key: key); const HouseCard.success({ - Key key, - @required this.model, + Key? key, + required this.model, }) : type = CardAuthType.SUCCESS, super(key: key); @@ -43,7 +43,7 @@ class HouseCard extends StatelessWidget { } String get _roleName { - switch (model.type) { + switch (model!.type) { case 1: return '业主'; case 2: @@ -120,12 +120,12 @@ class HouseCard extends StatelessWidget { ), 12.hb, Text( - S.of(context).tempPlotName, + S.of(context)!.tempPlotName, style: Theme.of(context).textTheme.headline3, ), 10.hb, Text( - model.roomName, + model!.roomName!, style: Theme.of(context).textTheme.subtitle1, ), Spacer(), @@ -136,7 +136,7 @@ class HouseCard extends StatelessWidget { children: [ Text( '身份', - style: Theme.of(context).textTheme.subtitle2.copyWith( + style: Theme.of(context).textTheme.subtitle2!.copyWith( color: Color(0xFF666666), ), ), diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index 24bc26bc..c9e8b85b 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -6,7 +6,7 @@ import 'package:aku_community/utils/network/net_util.dart'; class HouseFunc { static Future> get houses async { BaseModel model = await NetUtil().get(API.user.houseList); - if (!model.status) return []; + if (!model.status!) return []; return (model.data as List).map((e) => HouseModel.fromJson(e)).toList(); } } diff --git a/lib/ui/profile/house/house_item.dart b/lib/ui/profile/house/house_item.dart index b42fd867..8a47f8ee 100644 --- a/lib/ui/profile/house/house_item.dart +++ b/lib/ui/profile/house/house_item.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:aku_community/model/user/pick_building_model.dart'; @@ -6,11 +5,11 @@ class HouseItem { PickBuildingModel building; PickBuildingModel house; HouseItem({ - @required this.building, - @required this.house, + required this.building, + required this.house, }); - int get houseCode => house.value; + int? get houseCode => house.value; String get houseName => '${building.label}-${house.label}'; } diff --git a/lib/ui/profile/house/house_owners_page.dart b/lib/ui/profile/house/house_owners_page.dart index 4c94190b..bbd7dc76 100644 --- a/lib/ui/profile/house/house_owners_page.dart +++ b/lib/ui/profile/house/house_owners_page.dart @@ -14,7 +14,7 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class HouseOwnersPage extends StatefulWidget { - HouseOwnersPage({Key key}) : super(key: key); + HouseOwnersPage({Key? key}) : super(key: key); @override _HouseOwnersPageState createState() => _HouseOwnersPageState(); @@ -31,14 +31,14 @@ class _HouseOwnersPageState extends State { ///存在已认证的房屋 bool get _haveAuthedHouse { final appProvider = Provider.of(context, listen: false); - return (appProvider?.selectedHouse?.status ?? 0) == 4; + return (appProvider.selectedHouse?.status ?? 0) == 4; } Widget get _houseTitle { final appProvider = Provider.of(context, listen: false); if (_emptyHouse) return Text('还没有绑定房屋'); - if (appProvider.selectedHouse.status == 1) return Text('您的身份正在审核中,请耐心等待'); - if (appProvider.selectedHouse.status == 3) return Text('审核未通过'); + if (appProvider.selectedHouse!.status == 1) return Text('您的身份正在审核中,请耐心等待'); + if (appProvider.selectedHouse!.status == 3) return Text('审核未通过'); return SizedBox(); } @@ -67,7 +67,7 @@ class _HouseOwnersPageState extends State { : Padding( padding: EdgeInsets.all(32.w), child: HouseCard( - type: appProvider.selectedHouse.reviewed + type: appProvider.selectedHouse!.reviewed ? CardAuthType.SUCCESS : CardAuthType.FAIL, model: appProvider.selectedHouse, @@ -104,7 +104,7 @@ class _HouseOwnersPageState extends State { ///跳转到添加房屋 _addHouse() async { - bool result = await Get.to(() => AddHousePage()); + bool? result = await Get.to(() => AddHousePage()); if (result == true) _refreshController.callRefresh(); } } diff --git a/lib/ui/profile/house/pick_building_page.dart b/lib/ui/profile/house/pick_building_page.dart index 8f7d95fa..dc61f171 100644 --- a/lib/ui/profile/house/pick_building_page.dart +++ b/lib/ui/profile/house/pick_building_page.dart @@ -11,7 +11,7 @@ import 'package:aku_community/ui/profile/house/pick_unit_page.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class PickBuildingPage extends StatefulWidget { - PickBuildingPage({Key key}) : super(key: key); + PickBuildingPage({Key? key}) : super(key: key); @override _PickBuildingPageState createState() => _PickBuildingPageState(); @@ -21,9 +21,9 @@ class _PickBuildingPageState extends State { List _buildingModels = []; _buildItem(PickBuildingModel model) { return ListTile( - title: model.label.text.make(), + title: model.label!.text.make(), onTap: () async { - PickBuildingModel houseModel = + PickBuildingModel? houseModel = await Get.to(() => PickUnitPage(buildingId: model.value)); if (houseModel != null) { HouseItem item = HouseItem(building: model, house: houseModel); diff --git a/lib/ui/profile/house/pick_my_house_page.dart b/lib/ui/profile/house/pick_my_house_page.dart index 9e2ba772..799b095a 100644 --- a/lib/ui/profile/house/pick_my_house_page.dart +++ b/lib/ui/profile/house/pick_my_house_page.dart @@ -18,7 +18,7 @@ import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class PickMyHousePage extends StatefulWidget { - PickMyHousePage({Key key}) : super(key: key); + PickMyHousePage({Key? key}) : super(key: key); @override _PickMyHousePageState createState() => _PickMyHousePageState(); @@ -41,7 +41,7 @@ class _PickMyHousePageState extends State { final appProvider = Provider.of(context, listen: false); List models = List.from(appProvider.houses); models.removeWhere( - (element) => element.id == (appProvider?.selectedHouse?.id ?? -1), + (element) => element.id == (appProvider.selectedHouse?.id ?? -1), ); if (models == null || models.isEmpty) return []; return models; @@ -100,7 +100,7 @@ class _PickMyHousePageState extends State { bottomNavi: ElevatedButton( child: Text('新增房屋'), onPressed: () async { - bool result = await Get.to(() => AddHousePage()); + bool? result = await Get.to(() => AddHousePage()); if (result == true) _refreshController.callRefresh(); }, style: ButtonStyle( @@ -113,18 +113,18 @@ class _PickMyHousePageState extends State { } class _HouseCard extends StatelessWidget { - final HouseModel model; + final HouseModel? model; final bool highlight; final EasyRefreshController controller; const _HouseCard({ - Key key, - @required this.model, + Key? key, + required this.model, this.highlight = false, - @required this.controller, + required this.controller, }) : super(key: key); bool get canTapSlide { if (model == null) return false; - return model.status == 4 || model.status == 3 && !highlight; + return model!.status == 4 || model!.status == 3 && !highlight; } @override @@ -137,7 +137,7 @@ class _HouseCard extends StatelessWidget { SlideAction( onTap: canTapSlide ? () async { - bool result = await Get.dialog(CupertinoAlertDialog( + bool? result = await Get.dialog(CupertinoAlertDialog( title: Text('删除房屋'), content: Text('删除房屋后,可以再次验证添加'), actions: [ @@ -156,7 +156,7 @@ class _HouseCard extends StatelessWidget { await NetUtil().post( API.user.deleteHouse, params: { - 'ids': [model.id] + 'ids': [model!.id] }, ); // if(controller.) @@ -185,7 +185,7 @@ class _HouseCard extends StatelessWidget { Container( child: Text( model?.houseStatus ?? '', - style: Theme.of(context).textTheme.subtitle2.copyWith( + style: Theme.of(context).textTheme.subtitle2!.copyWith( fontWeight: FontWeight.bold, color: model?.houseStatusColor ?? Colors.white, ), @@ -197,7 +197,7 @@ class _HouseCard extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(4.w), gradient: LinearGradient( - colors: model.backgroundColor, + colors: model!.backgroundColor, begin: Alignment.topLeft, end: Alignment.bottomRight, ), @@ -210,8 +210,8 @@ class _HouseCard extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - S.of(context).tempPlotName, - style: Theme.of(context).textTheme.subtitle1.copyWith( + S.of(context)!.tempPlotName, + style: Theme.of(context).textTheme.subtitle1!.copyWith( color: highlight ? Color(0xFFFF8200) : Color(0xFF333333), fontWeight: FontWeight.bold, @@ -219,8 +219,8 @@ class _HouseCard extends StatelessWidget { ), 8.hb, Text( - model.roomName, - style: Theme.of(context).textTheme.subtitle2.copyWith( + model!.roomName!, + style: Theme.of(context).textTheme.subtitle2!.copyWith( color: Color(0xFF999999), ), ), @@ -234,7 +234,7 @@ class _HouseCard extends StatelessWidget { appProvider.setCurrentHouse(model); //我的房屋:修改选中的房产审核id await NetUtil().get(API.user.changeSelectExanmineId, - params: {"examineId": model.estateId}); + params: {"examineId": model!.estateId}); Get.back(); }, ), diff --git a/lib/ui/profile/house/pick_plot_page.dart b/lib/ui/profile/house/pick_plot_page.dart index bbf73340..704a711c 100644 --- a/lib/ui/profile/house/pick_plot_page.dart +++ b/lib/ui/profile/house/pick_plot_page.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class PickPlotPage extends StatefulWidget { - PickPlotPage({Key key}) : super(key: key); + PickPlotPage({Key? key}) : super(key: key); @override _PickPlotPageState createState() => _PickPlotPageState(); diff --git a/lib/ui/profile/house/pick_role_page.dart b/lib/ui/profile/house/pick_role_page.dart index b2475b3c..1e49a08e 100644 --- a/lib/ui/profile/house/pick_role_page.dart +++ b/lib/ui/profile/house/pick_role_page.dart @@ -10,11 +10,11 @@ import 'package:aku_community/widget/bee_scaffold.dart'; /// ///业主 亲属 租客 class PickRolePage extends StatefulWidget { - final int init; + final int? init; - PickRolePage({Key key, this.init = 0}) : super(key: key); + PickRolePage({Key? key, this.init = 0}) : super(key: key); - static String getType(int index) { + static String getType(int? index) { switch (index) { case 1: return '业主'; @@ -37,7 +37,7 @@ class _PickRolePageState extends State { 2: '亲属', 3: '租客', }; - int _pickedValue; + int? _pickedValue; Widget _renderTile(int index, String title) { return MaterialButton( padding: EdgeInsets.symmetric( @@ -53,7 +53,7 @@ class _PickRolePageState extends State { Radio( value: index, groupValue: _pickedValue, - onChanged: (value) { + onChanged: (dynamic value) { setState(() { _pickedValue = value; }); diff --git a/lib/ui/profile/house/pick_unit_page.dart b/lib/ui/profile/house/pick_unit_page.dart index f5fbd1c9..22fb7c98 100644 --- a/lib/ui/profile/house/pick_unit_page.dart +++ b/lib/ui/profile/house/pick_unit_page.dart @@ -9,8 +9,8 @@ import 'package:aku_community/pages/sign/sign_func.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; class PickUnitPage extends StatefulWidget { - final int buildingId; - PickUnitPage({Key key, this.buildingId}) : super(key: key); + final int? buildingId; + PickUnitPage({Key? key, this.buildingId}) : super(key: key); @override _PickUnitPageState createState() => _PickUnitPageState(); @@ -20,7 +20,7 @@ class _PickUnitPageState extends State { List _buildingModels = []; _buildItem(PickBuildingModel model) { return ListTile( - title: model.label.text.make(), + title: model.label!.text.make(), onTap: () { Get.back(result: model); }, diff --git a/lib/ui/search/bee_search.dart b/lib/ui/search/bee_search.dart index 2d42eb93..328e0f7e 100644 --- a/lib/ui/search/bee_search.dart +++ b/lib/ui/search/bee_search.dart @@ -9,7 +9,7 @@ import 'package:aku_community/utils/login_util.dart'; import 'package:aku_community/widget/bee_back_button.dart'; class BeeSearch extends StatefulWidget { - BeeSearch({Key key}) : super(key: key); + BeeSearch({Key? key}) : super(key: key); @override _BeeSearchState createState() => _BeeSearchState(); @@ -24,14 +24,14 @@ class _BeeSearchState extends State { .toList(); } - _renderSearchResultBox(String title, {Widget child, bool visible = true}) { + _renderSearchResultBox(String title, {Widget? child, bool visible = true}) { if (!visible) return SizedBox().sliverBoxAdapter(); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ title.text.size(28.sp).make(), Divider(), - child, + child!, ], ).p(32.w).material(color: Colors.white).sliverBoxAdapter(); } diff --git a/lib/utils/bee_date_util.dart b/lib/utils/bee_date_util.dart index aab70050..4d0cc6e1 100644 --- a/lib/utils/bee_date_util.dart +++ b/lib/utils/bee_date_util.dart @@ -1,23 +1,23 @@ import 'package:flustars/flustars.dart'; class BeeDateUtil { - DateTime date; + DateTime? date; BeeDateUtil(this.date); DateTime get _now => DateTime.now(); - bool get sameYear => _now.year == this.date.year; - bool get sameMonth => sameYear && _now.month == this.date.month; - bool get sameDay => sameMonth && _now.day == this.date.day; + bool get sameYear => _now.year == this.date!.year; + bool get sameMonth => sameYear && _now.month == this.date!.month; + bool get sameDay => sameMonth && _now.day == this.date!.day; bool get isYesterday => (DateTime(_now.year, _now.month, _now.day - 1).compareTo( - DateTime(this.date.year, this.date.month, this.date.day)) == + DateTime(this.date!.year, this.date!.month, this.date!.day)) == 0); bool get isDoubleYesterday => (DateTime(_now.year, _now.month, _now.day - 2).compareTo( - DateTime(this.date.year, this.date.month, this.date.day)) == + DateTime(this.date!.year, this.date!.month, this.date!.day)) == 0); String get timeAgo { - Duration duration = _now.difference(date); + Duration duration = _now.difference(date!); if (duration.inSeconds <= 60) return '${duration.inSeconds}秒前'; if (duration.inMinutes <= 60) return '${duration.inMinutes}分钟前'; if (duration.inHours <= 12) return '${duration.inHours}小时前'; diff --git a/lib/utils/hive_store.dart b/lib/utils/hive_store.dart index 724d2b4c..143ac72d 100644 --- a/lib/utils/hive_store.dart +++ b/lib/utils/hive_store.dart @@ -1,8 +1,8 @@ import 'package:hive/hive.dart'; class HiveStore { - static Box _appBox; - static Box get appBox => _appBox; + static Box? _appBox; + static Box? get appBox => _appBox; static init() async { _appBox = await Hive.openBox('app'); } diff --git a/lib/utils/login_util.dart b/lib/utils/login_util.dart index eb202a56..30c4dcaf 100644 --- a/lib/utils/login_util.dart +++ b/lib/utils/login_util.dart @@ -17,7 +17,7 @@ class LoginUtil { /// /// 未登陆状态用户跳转到登录页面 static bool get isLogin { - final userProvider = Provider.of(Get.context, listen: false); + final userProvider = Provider.of(Get.context!, listen: false); if (userProvider.isNotLogin) { BotToast.showText(text: '请先登录'); Get.to(() => SignInPage()); @@ -34,13 +34,13 @@ class LoginUtil { static bool haveRoom(String name) { if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬|我的访客|我的报修|我的缴费'))) return true; - final appProvider = Provider.of(Get.context, listen: false); + final appProvider = Provider.of(Get.context!, listen: false); if (appProvider.selectedHouse == null) { BotToast.showText(text: '请先添加房屋'); Get.to(() => AddHousePage()); return false; } - if (appProvider.selectedHouse.status != 4) { + if (appProvider.selectedHouse!.status != 4) { BotToast.showText(text: '房屋审核中或审核失败'); Get.to(() => HouseOwnersPage()); return false; diff --git a/lib/utils/network/base_file_model.dart b/lib/utils/network/base_file_model.dart index a42550b3..d7d74aa5 100644 --- a/lib/utils/network/base_file_model.dart +++ b/lib/utils/network/base_file_model.dart @@ -1,7 +1,7 @@ class BaseFileModel { - String message; - String url; - bool status; + String? message; + String? url; + bool? status; BaseFileModel({ this.message, this.url, diff --git a/lib/utils/network/base_list_model.dart b/lib/utils/network/base_list_model.dart index e576232c..5864b137 100644 --- a/lib/utils/network/base_list_model.dart +++ b/lib/utils/network/base_list_model.dart @@ -1,7 +1,7 @@ class BaseListModel { - int pageCount; - int rowCount; - List tableList; + int? pageCount; + int? rowCount; + List? tableList; BaseListModel({ this.pageCount, this.rowCount, diff --git a/lib/utils/network/base_model.dart b/lib/utils/network/base_model.dart index c5f0d954..1b22c35d 100644 --- a/lib/utils/network/base_model.dart +++ b/lib/utils/network/base_model.dart @@ -1,7 +1,7 @@ class BaseModel { - int code; - String message; - bool status; + int? code; + String? message; + bool? status; dynamic data; BaseModel({ this.code, diff --git a/lib/utils/network/login_model.dart b/lib/utils/network/login_model.dart index d0d7fc9e..b22b2559 100644 --- a/lib/utils/network/login_model.dart +++ b/lib/utils/network/login_model.dart @@ -1,7 +1,7 @@ class LoginModel { - String message; - String token; - bool status; + String? message; + String? token; + bool? status; LoginModel({this.message, this.token, this.status}); diff --git a/lib/utils/network/net_util.dart b/lib/utils/network/net_util.dart index 9c118aad..ca82b336 100644 --- a/lib/utils/network/net_util.dart +++ b/lib/utils/network/net_util.dart @@ -15,12 +15,12 @@ import 'package:aku_community/utils/network/base_list_model.dart'; import 'package:aku_community/utils/network/base_model.dart'; class NetUtil { - Dio _dio; + Dio? _dio; static final NetUtil _netUtil = NetUtil._internal(); factory NetUtil() => _netUtil; - Dio get dio => _dio; + Dio? get dio => _dio; NetUtil._internal() { BaseOptions options = BaseOptions( @@ -31,7 +31,7 @@ class NetUtil { headers: {}, ); if (_dio == null) _dio = Dio(options); - dio.interceptors.add(InterceptorsWrapper( + dio!.interceptors.add(InterceptorsWrapper( onRequest: (options, handler) async => handler.next(options), onResponse: (response, handler) async { LoggerData.addData(response); @@ -46,7 +46,7 @@ class NetUtil { ///call auth after login auth(String token) { - _dio.options.headers.putIfAbsent('App-Admin-Token', () => token); + _dio!.options.headers.putIfAbsent('App-Admin-Token', () => token); } static String getDate(DateTime date) => @@ -57,11 +57,11 @@ class NetUtil { /// GET method Future get( String path, { - Map params, + Map? params, bool showMessage = false, }) async { try { - Response res = await _dio.get(path, queryParameters: params); + Response res = await _dio!.get(path, queryParameters: params); BaseModel baseModel = BaseModel.fromJson(res.data); _parseRequestError(baseModel, showMessage: showMessage); return baseModel; @@ -78,11 +78,11 @@ class NetUtil { /// only work with JSON. Future post( String path, { - Map params, + Map? params, bool showMessage = false, }) async { try { - Response res = await _dio.post(path, data: params); + Response res = await _dio!.post(path, data: params); BaseModel baseModel = BaseModel.fromJson(res.data); _parseRequestError(baseModel, showMessage: showMessage); @@ -96,10 +96,10 @@ class NetUtil { Future getList( String path, { - Map params, + Map? params, }) async { try { - Response res = await _dio.get(path, queryParameters: params); + Response res = await _dio!.get(path, queryParameters: params); BaseListModel baseListModel = BaseListModel.fromJson(res.data); return baseListModel; } on DioError catch (e) { @@ -110,7 +110,7 @@ class NetUtil { Future upload(String path, File file) async { try { - Response res = await _dio.post(path, + Response res = await _dio!.post(path, data: FormData.fromMap({ 'file': await MultipartFile.fromFile(file.path), })); @@ -122,8 +122,8 @@ class NetUtil { return BaseFileModel.err(); } - Future> uploadFiles(List files, String api) async { - List urls = []; + Future> uploadFiles(List files, String api) async { + List urls = []; if (files.isEmpty) { return []; } else { @@ -139,7 +139,7 @@ class NetUtil { _parseErr(DioError err) { LoggerData.addData(err); _makeToast(String message) { - BotToast.showText(text: '$message\_${err?.response?.statusCode ?? ''}'); + BotToast.showText(text: '$message\_${err.response?.statusCode ?? ''}'); } switch (err.type) { @@ -160,13 +160,13 @@ class NetUtil { } _parseRequestError(BaseModel model, {bool showMessage = false}) { - final userProvider = Provider.of(Get.context, listen: false); - if (!model.status && model.message == '登录失效,请登录' && userProvider.isLogin) { + final userProvider = Provider.of(Get.context!, listen: false); + if (!model.status! && model.message == '登录失效,请登录' && userProvider.isLogin) { userProvider.logout(); Get.offAll(SignInPage()); } - if (!model.status || showMessage) { - BotToast.showText(text: model.message); + if (!model.status! || showMessage) { + BotToast.showText(text: model.message!); } } } diff --git a/lib/widget/animated/animated_scale.dart b/lib/widget/animated/animated_scale.dart index 323c29e5..591d0cce 100644 --- a/lib/widget/animated/animated_scale.dart +++ b/lib/widget/animated/animated_scale.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; class AnimatedScale extends ImplicitlyAnimatedWidget { - final Widget child; - final double scale; + final Widget? child; + final double? scale; AnimatedScale({this.child, this.scale}) : super( @@ -14,11 +14,11 @@ class AnimatedScale extends ImplicitlyAnimatedWidget { } class _AnimatedScaleState extends AnimatedWidgetBaseState { - Tween scaleTween; + Tween? scaleTween; @override Widget build(BuildContext context) { return Transform.scale( - scale: scaleTween.evaluate(animation), + scale: scaleTween!.evaluate(animation)!, child: widget.child, ); } @@ -29,6 +29,6 @@ class _AnimatedScaleState extends AnimatedWidgetBaseState { scaleTween, widget.scale, (value) => Tween(begin: value), - ); + ) as Tween?; } } diff --git a/lib/widget/animated/animated_transition.dart b/lib/widget/animated/animated_transition.dart index c9d8a73d..83526cd3 100644 --- a/lib/widget/animated/animated_transition.dart +++ b/lib/widget/animated/animated_transition.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; class AnimatedTranslate extends ImplicitlyAnimatedWidget { - final Widget child; - final Offset offset; + final Widget? child; + final Offset? offset; AnimatedTranslate({this.child, this.offset}) : super( @@ -15,11 +15,11 @@ class AnimatedTranslate extends ImplicitlyAnimatedWidget { class _AnimatedTranslateState extends AnimatedWidgetBaseState { - Tween _offsetTween; + Tween? _offsetTween; @override Widget build(BuildContext context) { return Transform.translate( - offset: _offsetTween.evaluate(animation), + offset: _offsetTween!.evaluate(animation)!, child: widget.child, ); } @@ -30,6 +30,6 @@ class _AnimatedTranslateState _offsetTween, widget.offset, (value) => Tween(begin: value), - ); + ) as Tween?; } } diff --git a/lib/widget/bee_back_button.dart b/lib/widget/bee_back_button.dart index 5c7a6720..5c37b970 100644 --- a/lib/widget/bee_back_button.dart +++ b/lib/widget/bee_back_button.dart @@ -5,7 +5,7 @@ import 'package:get/get.dart'; class BeeBackButton extends StatelessWidget { final Color color; - const BeeBackButton({Key key, this.color = Colors.black}) : super(key: key); + const BeeBackButton({Key? key, this.color = Colors.black}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/widget/bee_divider.dart b/lib/widget/bee_divider.dart index c03c7457..6d1a1435 100644 --- a/lib/widget/bee_divider.dart +++ b/lib/widget/bee_divider.dart @@ -3,13 +3,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class BeeDivider extends StatelessWidget { - final double thickness; - final double indent; - final double endIndent; - final Color color; - final bool isHorizontal; + final double? thickness; + final double? indent; + final double? endIndent; + final Color? color; + final bool? isHorizontal; BeeDivider( - {Key key, + {Key? key, this.thickness, this.indent, this.endIndent, @@ -17,7 +17,7 @@ class BeeDivider extends StatelessWidget { this.isHorizontal}) : super(key: key); BeeDivider.horizontal({ - Key key, + Key? key, this.indent, this.endIndent, }) : thickness = 1.w, @@ -25,7 +25,7 @@ class BeeDivider extends StatelessWidget { isHorizontal = true, super(key: key); BeeDivider.vertical({ - Key key, + Key? key, this.indent, this.endIndent, }) : thickness = 1.w, @@ -34,7 +34,7 @@ class BeeDivider extends StatelessWidget { super(key: key); @override Widget build(BuildContext context) { - return isHorizontal + return isHorizontal! ? Divider( height: 0, thickness: this.thickness ?? 1.w, diff --git a/lib/widget/bee_scaffold.dart b/lib/widget/bee_scaffold.dart index d5dcc3df..c65dad38 100644 --- a/lib/widget/bee_scaffold.dart +++ b/lib/widget/bee_scaffold.dart @@ -7,8 +7,8 @@ import 'package:aku_community/constants/app_theme.dart'; import 'package:aku_community/widget/bee_back_button.dart'; class BeeScaffold extends StatelessWidget { - final String title; - final Widget body; + final String? title; + final Widget? body; /// appbar background color /// @@ -16,15 +16,15 @@ class BeeScaffold extends StatelessWidget { final Color bgColor; final Color bodyColor; - final List actions; - final Widget leading; - final Widget bottomNavi; - final PreferredSizeWidget appBarBottom; - final FloatingActionButton fab; + final List? actions; + final Widget? leading; + final Widget? bottomNavi; + final PreferredSizeWidget? appBarBottom; + final FloatingActionButton? fab; final SystemUiOverlayStyle systemStyle; BeeScaffold({ - Key key, + Key? key, this.title, this.body, this.actions, @@ -38,8 +38,8 @@ class BeeScaffold extends StatelessWidget { }) : super(key: key); BeeScaffold.white({ - Key key, - @required this.title, + Key? key, + required this.title, this.body, this.actions, this.leading, @@ -53,11 +53,11 @@ class BeeScaffold extends StatelessWidget { @override Widget build(BuildContext context) { - Widget appBar; + Widget? appBar; if (title != null) appBar = AppBar( backgroundColor: bgColor, - title: title.text.make(), + title: title!.text.make(), leading: leading ?? BeeBackButton(), actions: actions, bottom: appBarBottom, @@ -67,7 +67,7 @@ class BeeScaffold extends StatelessWidget { value: systemStyle, child: Scaffold( backgroundColor: bodyColor, - appBar: appBar, + appBar: appBar as PreferredSizeWidget?, body: body, bottomNavigationBar: bottomNavi, floatingActionButton: fab, diff --git a/lib/widget/buttons/bee_check_box.dart b/lib/widget/buttons/bee_check_box.dart index d2dd4046..f7ca5a38 100644 --- a/lib/widget/buttons/bee_check_box.dart +++ b/lib/widget/buttons/bee_check_box.dart @@ -5,12 +5,12 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class BeeCheckBox extends StatefulWidget { - final Function(bool) onChange; - final bool isRound; - final double size; - BeeCheckBox({Key key, this.onChange, this.isRound, this.size}) + final Function(bool)? onChange; + final bool? isRound; + final double? size; + BeeCheckBox({Key? key, this.onChange, this.isRound, this.size}) : super(key: key); - BeeCheckBox.round({Key key, this.onChange, this.size}) + BeeCheckBox.round({Key? key, this.onChange, this.size}) : this.isRound = true, super(key: key); @override @@ -26,7 +26,7 @@ class _BeeCheckBoxState extends State { onTap: () { _isSelect = !_isSelect; setState(() {}); - widget.onChange(_isSelect); + widget.onChange!(_isSelect); }, child: AnimatedContainer( duration: Duration(milliseconds: 300), @@ -35,7 +35,7 @@ class _BeeCheckBoxState extends State { width: 1.w, color: _isSelect ? kPrimaryColor : kDarkSubColor), color: _isSelect ? kPrimaryColor : Colors.transparent, borderRadius: - BorderRadius.circular(widget.isRound ? boxSize / 2 : 0)), + BorderRadius.circular(widget.isRound! ? boxSize / 2 : 0)), curve: Curves.easeInOutCubic, width: boxSize, height: boxSize, diff --git a/lib/widget/buttons/bee_check_button.dart b/lib/widget/buttons/bee_check_button.dart index 4c1b0006..01ea917c 100644 --- a/lib/widget/buttons/bee_check_button.dart +++ b/lib/widget/buttons/bee_check_button.dart @@ -4,12 +4,12 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class BeeCheckButton extends StatefulWidget { - final Function(T value) onChange; - final T value; - final T groupValue; - final String title; + final Function(T value)? onChange; + final T? value; + final T? groupValue; + final String? title; BeeCheckButton( - {Key key, this.onChange, this.value, this.groupValue, this.title}) + {Key? key, this.onChange, this.value, this.groupValue, this.title}) : super(key: key); @override @@ -22,9 +22,9 @@ class _BeeCheckButtonState extends State { Widget build(BuildContext context) { return MaterialButton( onPressed: () { - widget.onChange(widget.value); + widget.onChange!(widget.value); }, - child: widget.title.text + child: widget.title!.text .color(isSelect ? ktextPrimary : Color(0xFF979797)) .size(32.sp) .make(), diff --git a/lib/widget/buttons/bee_check_radio.dart b/lib/widget/buttons/bee_check_radio.dart index 29d9f425..45040a08 100644 --- a/lib/widget/buttons/bee_check_radio.dart +++ b/lib/widget/buttons/bee_check_radio.dart @@ -5,9 +5,9 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class BeeCheckRadio extends StatefulWidget { - final T value; - final List groupValue; - BeeCheckRadio({Key key, this.value, this.groupValue}) : super(key: key); + final T? value; + final List? groupValue; + BeeCheckRadio({Key? key, this.value, this.groupValue}) : super(key: key); @override _BeeCheckRadioState createState() => _BeeCheckRadioState(); @@ -15,7 +15,7 @@ class BeeCheckRadio extends StatefulWidget { class _BeeCheckRadioState extends State { bool get _selected { - if (widget.groupValue.contains(widget.value)) { + if (widget.groupValue!.contains(widget.value)) { return true; } else { return false; diff --git a/lib/widget/buttons/bee_single_check.dart b/lib/widget/buttons/bee_single_check.dart index bc1b7ac7..cf8fbde7 100644 --- a/lib/widget/buttons/bee_single_check.dart +++ b/lib/widget/buttons/bee_single_check.dart @@ -5,9 +5,9 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class BeeSingleCheck extends StatefulWidget { - final T value; - final T groupValue; - BeeSingleCheck({Key key, this.value, this.groupValue}) : super(key: key); + final T? value; + final T? groupValue; + BeeSingleCheck({Key? key, this.value, this.groupValue}) : super(key: key); @override _BeeSingleCheckState createState() => _BeeSingleCheckState(); diff --git a/lib/widget/buttons/bottom_button.dart b/lib/widget/buttons/bottom_button.dart index 1270b16c..1fecd1af 100644 --- a/lib/widget/buttons/bottom_button.dart +++ b/lib/widget/buttons/bottom_button.dart @@ -5,13 +5,13 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:aku_community/base/base_style.dart'; class BottomButton extends StatelessWidget { - final VoidCallback onPressed; + final VoidCallback? onPressed; final Widget child; const BottomButton({ - Key key, - @required this.onPressed, - @required this.child, + Key? key, + required this.onPressed, + required this.child, }) : super(key: key); @override diff --git a/lib/widget/buttons/column_action_button.dart b/lib/widget/buttons/column_action_button.dart index caa013f4..7c8e42f6 100644 --- a/lib/widget/buttons/column_action_button.dart +++ b/lib/widget/buttons/column_action_button.dart @@ -5,10 +5,10 @@ import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/utils/headers.dart'; class ColumnActionButton extends StatelessWidget { - final VoidCallback onPressed; - final String title; - final String path; - const ColumnActionButton({Key key, this.onPressed, this.title, this.path}) + final VoidCallback? onPressed; + final String? title; + final String? path; + const ColumnActionButton({Key? key, this.onPressed, this.title, this.path}) : super(key: key); @override @@ -21,9 +21,9 @@ class ColumnActionButton extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max, children: [ - Image.asset(path, height: 48.w, width: 48.w), + Image.asset(path!, height: 48.w, width: 48.w), 4.hb, - title.text.size(20.sp).black.make(), + title!.text.size(20.sp).black.make(), ], ), ); diff --git a/lib/widget/buttons/radio_button.dart b/lib/widget/buttons/radio_button.dart index 67a9d404..d404318d 100644 --- a/lib/widget/buttons/radio_button.dart +++ b/lib/widget/buttons/radio_button.dart @@ -6,8 +6,8 @@ import 'package:aku_community/widget/animated/animated_scale.dart'; class BeeRadio extends StatefulWidget { final T value; - final List groupValues; - BeeRadio({Key key, @required this.value, @required this.groupValues}) + final List? groupValues; + BeeRadio({Key? key, required this.value, required this.groupValues}) : super(key: key); @override @@ -16,7 +16,7 @@ class BeeRadio extends StatefulWidget { class _BeeRadioState extends State { bool get _selected { - if (widget.groupValues.contains(widget.value)) return true; + if (widget.groupValues!.contains(widget.value)) return true; return false; } diff --git a/lib/widget/common_input.dart b/lib/widget/common_input.dart index d08406d0..fb1ca40f 100644 --- a/lib/widget/common_input.dart +++ b/lib/widget/common_input.dart @@ -6,10 +6,10 @@ import 'package:aku_community/utils/headers.dart'; @Deprecated("DO NOT USE THIS WIDGET") class CommonInput extends StatefulWidget { - final TextEditingController inputController; - final String hintText; - final FormFieldValidator validator; - CommonInput({Key key, this.inputController, this.hintText, this.validator}) + final TextEditingController? inputController; + final String? hintText; + final FormFieldValidator? validator; + CommonInput({Key? key, this.inputController, this.hintText, this.validator}) : super(key: key); @override diff --git a/lib/widget/others/stack_avatar.dart b/lib/widget/others/stack_avatar.dart index 97f9b9df..5aea1124 100644 --- a/lib/widget/others/stack_avatar.dart +++ b/lib/widget/others/stack_avatar.dart @@ -5,10 +5,10 @@ import 'package:aku_community/constants/api.dart'; import 'package:aku_community/utils/headers.dart'; class StackAvatar extends StatelessWidget { - final List avatars; - const StackAvatar({Key key, @required this.avatars}) : super(key: key); + final List avatars; + const StackAvatar({Key? key, required this.avatars}) : super(key: key); double get offset => 35.w; - int get length => avatars?.length ?? 0; + int get length => avatars.length; @override Widget build(BuildContext context) { return Stack( diff --git a/lib/widget/picker/bee_custom_picker.dart b/lib/widget/picker/bee_custom_picker.dart index 236c2c4d..7b83339b 100644 --- a/lib/widget/picker/bee_custom_picker.dart +++ b/lib/widget/picker/bee_custom_picker.dart @@ -5,9 +5,9 @@ import 'package:get/get.dart'; import 'package:aku_community/utils/headers.dart'; class BeeCustomPicker extends StatefulWidget { - final Widget body; - final VoidCallback onPressed; - BeeCustomPicker({Key key, this.body, this.onPressed}) : super(key: key); + final Widget? body; + final VoidCallback? onPressed; + BeeCustomPicker({Key? key, this.body, this.onPressed}) : super(key: key); @override _BeeCustomPickerState createState() => _BeeCustomPickerState(); @@ -34,7 +34,7 @@ class _BeeCustomPickerState extends State { ), ), ), - widget.body, + widget.body!, ], ), ), diff --git a/lib/widget/picker/bee_date_picker.dart b/lib/widget/picker/bee_date_picker.dart index af49ac77..70a02351 100644 --- a/lib/widget/picker/bee_date_picker.dart +++ b/lib/widget/picker/bee_date_picker.dart @@ -7,7 +7,7 @@ import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/widget/picker/bee_custom_picker.dart'; class BeeDatePicker { - static Future pick( + static Future pick( DateTime initDate, { CupertinoDatePickerMode mode = CupertinoDatePickerMode.date, }) async { @@ -18,7 +18,7 @@ class BeeDatePicker { )); } - static Future timePicker(DateTime initDate) async { + static Future timePicker(DateTime initDate) async { return await Get.bottomSheet(_BeeDatePicker( date: initDate, min: initDate, @@ -31,12 +31,12 @@ class BeeDatePicker { class _BeeDatePicker extends StatefulWidget { final DateTime date; final bool use24H; - final DateTime max; - final DateTime min; - final CupertinoDatePickerMode mode; + final DateTime? max; + final DateTime? min; + final CupertinoDatePickerMode? mode; _BeeDatePicker({ - Key key, - @required this.date, + Key? key, + required this.date, this.use24H = false, this.max, this.min, @@ -52,7 +52,7 @@ class __BeeDatePickerState extends State<_BeeDatePicker> { @override void initState() { super.initState(); - _date = widget.date ?? DateTime.now(); + _date = widget.date; } @override diff --git a/lib/widget/picker/bee_house_picker.dart b/lib/widget/picker/bee_house_picker.dart index b9a181ba..e53bd3a2 100644 --- a/lib/widget/picker/bee_house_picker.dart +++ b/lib/widget/picker/bee_house_picker.dart @@ -10,7 +10,7 @@ import 'package:aku_community/ui/profile/house/pick_my_house_page.dart'; import 'package:aku_community/utils/headers.dart'; class BeeHousePicker extends StatelessWidget { - const BeeHousePicker({Key key}) : super(key: key); + const BeeHousePicker({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -32,9 +32,9 @@ class BeeHousePicker extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - S.of(context).tempPlotName.text.black.size(32.sp).bold.make(), + S.of(context)!.tempPlotName.text.black.size(32.sp).bold.make(), 10.w.heightBox, - appProvider.selectedHouse.roomName.text.black + appProvider.selectedHouse!.roomName!.text.black .size(32.sp) .bold .make() diff --git a/lib/widget/picker/bee_image_picker.dart b/lib/widget/picker/bee_image_picker.dart index 974af38a..eca5cbfd 100644 --- a/lib/widget/picker/bee_image_picker.dart +++ b/lib/widget/picker/bee_image_picker.dart @@ -9,9 +9,9 @@ import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/utils/headers.dart'; class BeeImagePicker { - static Future pick( - {String title, double maxWidth = 1000, double maxHeight = 1000}) async { - PickedFile file = await Get.bottomSheet(CupertinoActionSheet( + static Future pick( + {required String title, double maxWidth = 1000, double maxHeight = 1000}) async { + PickedFile? file = await Get.bottomSheet(CupertinoActionSheet( title: title.text.isIntrinsic.make(), actions: [ CupertinoDialogAction( diff --git a/lib/widget/picker/bee_image_preview.dart b/lib/widget/picker/bee_image_preview.dart index b3c1de7e..4b4d6f0a 100644 --- a/lib/widget/picker/bee_image_preview.dart +++ b/lib/widget/picker/bee_image_preview.dart @@ -9,8 +9,8 @@ import 'package:aku_community/const/resource.dart'; import 'package:aku_community/constants/api.dart'; class BeeImagePreview extends StatefulWidget { - static Future toFile({@required File file, String tag}) async { - return await navigator.push( + static Future toFile({required File file, String? tag}) async { + return await navigator!.push( PageRouteBuilder( opaque: false, fullscreenDialog: true, @@ -27,8 +27,8 @@ class BeeImagePreview extends StatefulWidget { ); } - static toPath({@required String path, String tag}) { - navigator.push( + static toPath({required String? path, String? tag}) { + navigator!.push( PageRouteBuilder( opaque: false, fullscreenDialog: true, @@ -45,14 +45,14 @@ class BeeImagePreview extends StatefulWidget { ); } - final File file; - final String path; - final String tag; - BeeImagePreview.file({Key key, @required this.file, this.tag}) + final File? file; + final String? path; + final String? tag; + BeeImagePreview.file({Key? key, required this.file, this.tag}) : path = null, super(key: key); - BeeImagePreview.path({Key key, @required this.path, this.tag}) + BeeImagePreview.path({Key? key, required this.path, this.tag}) : file = null, super(key: key); @@ -64,7 +64,7 @@ class _BeeImagePreviewState extends State { Widget get image { if (widget.file == null) return Hero( - tag: widget.tag ?? widget.path, + tag: widget.tag ?? widget.path!, child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, image: API.image(widget.path), @@ -73,7 +73,7 @@ class _BeeImagePreviewState extends State { else return Hero( tag: widget.tag ?? widget.file.hashCode, - child: Image.file(widget.file), + child: Image.file(widget.file!), ); } diff --git a/lib/widget/picker/grid_image_picker.dart b/lib/widget/picker/grid_image_picker.dart index 9d2f0665..f906c88a 100644 --- a/lib/widget/picker/grid_image_picker.dart +++ b/lib/widget/picker/grid_image_picker.dart @@ -30,8 +30,8 @@ class GridImagePicker extends StatefulWidget { ///Padding final EdgeInsetsGeometry padding; GridImagePicker({ - Key key, - @required this.onChange, + Key? key, + required this.onChange, this.padding = EdgeInsets.zero, }) : super(key: key); @@ -59,7 +59,7 @@ class _GridImagePickerState extends State { size: Size(80.w, 80.w), ), onPressed: () async { - File file = await BeeImagePicker.pick(title: '选择图片'); + File? file = await BeeImagePicker.pick(title: '选择图片'); if (file != null) _files.insert(0, file); setState(() {}); widget.onChange(_files); @@ -83,7 +83,7 @@ class _GridImagePickerState extends State { Get.to(() => BeeImagePreview.file(file: file), opaque: false); }, onLongPress: () async { - bool result = await Get.dialog(CupertinoAlertDialog( + bool? result = await Get.dialog(CupertinoAlertDialog( title: '删除该图片?'.text.isIntrinsic.make(), actions: [ CupertinoDialogAction( diff --git a/lib/widget/tab_bar/bee_tab_bar.dart b/lib/widget/tab_bar/bee_tab_bar.dart index b583b29a..6366b3a7 100644 --- a/lib/widget/tab_bar/bee_tab_bar.dart +++ b/lib/widget/tab_bar/bee_tab_bar.dart @@ -3,14 +3,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class BeeTabBar extends StatefulWidget with PreferredSizeWidget { - final TabController controller; + final TabController? controller; final List tabs; - final Function(int index) onTap; + final Function(int index)? onTap; final bool scrollable; BeeTabBar({ - Key key, - @required this.controller, - @required this.tabs, + Key? key, + required this.controller, + required this.tabs, this.onTap, this.scrollable = false, }) : super(key: key); @@ -24,18 +24,18 @@ class BeeTabBar extends StatefulWidget with PreferredSizeWidget { class _BeeTabBarState extends State { update() { - if (widget.onTap != null) widget.onTap(widget.controller.index); + if (widget.onTap != null) widget.onTap!(widget.controller!.index); } @override void initState() { super.initState(); - widget.controller.addListener(update); + widget.controller!.addListener(update); } @override void dispose() { - widget.controller.removeListener(update); + widget.controller!.removeListener(update); super.dispose(); } diff --git a/lib/widget/views/ bee_download_view.dart b/lib/widget/views/ bee_download_view.dart index f4313d0d..5aab0290 100644 --- a/lib/widget/views/ bee_download_view.dart +++ b/lib/widget/views/ bee_download_view.dart @@ -9,8 +9,8 @@ import 'package:path_provider/path_provider.dart'; import 'package:aku_community/constants/api.dart'; class BeeDownloadView extends StatefulWidget { - final String file; - BeeDownloadView({Key key, this.file}) : super(key: key); + final String? file; + BeeDownloadView({Key? key, this.file}) : super(key: key); @override _BeeDownloadViewState createState() => _BeeDownloadViewState(); @@ -18,7 +18,7 @@ class BeeDownloadView extends StatefulWidget { class _BeeDownloadViewState extends State { Dio dio = Dio(); - double progress; + double? progress; Future download() async { Directory dir = await getApplicationDocumentsDirectory(); Directory docPath = Directory('${dir.path}/docs'); @@ -28,7 +28,7 @@ class _BeeDownloadViewState extends State { await Future.delayed(Duration(milliseconds: 500)); await dio.download( API.file(widget.file), - '${docPath.path}/${widget.file.split('/').last}', + '${docPath.path}/${widget.file!.split('/').last}', onReceiveProgress: (start, all) { setState(() { progress = start / all; @@ -36,7 +36,7 @@ class _BeeDownloadViewState extends State { print('$start,$all'); }, ); - Get.back(result: '${docPath.path}/${widget.file.split('/').last}'); + Get.back(result: '${docPath.path}/${widget.file!.split('/').last}'); } @override diff --git a/lib/widget/views/application_box.dart b/lib/widget/views/application_box.dart index a00ed784..fb968864 100644 --- a/lib/widget/views/application_box.dart +++ b/lib/widget/views/application_box.dart @@ -6,8 +6,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:aku_community/utils/headers.dart'; class ApplicationBox extends StatelessWidget { - final Widget child; - ApplicationBox({Key key, this.child}) : super(key: key); + final Widget? child; + ApplicationBox({Key? key, this.child}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/widget/views/application_view.dart b/lib/widget/views/application_view.dart index 5f0c3eb7..3a2d3164 100644 --- a/lib/widget/views/application_view.dart +++ b/lib/widget/views/application_view.dart @@ -10,14 +10,14 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/login_util.dart'; class ApplicationView extends StatefulWidget { - final List items; + final List? items; final bool needAllApp; - ApplicationView({Key key, this.needAllApp = true}) + ApplicationView({Key? key, this.needAllApp = true}) : items = null, super(key: key); ApplicationView.custom( - {Key key, @required this.items, this.needAllApp = true}) + {Key? key, required List this.items, this.needAllApp = true}) : assert(items != null), super(key: key); @@ -51,7 +51,7 @@ class _ApplicationViewState extends State { } bool get _isCustom => widget.items != null; - List get _items { + List? get _items { final appProvider = Provider.of(context); return _isCustom ? widget.items : appProvider.myApplications; @@ -65,11 +65,11 @@ class _ApplicationViewState extends State { gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4), itemBuilder: (context, index) { - if (index == _items.length && widget.needAllApp) + if (index == _items!.length && widget.needAllApp) return _buildTile(allApp); - return _buildTile(_items[index]); + return _buildTile(_items![index]); }, - itemCount: widget.needAllApp ? _items.length + 1 : _items.length, + itemCount: widget.needAllApp ? _items!.length + 1 : _items!.length, shrinkWrap: true, ); } diff --git a/lib/widget/views/bee_grid_image_view.dart b/lib/widget/views/bee_grid_image_view.dart index 34472110..25d1fa40 100644 --- a/lib/widget/views/bee_grid_image_view.dart +++ b/lib/widget/views/bee_grid_image_view.dart @@ -6,11 +6,11 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/picker/bee_image_preview.dart'; class BeeGridImageView extends StatelessWidget { - final List urls; + final List urls; final EdgeInsetsGeometry padding; const BeeGridImageView({ - Key key, - @required this.urls, + Key? key, + required this.urls, this.padding = EdgeInsets.zero, }) : super(key: key); @@ -30,7 +30,7 @@ class BeeGridImageView extends StatelessWidget { BeeImagePreview.toPath(path: urls[index], tag: urls[index]); }, child: Hero( - tag: urls[index], + tag: urls[index]!, child: ClipRRect( borderRadius: BorderRadius.circular(8.w), child: FadeInImage.assetNetwork( diff --git a/lib/widget/views/horizontal_image_view.dart b/lib/widget/views/horizontal_image_view.dart index c112702f..77d3f5db 100644 --- a/lib/widget/views/horizontal_image_view.dart +++ b/lib/widget/views/horizontal_image_view.dart @@ -9,10 +9,10 @@ import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/picker/bee_image_preview.dart'; class HorizontalImageView extends StatelessWidget { - final List urls; + final List urls; HorizontalImageView( this.urls, { - Key key, + Key? key, }) : super(key: key); @override @@ -30,7 +30,7 @@ class HorizontalImageView extends StatelessWidget { BeeImagePreview.toPath(path: urls[index], tag: urls[index]); }, child: Hero( - tag: urls[index], + tag: urls[index]!, child: ClipRRect( borderRadius: BorderRadius.circular(8.w), child: FadeInImage.assetNetwork( diff --git a/pubspec.lock b/pubspec.lock index 90a3963d..65cb9ad9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -121,7 +121,7 @@ packages: source: hosted version: "1.1.0" collection: - dependency: transitive + dependency: "direct main" description: name: collection url: "https://pub.flutter-io.cn" diff --git a/pubspec.yaml b/pubspec.yaml index 1e69e829..c54fd7e0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: "none" version: 1.1.21-dev+27 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: @@ -16,7 +16,7 @@ dependencies: permission_handler: ^7.0.0 package_info: ^2.0.0 provider: ^5.0.0 - flutter_screenutil: ^5.0.0-nullsafety.11 + flutter_screenutil: ^5.0.0 cupertino_icons: ^1.0.2 url_launcher: ^6.0.2 flustars: ^2.0.1 @@ -66,6 +66,7 @@ dependencies: firebase_core: ^1.0.3 firebase_crashlytics: ^2.0.0 share: ^2.0.1 + collection: ^1.15.0-nullsafety.4 dev_dependencies: flutter_test: