From 6d14b8631c258db8cf5b305c6d5f00b856687cca Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 12 May 2021 10:32:39 +0800 Subject: [PATCH] fix null safety error --- lib/pages/things_page/fixed_submit_page.dart | 2 +- lib/pages/things_page/widget/fixed_detail_page.dart | 5 +++-- lib/utils/bee_map.dart | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index ca6afd51..7c62ffbb 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -85,7 +85,7 @@ class _FixedSubmitPageState extends State { curve: Curves.easeInOutCubic, child: GestureDetector( onTap: () { - Get.to(() => FixedDetailPage(model.id)); + Get.to(() => FixedDetailPage(model.id ?? 0)); }, child: Container( width: 686.w, diff --git a/lib/pages/things_page/widget/fixed_detail_page.dart b/lib/pages/things_page/widget/fixed_detail_page.dart index 78e4a9ac..53ba5bda 100644 --- a/lib/pages/things_page/widget/fixed_detail_page.dart +++ b/lib/pages/things_page/widget/fixed_detail_page.dart @@ -21,7 +21,7 @@ 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, @@ -220,7 +220,8 @@ class _FixedDetailPageState extends State { ...model.appProcessRecordVo! .map((e) => Row( children: [ - BeeMap.processClass[e.operationType!]!.text + (BeeMap.processClass[e.operationType ?? 0] ?? '') + .text .color(ktextSubColor) .size(28.sp) .make(), diff --git a/lib/utils/bee_map.dart b/lib/utils/bee_map.dart index 860a5ff9..386dabe8 100644 --- a/lib/utils/bee_map.dart +++ b/lib/utils/bee_map.dart @@ -16,6 +16,7 @@ class BeeMap { }; static Map processClass = { + 0: '未知', 1: '报修时间', 2: '管家分派', 3: '师傅接单',