问题描述
如何在不建议使用的注释中的ReplaceWith中添加其他变量?
鉴于以下示例代码,我想弃用class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final double heightOfFirstContainer = 100.0;
@override
Widget build(BuildContext context) {
return SafeArea(
child: Stack(
children: [
Scaffold(
backgroundColor: Colors.green,body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,crossAxisAlignment: CrossAxisAlignment.center,children: [
SizedBox(
height: heightOfFirstContainer,),new Container(
height: 200.0,width: double.infinity,child: Container(
margin: EdgeInsets.only(top: 40.0),child: Text(
"Welcome To \n Flutter",textAlign: TextAlign.center,style: TextStyle(color: Colors.white),decoration: Boxdecoration(
borderRadius: new BorderRadius.only(
bottomLeft: new Radius.circular(50.0),bottomright: new Radius.circular(50.0),color: Colors.orange),new Container(
margin: EdgeInsets.only(left: 10.0,right: 10.0),transform: Matrix4.translationValues(0.0,-40.0,0.0),child: new Card(
clipBehavior: Clip.antiAlias,color: Colors.orange[300],child: Row(
children: [
new Container(
margin: EdgeInsets.all(5.0),child: CircleAvatar(
backgroundColor: Colors.white,radius: 25.0,child: Text("A"),new Container(
child: Column(
children: [
new Text(
"Hello Every One This is Flutter Tutorial",new Container(
child: Row(
children: [
new FlatButton(
onpressed: () {},textColor: Colors.white,child: Text("Button 1")),new FlatButton(
onpressed: () {},],)),elevation: 2.0,new Card(
clipBehavior: Clip.antiAlias,color: Colors.grey[200],child: Container(
height: 200.0,child: Text("Card 1"),new SizedBox(
height: 40,child: Text("Card 2"),child: Text("Card 3"),// ),Positioned(
child: new Container(
height: heightOfFirstContainer,child: Row(
mainAxisAlignment: MainAxisAlignment.center,children: [
new Text("Top Fix",style: TextStyle(fontSize: 20.0)),new SizedBox(
width: 30.0,new CircleAvatar(
backgroundColor: Colors.white,color: Colors.orange,);
}
}
。
我应该看到
sectionBlock.getContent()
代替
val map = sectionBlock.getContentsMap() // expected results (this should be generated also once)
map.getContent() // expected results
当前示例
sectionBlock.getContentsMap().getContent() // result
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)