phase3: nullfix arg-bang handler (argument_type/invalid_assignment). 872 -> 621

This commit is contained in:
2026-07-25 18:16:40 +08:00
parent c21ccbd54d
commit a76b872966
65 changed files with 282 additions and 257 deletions

View File

@@ -61,7 +61,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
Widget build(BuildContext context) {
if (widget.product!.leftNum == null) {
_qty = 0;
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business!);
if (cartInfo != null) {
for (var i = 0; i < cartInfo.productList!.length; i++) {
if (cartInfo.productList![i].product!.id == widget.product!.id
@@ -102,7 +102,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
}
if (widget.addToBasket) {
_qty = 0;
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business!);
if (cartInfo != null) {
for (var i = 0; i < cartInfo.productList!.length; i++) {
if (cartInfo.productList![i].product!.id == widget.product!.id) {
@@ -195,7 +195,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
);
} else {
_qty = 0;
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business!);
if (cartInfo != null) {
for (var i = 0; i < cartInfo.productList!.length; i++) {
if (cartInfo.productList![i].product!.id == widget.product!.id) {
@@ -336,9 +336,9 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
product: widget.product, business: widget.business, startKey: startKey,)),
);
} else {
eventBus.fire(new OnProductWillAddToCart(widget.product, {},
eventBus.fire(new OnProductWillAddToCart(widget.product!, {},
widget.product!.price, widget.product!.description,
widget.business, buttonKey: startKey));
widget.business!, buttonKey: startKey));
}
}
}
@@ -375,7 +375,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
}
} else {
eventBus.fire(new OnProductWillRemoveFromCart(
widget.product, -1, widget.business));
widget.product!, -1, widget.business!));
}
}

View File

