null safety
This commit is contained in:
@@ -38,7 +38,7 @@ class _DeliveryAddressSelectionState extends State<DeliveryAddressSelection> {
|
||||
Provider.of<DeliveryAddressModel>(context, listen: false);
|
||||
|
||||
var deliveryAddresses =
|
||||
await addressModel.getDeliveryAddresses(widget.user!.id);
|
||||
await addressModel.getDeliveryAddresses(widget.user!.id!);
|
||||
setState(() {
|
||||
this._deliveryAddresses = deliveryAddresses;
|
||||
});
|
||||
@@ -64,7 +64,7 @@ class _DeliveryAddressSelectionState extends State<DeliveryAddressSelection> {
|
||||
bool updated = await Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
DeliveryAddressEditor(user: widget.user)));
|
||||
if (updated ?? false) {
|
||||
if (updated) {
|
||||
_getDeliverAddresses();
|
||||
}
|
||||
},
|
||||
@@ -117,7 +117,7 @@ class _DeliveryAddressSelectionState extends State<DeliveryAddressSelection> {
|
||||
bool updated = await Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => DeliveryAddressEditor(
|
||||
user: widget.user, deliveryAddress: deliveryAddress)));
|
||||
if (updated ?? false) {
|
||||
if (updated) {
|
||||
_getDeliverAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@ class DiscountDropdown<T> extends StatelessWidget {
|
||||
items: values!.map<DropdownMenuItem<T>>((T value) {
|
||||
return DropdownMenuItem<T>(
|
||||
value: value,
|
||||
child: Text(value == null ? "" : (value as Discount).code,
|
||||
child: Text(
|
||||
value == null ? "" : (value as Discount).code!,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: primaryColor)),
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ class MyDataColumn {
|
||||
///
|
||||
/// The [label] argument must not be null.
|
||||
const MyDataColumn({
|
||||
@required this.label,
|
||||
required this.label,
|
||||
this.tooltip,
|
||||
this.numeric = false,
|
||||
this.onSort,
|
||||
@@ -40,7 +40,7 @@ class MyDataColumn {
|
||||
/// This is a longer description of the column heading, for cases
|
||||
/// where the heading might have been abbreviated to keep the column
|
||||
/// width to a reasonable size.
|
||||
final String tooltip;
|
||||
final String? tooltip;
|
||||
|
||||
/// Whether this column represents numeric data or not.
|
||||
///
|
||||
@@ -53,7 +53,7 @@ class MyDataColumn {
|
||||
/// If null, the column will not be considered sortable.
|
||||
///
|
||||
/// See [MyDataTable.sortColumnIndex] and [MyDataTable.sortAscending].
|
||||
final MyDataColumnSortCallback onSort;
|
||||
final MyDataColumnSortCallback? onSort;
|
||||
|
||||
bool get _debugInteractive => onSort != null;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ class ShowMultiImage extends StatefulWidget {
|
||||
final List<DisplayImageSource> displayImageSources;
|
||||
final int initialPage;
|
||||
const ShowMultiImage(
|
||||
{Key key, this.displayImageSources, this.initialPage = 0})
|
||||
{Key? key, required this.displayImageSources, this.initialPage = 0})
|
||||
: super(key: key);
|
||||
@override
|
||||
_ShowMultiImageState createState() => _ShowMultiImageState();
|
||||
}
|
||||
|
||||
class _ShowMultiImageState extends State<ShowMultiImage> {
|
||||
PageController pageController;
|
||||
late PageController pageController;
|
||||
@override
|
||||
void initState() {
|
||||
pageController = PageController(initialPage: widget.initialPage);
|
||||
@@ -58,7 +58,7 @@ class _ShowMultiImageState extends State<ShowMultiImage> {
|
||||
value: event == null
|
||||
? 0
|
||||
: event.cumulativeBytesLoaded /
|
||||
event.expectedTotalBytes,
|
||||
event.expectedTotalBytes!,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,11 +9,11 @@ typedef BtnCallback();
|
||||
|
||||
/// TaskButton is used to navigate to eash task
|
||||
class TaskButton extends StatelessWidget {
|
||||
final String titleKey;
|
||||
final IconData icon;
|
||||
final BtnCallback btnCallback;
|
||||
final String? titleKey;
|
||||
final IconData? icon;
|
||||
final BtnCallback? btnCallback;
|
||||
|
||||
const TaskButton(this.titleKey, {Key key, this.icon, this.btnCallback})
|
||||
const TaskButton(this.titleKey, {Key? key, this.icon, this.btnCallback})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@@ -45,7 +45,7 @@ class TaskButton extends StatelessWidget {
|
||||
Container(
|
||||
height: 45,
|
||||
alignment: Alignment.topCenter,
|
||||
child: Text(AppTranslations.of(context).text(titleKey),
|
||||
child: Text(AppTranslations.of(context)!.text(titleKey!),
|
||||
textAlign: TextAlign.center,
|
||||
style: languageModel.isEng
|
||||
? TextStyle(
|
||||
|
||||
@@ -6,11 +6,11 @@ import 'package:flutter/material.dart';
|
||||
import 'callbacks.dart';
|
||||
|
||||
class TitleWithAddButton extends StatelessWidget {
|
||||
final IconData iconData;
|
||||
final String titleKey;
|
||||
final OnTap onTap;
|
||||
final IconData? iconData;
|
||||
final String? titleKey;
|
||||
final OnTap? onTap;
|
||||
|
||||
const TitleWithAddButton({Key key, this.iconData, this.titleKey, this.onTap})
|
||||
const TitleWithAddButton({Key? key, this.iconData, this.titleKey, this.onTap})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@@ -28,7 +28,7 @@ class TitleWithAddButton extends StatelessWidget {
|
||||
),
|
||||
LocalText(
|
||||
context,
|
||||
titleKey,
|
||||
titleKey!,
|
||||
color: Colors.black54,
|
||||
fontSize: 20,
|
||||
)
|
||||
@@ -40,7 +40,7 @@ class TitleWithAddButton extends StatelessWidget {
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child: IconButton(
|
||||
onPressed: () => onTap(),
|
||||
onPressed: () => onTap!(),
|
||||
icon: Icon(
|
||||
Icons.add_circle,
|
||||
color: primaryColor,
|
||||
|
||||
Reference in New Issue
Block a user