null safety
This commit is contained in:
@@ -4,7 +4,7 @@ import 'package:fcs/domain/vo/shipment_status.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
@@ -12,10 +12,10 @@ import 'package:timeline_list/timeline_model.dart';
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
|
||||
class StatusTree extends StatelessWidget {
|
||||
final List<ShipmentStatus> shipmentHistory;
|
||||
final String currentStatus;
|
||||
final List<ShipmentStatus>? shipmentHistory;
|
||||
final String? currentStatus;
|
||||
|
||||
const StatusTree({Key key, this.shipmentHistory, this.currentStatus})
|
||||
const StatusTree({Key? key, this.shipmentHistory, this.currentStatus})
|
||||
: super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -39,7 +39,7 @@ class StatusTree extends StatelessWidget {
|
||||
if (shipmentHistory == null || currentStatus == null) return [];
|
||||
bool isPacked = currentStatus != package_received_status &&
|
||||
currentStatus != package_processed_status;
|
||||
return shipmentHistory
|
||||
return shipmentHistory!
|
||||
.map((e) => TimelineModel(
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
@@ -48,17 +48,17 @@ class StatusTree extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Text(e.status,
|
||||
style: TextStyle(
|
||||
color: e.done ? primaryColor : Colors.grey,
|
||||
color: e.done! ? primaryColor : Colors.grey,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold)),
|
||||
e.done || isPacked
|
||||
e.done! || isPacked
|
||||
? Text(dateFormatter.format(e.date))
|
||||
: Container(),
|
||||
e.staffName == null ? Container() : Text(e.staffName)
|
||||
e.staffName == null ? Container() : Text(e.staffName!)
|
||||
],
|
||||
),
|
||||
),
|
||||
iconBackground: e.done ? primaryColor : Colors.grey,
|
||||
iconBackground: e.done! ? primaryColor : Colors.grey,
|
||||
icon: Icon(
|
||||
e.status == "shipped"
|
||||
? Ionicons.ios_airplane
|
||||
|
||||
Reference in New Issue
Block a user