這是我的郵遞員回復,在這個回復中,我有一個“areaOfMentoring”鍵在指導鍵區域我有兩個資料,我想顯示這兩個資料。

但是當獲取 areaOfMentoring 的資料時,它的顯示如下

areaOfMentoring 的資料是 Diabetes and Heart Health 它在 abhijeet vijayvargiya 之后顯示 還有括號,所以如何只顯示 areaOfMentoring 的資料而不顯示括號
這是我這張卡的密碼
Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: (index % 2) == 0
? Color(0xFFC691D3).withOpacity(0.2)
: Color(0xFFF6931E).withOpacity(0.2),
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.0),
bottomRight: Radius.circular(10.0),
topLeft: Radius.circular(10.0),
bottomLeft: Radius.circular(10.0)),
),
height: 290,
width: 160,
child: Column(
children: [
Image.asset(
'assets/herogirl.png',
height: 154,
width: 142,
),
Padding(
padding: const EdgeInsets.fromLTRB(10, 5, 10, 5),
child: Text(
'${healthHeroesListData[index]['name']}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
fontSize: 14,
color: Color(0xff444444),
fontWeight: FontWeight.bold,
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
child: Text(
'${healthHeroesListData[index]['areaOfMentoring']}',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
maxLines: 2,
style: GoogleFonts.poppins(
fontSize: 12,
color: (index % 2) == 0
? Color(0xffC691D3)
: Color(0xffF6931E),
),
),
),
ElevatedButton(
style: ButtonStyle(
backgroundColor: (index % 2) == 0
? MaterialStateProperty.all(Color(0xFFC691D3))
: MaterialStateProperty.all(Color(0xFFF6931E)),
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
// side: BorderSide(color: Colors.teal, width: 0.0),
),
),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ApplySession(healthHeroesListData:healthHeroesListData[index])));
},
child: Text('View Details'))
],
),
);
uj5u.com熱心網友回復:
您讓 dart 將該toString方法應用于陣列,從而將其顯示為原始 JSON 字串。
您只需要以某種方式迭代您的條目或加入它們:
'${healthHeroesListData[index]['areaOfMentoring'].join(', ')}'
uj5u.com熱心網友回復:
你有很多方法,最簡單的是:
healthHeroesListData[index]['areaOfMentoring'].join(', ') // with comas
healthHeroesListData[index]['areaOfMentoring'].join(' ') // no comas
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/414222.html
標籤:
