问题描述
我有一个Yaml文件作为参数传递给java类。但这引发了以下异常:
日志
class DeliveryTimeline extends StatefulWidget {
DeliveryTimeline({Key key,this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<DeliveryTimeline> {
int _currentStep = 0;
String shippingtype;
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,centerTitle: true,iconTheme: new IconThemeData(color: Colors.black),elevation: 0,title: Text(
"Checkout",style: TextStyle(color: Colors.black),),body: Stepper(
type: StepperType.horizontal,steps: _mySteps(),currentStep: this._currentStep,onStepTapped: (step) {
setState(() {
this._currentStep = step;
});
},onStepContinue: () {
setState(() {
if (this._currentStep == 0) {
this._currentStep = this._currentStep + 1;
**//need to get value here on first next click**
} else if (this._currentStep == 1) {
this._currentStep = this._currentStep + 1;
} else {
print('Completed,check fields.');
}
});
},onStepCancel: () {
setState(() {
if (this._currentStep > 0) {
this._currentStep = this._currentStep - 1;
} else {
this._currentStep = 0;
}
});
},controlsBuilder: (BuildContext context,{VoidCallback onStepContinue,VoidCallback onStepCancel,Function onShippingNextClick}) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,children: <Widget>[
OutlineButton(
child: new Text("Back"),onpressed: onStepCancel,shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(4.0))),MaterialButton(
child: Text("Next"),color: AppColors.primarycolor,textColor: Colors.white,onpressed: onStepContinue,],);
}));
}
List<Step> _mySteps() {
List<Step> _steps = [
Step(
title: Text('Delivery'),content: Center(
child: Container(
height: MediaQuery.of(context).size.height / 1.5,child: Delivery(onShipingTypeClicked: (shippingtype){
shippingtype = shippingtype;
print("myvalue${shippingtype}");
},isActive: _currentStep >= 0,Step(
title: Text('Address'),content: Address(),isActive: _currentStep >= 1,Step(
title: Text('Payment'),content: Payment(),isActive: _currentStep >= 2,)
];
return _steps;
}
}
我的分析:
- MyClass打包为jar,它可用于另一个项目,所以我的yaml文件应该有问题。
- Yaml验证已通过,似乎所有变量都使用camelCase。
- 根据我的发现,如果属性值为null(不是按日志记录)和isWritable(我没有获得此部分),PropertyUtils会进行2次检查以引发此异常。
- 对于jdbcDriverClassstring,错误指示在名称上,对于heartbeatThreshold值,其指示在值上。
能帮我解决一下吗?我将非常感谢。
Yaml文件:
class Delivery extends StatefulWidget {
final ValueChanged<String> onShipingTypeClicked;
Delivery({this.onShipingTypeClicked});
@override
_DeliveryState createState() => _DeliveryState();
}
class _DeliveryState extends State<Delivery> {
List<RadioModel> sampleData = new List<RadioModel>();
@override
void initState() {
// Todo: implement initState
super.initState();
sampleData.add(new RadioModel(false,'A',0xffe6194B,"Standard Delivery","Order will be delivered between 3 - 5 business days",1));
sampleData.add(new RadioModel(
true,"Next Day Delivery","Place your order before 6pm and your items will be delivered the next day",2));
sampleData.add(new RadioModel(
false,"Nominated Delivery","Pick a particular date from the calendar and order will be delivered on selected date",3));
}
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new ListView.builder(
itemCount: sampleData.length,shrinkWrap: true,physics: NeverScrollableScrollPhysics(),itemBuilder: (BuildContext context,int index) {
return new InkWell(
onTap: () {
setState(() {
sampleData.forEach((element) => element.isSelected = false);
sampleData[index].isSelected = true;
widget.onShipingTypeClicked(sampleData[index].buttonText);
});
},child: Column(
crossAxisAlignment: CrossAxisAlignment.start,children: <Widget>[
TextSmallTitleSize(
title: sampleData[index].title,Padding(
padding: const EdgeInsets.only(bottom: 20.0),child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,children: <Widget>[
Flexible(
child: TextSmallDimText(sampleData[index].label),RadioItem(sampleData[index]),)
],));
},);
}
}
class RadioItem extends StatelessWidget {
final RadioModel _item;
RadioItem(this._item);
@override
Widget build(BuildContext context) {
return new Container(
margin: new EdgeInsets.all(15.0),child: new Row(
mainAxisSize: MainAxisSize.max,children: <Widget>[
new Container(
height: 25.0,width: 25.0,alignment: Alignment.center,child: Container(
height: 15.0,width: 15.0,decoration: new Boxdecoration(
color: AppColors.primarycolor,borderRadius:
const BorderRadius.all(const Radius.circular(15)),)),decoration: new Boxdecoration(
color: Colors.transparent,border: new Border.all(
width: 3.0,color: _item.isSelected
? AppColors.primarycolor
: Colors.transparent),borderRadius: const BorderRadius.all(const Radius.circular(25)),new Container(margin: new EdgeInsets.only(left: 10.0))
],);
}
}
class RadioModel {
bool isSelected;
final String buttonText;
final int colorCode;
final String title,label;
final int buttonid;
RadioModel(this.isSelected,this.buttonText,this.colorCode,this.title,this.label,this.buttonid);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)