null safety
This commit is contained in:
@@ -7,13 +7,13 @@ import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/progress.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:provider/provider.dart';
|
||||
|
||||
import 'model/carton_size_model.dart';
|
||||
|
||||
class CartonSizeEditor extends StatefulWidget {
|
||||
final CartonSize cartonSize;
|
||||
final CartonSize? cartonSize;
|
||||
CartonSizeEditor({this.cartonSize});
|
||||
|
||||
@override
|
||||
@@ -27,8 +27,8 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
||||
TextEditingController _lengthController = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
CartonSize _cartonSize;
|
||||
bool _isNew;
|
||||
CartonSize? _cartonSize;
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -36,10 +36,10 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
||||
if (widget.cartonSize != null) {
|
||||
_cartonSize = widget.cartonSize;
|
||||
_isNew = false;
|
||||
_nameController.text = _cartonSize.name;
|
||||
_widthController.text = _cartonSize.width.toString();
|
||||
_heightController.text = _cartonSize.height.toString();
|
||||
_lengthController.text = _cartonSize.length.toString();
|
||||
_nameController.text = _cartonSize!.name;
|
||||
_widthController.text = _cartonSize!.width.toString();
|
||||
_heightController.text = _cartonSize!.height.toString();
|
||||
_lengthController.text = _cartonSize!.length.toString();
|
||||
} else {
|
||||
_lengthController.text = "12";
|
||||
_widthController.text = "12";
|
||||
@@ -110,7 +110,7 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
||||
await cartonSizeModel.addCartonSize(_cartonSize);
|
||||
} else {
|
||||
CartonSize _cartonSize = CartonSize(
|
||||
id: widget.cartonSize.id,
|
||||
id: widget.cartonSize!.id,
|
||||
name: _nameController.text,
|
||||
length: l,
|
||||
width: w,
|
||||
@@ -184,7 +184,7 @@ class _CartonSizeEditorState extends State<CartonSizeEditor> {
|
||||
CartonSize _cartonSize = CartonSize(
|
||||
name: _nameController.text, length: l, width: w, height: h);
|
||||
|
||||
return widget.cartonSize.isChangedForEdit(_cartonSize);
|
||||
return widget.cartonSize!.isChangedForEdit(_cartonSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user