我想使用墨水瓶小部件向容器添加悬停颜色属性,但容器有自己的边框半径,当我使用墨水瓶使用悬停属性时,它采用自定义形状并使其在悬停后看起来为矩形墨水瓶。
这是我的代码片段:
InkWell(
onTap: () {},
hoverColor: Colors.red[200],
child: Container(
width: 70.w,
height: 60.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
Image.asset(
'images/call.png',
height: 30.h,
),
Text(
'Call',
style: white,
),
],
),
),
),
Run Code Online (Sandbox Code Playgroud)
我希望我让你很好地理解了这个问题
请帮助我解决问题或提供替代方法。
问题: 我尝试拦截 SMS 消息正文,然后每次遇到 SMS 时使用 POST 调用 REST API 将消息正文发送到数据库。整个拦截和发送消息正文也应该在后台工作,而且也是自动进行的。
到目前为止我所取得的成就: 我使用电话插件来拦截消息正文,并且每次在 UI 级别收到消息正文时都能够打印消息正文,但无法调用 API 并发送 SMS 正文。
错误: 由于我没有找到如何在每次截获新消息时自动调用 API 的方法,因此我使用按钮来调用它,但即使这样也不起作用,它会抛出错误:
[error:flutter/lib/ui/ui_dart_state.cc(209)] unhandled exception: invalid argument(s) (onerror): the error handler of future.catcherror must return a value of the future's type
Run Code Online (Sandbox Code Playgroud)
另外,我没有管理如何在后台拦截短信正文。
为了更好地理解这个错误,我将附上一些代码片段:
API使用函数:
String body = "";
DateTime currentPhoneDate = DateTime.now();
final telephony = Telephony.instance;
interceptMessage() {
final messaging = ApiService();
messaging.interceptedMessage({
"id": 50,
"body": "$body",
"senderName": "IDK",
"timeStamp": "2021-10-02 12:00:55"
})
..then((value) {
if (value.status == "Success") …Run Code Online (Sandbox Code Playgroud)