如何将对象名称从汽车重命名为汽车? 我尝试使用ObjectRenameKeys,但它适用于对象内的属性,而不适用于对象名本身。
原文:
"Cars": [
{
"Part": 1
},
{
"Part": 2
},
{
"Part": 3
}
],
Expected:
"Automobiles": [
{
"Part": 1
},
{
"Part": 2
},
{
"Part": 3
}
],
答案 0 :(得分:2)
您无法真正重命名属性...。只需复制汽车,然后将其删除:
import 'package:flutter/material.dart';
class StoreFront extends StatefulWidget {
@override
_StoreFrontState createState() => _StoreFrontState();
}
class _StoreFrontState extends State<StoreFront> {
@override
Widget build(BuildContext context) {
return Container(
height: 150,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
Container(
margin: EdgeInsets.only(bottom: 10.0),
height: 80.0,
child: Stack(
children: <Widget>[
Container(
height: 800,
width: 370,
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(250.0))),
child: Image(
image: AssetImage("assets/images/newlookfront.png"),
fit: BoxFit.fill,
),
),
Positioned(
bottom: 60,
left: 65.0,
child: Row(
children: <Widget>[
Text("NEW LOOK", style: TextStyle(color: Colors.white70, fontSize: 35.0),)
],
),
),
],
),
),
Container(
child: Row(
children: <Widget>[
Text("New Look")
],
),
),
],
),
);
}
}