@@ -24,7 +24,7 @@ class AnimationPointManager {
Animation animation = createAnimation(controller1);
AnimatedWidget animatedWidget = ParabolicAnimationWidget(
animation: animation,
animation: animation!,
stackKey: stackKey,
startKey: startKey,
endKey: endKey,
@@ -59,7 +59,7 @@ class AnimationPointManager {
Offset popupOffset = Offset.zero,
AnimationStatusListener? statusListener,
}) async {
controller2 = createController(vsync, duration);
controller2 = createController(vsync, duration!);
AnimatedWidget animatedWidget = PopupAnimationWidget(
animation: controller2.view,

View File

@@ -133,7 +133,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
Map<String, dynamic> attrExtraJson = Utils.stringToJson(
Map<String, dynamic> attrExtraJson = Utils.stringToJson(!
product.productAttributes![index].extra);
if (attrExtraJson != null) {
var selectLimitIfFieldEqualsTo = Rule.getRule(
@@ -187,17 +187,17 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
}
for (var i = 0; i < productOptions.length; i++) {
Map<String, dynamic> extraJson = Utils.stringToJson(
productOptions[i].extra);
Map<String, dynamic> extraJson = Utils.stringToJson(!
productOptions[i].extra!);
if (extraJson != null) {
Map<String, dynamic> exclusiveRule = Rule.getRule(
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
Map<String, dynamic> multiItemRule = Rule.getRule(extraJson, Rule.RULE_ACTUAL_QTY_IS);
if (exclusiveRule != null) {
if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name)) {
if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name!)) {
optionsState[product.productAttributes![index].name][i]['disabled'] = true;
} else {
if (_checkOptionIsCheck(productOptions[i].name)) {
if (_checkOptionIsCheck(productOptions[i].name!)) {
setOptionsStateDisabled(
product.productAttributes![index].name, true);
optionsState[product.productAttributes![index]
@@ -207,7 +207,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
}
}
if (multiItemRule != null) {
if (_checkOptionIsCheck(productOptions[i].name)) {
if (_checkOptionIsCheck(productOptions[i].name!)) {
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) {
disableOptionIfNotSelected();
}
@@ -249,9 +249,9 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
Widget _getOptionCheck(ProductOption productOption, bool optDisabled, int optIndex) {
bool disabled = optDisabled;
bool check = _checkOptionIsCheck(productOption.name);
bool check = _checkOptionIsCheck(productOption.name!);
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra);
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra!);
// Utils.jsonPrettyPrint(extraJson);
double extraAdjustAmount = 0.0;
@@ -333,7 +333,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
productOption.name,
productOption.name!,
style: new TextStyle(
fontSize: 14.0,
color: check ? selectedTextColor : deselectTextColor,

View File

@@ -131,7 +131,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
List<Map<String, dynamic>> optionState = [];
for (var i = 0; i < productOptions.length; i++) {
int qty = 0;
int idx = Utils.selectionsContains(selections, product.productAttributes![index].name, productOptions[i].name);
int idx = Utils.selectionsContains(selections, product.productAttributes![index].name, productOptions[i].name!);
if (idx != -1) {
qty = selections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'];
}
@@ -141,7 +141,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
}
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
Map<String, dynamic> attrExtraJson = Utils.stringToJson(
Map<String, dynamic> attrExtraJson = Utils.stringToJson(!
product.productAttributes![index].extra);
if (attrExtraJson != null) {
var selectLimitIfFieldEqualsTo = Rule.getRule(
@@ -195,17 +195,17 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
}
for (var i = 0; i < productOptions.length; i++) {
Map<String, dynamic> extraJson = Utils.stringToJson(
productOptions[i].extra);
Map<String, dynamic> extraJson = Utils.stringToJson(!
productOptions[i].extra!);
if (extraJson != null) {
Map<String, dynamic> exclusiveRule = Rule.getRule(
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
Map<String, dynamic> multiItemRule = Rule.getRule(extraJson, Rule.RULE_ACTUAL_QTY_IS);
if (exclusiveRule != null) {
if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name)) {
if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name!)) {
optionsState[product.productAttributes![index].name][i]['disabled'] = true;
} else {
if (_checkOptionIsCheck(productOptions[i].name)) {
if (_checkOptionIsCheck(productOptions[i].name!)) {
setOptionsStateDisabled(
product.productAttributes![index].name, true);
optionsState[product.productAttributes![index]
@@ -215,7 +215,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
}
}
if (multiItemRule != null) {
if (_checkOptionIsCheck(productOptions[i].name)) {
if (_checkOptionIsCheck(productOptions[i].name!)) {
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) {
disableOptionIfNotSelected();
}
@@ -257,9 +257,9 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
Widget _getOptionQty(ProductOption productOption, bool optDisabled, int quantity, int optIndex) {
bool disabled = optDisabled;
bool check = _checkOptionIsCheck(productOption.name);
bool check = _checkOptionIsCheck(productOption.name!);
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra);
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra!);
// Utils.jsonPrettyPrint(extraJson);
double extraAdjustAmount = 0.0;
@@ -351,7 +351,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
productOption.name,
productOption.name!,
style: new TextStyle(
fontSize: 14.0,
color: check ? selectedTextColor : deselectTextColor,

View File

@@ -96,12 +96,12 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
}
}
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra);
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra!);
if (extraJson != null) {
Map<String, dynamic> exclusiveRule = Rule.getRule(
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
if (exclusiveRule != null) {
if (_checkOptionIsCheck(productOption.name)) {
if (_checkOptionIsCheck(productOption.name!)) {
setOptionsStateDisabled(product.productAttributes![index].name, false);
}
}
@@ -129,12 +129,12 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
}
for (var i = 0; i < productOptions.length; i++) {
Map<String, dynamic> extraJson = Utils.stringToJson(productOptions[i].extra);
Map<String, dynamic> extraJson = Utils.stringToJson(productOptions[i].extra!);
if (extraJson != null) {
Map<String, dynamic> exclusiveRule = Rule.getRule(
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
if (exclusiveRule != null) {
if (_checkOptionIsCheck(productOptions[i].name)) {
if (_checkOptionIsCheck(productOptions[i].name!)) {
setOptionsStateDisabled(product.productAttributes![index].name, true);
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
break;
@@ -161,9 +161,9 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
Widget _getOptionRadio(ProductOption productOption, bool optDisabled, int optIndex) {
bool disabled = optDisabled;
bool check = _checkOptionIsCheck(productOption.name);
bool check = _checkOptionIsCheck(productOption.name!);
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra);
Map<String, dynamic> extraJson = Utils.stringToJson(productOption.extra!);
// Utils.jsonPrettyPrint(extraJson);
double extraAdjustAmount = 0.0;
@@ -245,7 +245,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
productOption.name,
productOption.name!,
style: new TextStyle(
fontSize: 14.0,
color: check ? selectedTextColor : deselectTextColor,

View File

@@ -36,7 +36,7 @@ class ShowPrice extends StatelessWidget {
Container(
padding: EdgeInsets.only(top: largeFontSize / 10.0),
child: Text(
currencySign,
currencySign!,
style: TextStyle(
fontSize: smallFontSize,
color: color,

View File

@@ -258,7 +258,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
builder: (context, child){
return Positioned(
top: widget.parallaxEnabled ? _getParallax() : 0.0,
child: child,
child: child!,
);
},
child: Container(
@@ -334,14 +334,14 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
widget.header != null ? Positioned(
top: widget.slideDirection == SlideDirection.UP ? 0.0 : null,
bottom: widget.slideDirection == SlideDirection.DOWN ? 0.0 : null,
child: widget.header,
child: widget.header!,
) : Container(),
// footer
widget.footer != null ? Positioned(
top: widget.slideDirection == SlideDirection.UP ? null : 0.0,
bottom: widget.slideDirection == SlideDirection.DOWN ? null : 0.0,
child: widget.footer
child: widget.footer!
) : Container(),
// collapsed panel
@@ -471,7 +471,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
if(v.pixelsPerSecond.dy.abs() >= kSnap*minFlingVelocity || minDistance == d2Snap)
_ac.fling(velocity: visualVelocity);
else
_flingPanelToPosition(widget.snapPoint, visualVelocity);
_flingPanelToPosition(widget.snapPoint!, visualVelocity);
// no snap point exists
}else if(widget.panelSnapping){
@@ -495,7 +495,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
if(minDistance == d2Close){
_close();
}else if(minDistance == d2Snap){
_flingPanelToPosition(widget.snapPoint, visualVelocity);
_flingPanelToPosition(widget.snapPoint!, visualVelocity);
}else{
_open();
}
@@ -561,7 +561,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
//REQUIRES that widget.snapPoint != null
Future<void> _animatePanelToSnapPoint({Duration? duration, Curve curve = Curves.linear}){
assert(widget.snapPoint != null);
return _ac.animateTo(widget.snapPoint, duration: duration, curve: curve);
return _ac.animateTo(widget.snapPoint!, duration: duration, curve: curve);
}
//set the panel position to value - must