gpt4 book ai didi

android - 错误 : The method `CircularNotchedRectangle` is not defined

转载 作者:行者123 更新时间:2023-11-28 23:51:30 24 4
gpt4 key购买 nike

我正在尝试使用 BottomAppBar 创建一个小部件。它正在使用 CircularNotchedRectangle 但它给了我这个错误:

The method CircularNotchedRectangle is not defined

有谁知道是什么原因吗?

import 'package:flutter/material.dart';
import 'package:roomie/screens/widgets/common_drawer.dart';

class CommonScaffold extends StatelessWidget {
final appTitle;
final Widget bodyData;
final showFAB;
final showDrawer;
final backGroundColor;
final actionFirstIcon;
final scaffoldKey;
final showBottomNav;
final floatingIcon;
final centerDocked;
final elevation;

CommonScaffold(
{this.appTitle,
this.bodyData,
this.showFAB = false,
this.showDrawer = false,
this.backGroundColor,
this.actionFirstIcon = Icons.search,
this.scaffoldKey,
this.showBottomNav = false,
this.centerDocked = false,
this.floatingIcon,
this.elevation = 4.0});

Widget myBottomBar() => new BottomAppBar(
shape: CircularNotchedRectangle(),
child: Ink(
height: 50.0,
decoration: new BoxDecoration(
gradient: new LinearGradient(colors: UIData.kitGradients)),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
height: double.infinity,
child: new InkWell(
radius: 10.0,
splashColor: Colors.yellow,
onTap: () {},
child: Center(
child: new Text(
"ADD TO WISHLIST",
style: new TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),
),
new SizedBox(
width: 20.0,
),
SizedBox(
height: double.infinity,
child: new InkWell(
onTap: () {},
radius: 10.0,
splashColor: Colors.yellow,
child: Center(
child: new Text(
"ORDER PAGE",
style: new TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),
),
],
),
),
);

@override
Widget build(BuildContext context) {
return Scaffold(
key: scaffoldKey != null ? scaffoldKey : null,
backgroundColor: backGroundColor != null ? backGroundColor : null,
appBar: AppBar(
elevation: elevation,
backgroundColor: Colors.black,
title: Text(appTitle),
actions: <Widget>[
SizedBox(
width: 5.0,
),
IconButton(
onPressed: () {},
icon: Icon(actionFirstIcon),
),
IconButton(
onPressed: () {},
icon: Icon(Icons.more_vert),
)
],
),
drawer: showDrawer ? CommonDrawer() : null,
body: bodyData,
floatingActionButton: showFAB
? CustomFloat(
builder: centerDocked
? Text(
"5",
style: TextStyle(color: Colors.white, fontSize: 10.0),
)
: null,
icon: floatingIcon,
qrCallback: () {},
)
: null,
floatingActionButtonLocation: centerDocked
? FloatingActionButtonLocation.centerDocked
: FloatingActionButtonLocation.endFloat,
bottomNavigationBar: showBottomNav ? myBottomBar() : null,
);
}
}

最佳答案

由于没有人回答,我认为这可能是原因。已经有一些breaking changes最近使用了 API,因此如果您的版本不是最新的,您将需要使用以前的 BottomAppBar API:

BottomAppBar(shape: CircularNotchedRectangle()) 以前是 BottomAppBar(hasNotch: true)

Source

关于android - 错误 : The method `CircularNotchedRectangle` is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51972589/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com