小编Sha*_*min的帖子

在 flutter 中围绕字母创建圆圈

我试图在字母周围创建一个圆圈,这是我的代码,但它并没有创建一个完美的圆圈

         Container(
            padding: EdgeInsets.all(8),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(50),
                border: Border.all(color: Colors.white, width: 2)),
            child: InkWell(
              child: Text(
                "A",
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    color: Colors.white,
                    fontSize: 15),
              ),
            ),
          ),
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我还尝试过容器高度和宽度,然后隐藏了字母的某些部分。

         Container(
            padding: EdgeInsets.all(8),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(50),
                border: Border.all(color: Colors.white, width: 2)),
            child: InkWell(
              child: Text(
                "A",
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    color: Colors.white,
                    fontSize: 15),
              ),
            ),
          ),
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

但如果我使用图标小部件而不是文本小部件,它就会创建完美的圆形,

          Container(
            height: 30,
            width: 30,
            padding: EdgeInsets.all(8),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(50), …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

6
推荐指数
2
解决办法
7993
查看次数

使用 Sharp 调整图像大小时,出现错误 Sharp.resize(...).max 不是函数

我正在尝试使用 调整图像大小sharp,版本是"sharp": "^0.23.0"。我使用了来自 的示例代码functions-samples。我的代码在这里

thumbnailGeneratorSharp: async (object) => {
    const fileBucket = object.bucket; // The Storage bucket that contains the file.
    const filePath = object.name; // File path in the bucket.
    const contentType = object.contentType; // File content type.

    // Exit if this is triggered on a file that is not an image.
    if (!contentType.startsWith('image/')) {
      console.log('This is not an image.');
      return null;
    }

    // Get the file name.
    const fileName = path.basename(filePath);
    // …
Run Code Online (Sandbox Code Playgroud)

node.js google-cloud-functions sharp

4
推荐指数
1
解决办法
4231
查看次数

java.sql.SQLException:调用中的参数无效:getBytes()

我试图使用以下代码将 blob 转换为字符串:

ResultSet rs = stmt.executeQuery(query);

Blob newValueBLOB = rs.getBlob("NEW_VALUE");
System.out.println(newValueBLOB);
String newValue = new String(newValueBLOB.getBytes(0, (int) newValueBLOB.length()));
Run Code Online (Sandbox Code Playgroud)

我的数据库是 Oracle 并且连接已正确建立。我找到了类似的答案,但我的不起作用!

java sql oracle odbc jdbc

3
推荐指数
1
解决办法
553
查看次数

尝试在 Ubuntu 中安装 opencv4nodejs 时权限被拒绝

我尝试使用以下命令进行安装,我的节点版本opencv4nodejsUbuntu-20.04v12.19.0

\n
sudo npm i -g opencv4nodejs\n
Run Code Online (Sandbox Code Playgroud)\n

但出现这些错误

\n
info install installing opencv version 3.4.6 into directory: /usr/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv\nERR! Error: Command failed: mkdir -p opencv\nmkdir: cannot create directory \xe2\x80\x98opencv\xe2\x80\x99: Permission denied\n \nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! opencv-build@0.1.9 install: `node ./install.js`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the opencv-build@0.1.9 install script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log …
Run Code Online (Sandbox Code Playgroud)

opencv node.js npm appium appium-android

2
推荐指数
1
解决办法
3023
查看次数

testDeviceId 在 google-mobile-ads flutter 中不起作用

我试图使用 requestConfiguration 设置我的测试设备 ID。为了检查测试设备的设置是否成功,我logcat在 android studio 中进行了过滤setTestDeviceIds,但它向我显示了以下日志

\n
2021-03-31 04:17:36.907 27185-27185/? I/Ads: Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("xxxxxxxxxxxxxxxxxxx")) to get test ads on this device.\n
Run Code Online (Sandbox Code Playgroud)\n

因此,测试设备的设置不起作用,我无法使用真实的广告进行测试。当我传递 testDeviceId 时,该日志应该不会出现。您可以看到我正在testDeviceId为 inRequestConfiguration和传递 \'s bannerAd

\n

重现步骤

\n

这是我的main.dart文件

\n
2021-03-31 04:17:36.907 27185-27185/? I/Ads: Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("xxxxxxxxxxxxxxxxxxx")) to get test ads on this device.\n
Run Code Online (Sandbox Code Playgroud)\n

这是我的adhelper.dart文件

\n
import \'package:flutter/material.dart\';\nimport \'package:google_mobile_ads/google_mobile_ads.dart\';\nimport \'package:provider/provider.dart\';\nimport \'package:us/global/theme/app_themes.dart\';\nimport \'package:us/utils/ad_helper.dart\';\n\nvoid main() {\n  WidgetsFlutterBinding.ensureInitialized();\n\n  MobileAds.instance.initialize().then((InitializationStatus status) {\n    print(\'Initialization done: ${status.adapterStatuses}\');\n    MobileAds.instance\n        .updateRequestConfiguration(RequestConfiguration(\n        testDeviceIds: …
Run Code Online (Sandbox Code Playgroud)

admob flutter google-mobile-ads

2
推荐指数
1
解决办法
2873
查看次数

尽管声明了 admin,但显示“意外的令牌管理员”错误

我正在尝试执行一些顺序异步操作。但得到错误:

解析错误:意外的令牌管理员

虽然我已经声明了这个变量。这是我的代码

const admin = require('firebase-admin')
module.exports = {
   notificationCount: async (change, context) => {
    countRef.collection("notification").doc(context.params.reqID).get().then((requestDoc) => {
      console.log("Request Info " + requestDoc.data().reqUserName)
      return requestDoc.data();
    }).then((requestDocData) => {

      const token = await admin.database().ref("/UserInfo/" + notifiedUserID + "/token").once('value');
      console.log("UserInfo "+token);
      return null;

    }).catch((error) => {
      console.log("Loading failed: ", error);
    });
  }
}
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-functions

1
推荐指数
1
解决办法
786
查看次数