每当我试图获取它返回错误TypeError:无法获取其他解决方案不适合我.这是我的代码
fetch(url)
.then((resp) => resp.json())
.then((data) => {
this.JSONData = data;
})
.then(() => {
this.search()
})
.catch(error => {
alert(error);
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 PreferredSize 创建自定义 TabBar,但我无法将 TabBar 的颜色与我的身体融合,TabBar 和身体之间似乎有一个边界。下面的图片将清楚地向您展示我想要完成的工作。
我试图用大宽度创建一个与主体颜色相同的边框,但它似乎不起作用。这是我的代码:
Widget _buildAppBar(context) {
return AppBar(
title: Text(title),
elevation: 0,
flexibleSpace: Image.asset(
'images/motif_batik_01.jpg',
fit: BoxFit.cover,
width: 1200,
),
bottom: _buildTabBar(context)
);
Run Code Online (Sandbox Code Playgroud)
}
Widget _buildTabBar(context) {
return PreferredSize(
preferredSize: Size.fromHeight(100.0),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50),
topRight: Radius.circular(50),
),
),
padding: EdgeInsets.only(
top: 50,
left: 20,
right: 20,
),
height: 100,
child: TabBar(
indicator: BoxDecoration(
color: Colors.orange, borderRadius: BorderRadius.circular(20)
),
labelStyle: TextStyle(color: Colors.white),
unselectedLabelColor: Colors.orange,
tabs: <Widget>[
Tab(child: Text('A', style: …Run Code Online (Sandbox Code Playgroud)