小编Blo*_*oss的帖子

如何更改颤振中的文本选择选项?

我尝试添加文本编辑格式选项,就像在 Gmail 应用程序中一样。但是当突出显示文本时,没有格式选项。是否可以处理选择警报?(复制/剪切/粘贴)。或者有没有办法像gmail一样添加格式栏?

       TextField(
          controller: _categoryController,
          decoration: InputDecoration(
            border: InputBorder.none,
            hintText: "Enter Category Name",
          ),
        ),
Run Code Online (Sandbox Code Playgroud)

我添加了屏幕截图和 gif 文件以更好地理解我的问题。

在我的 Flutter 应用程序上选择选项

在我的 Flutter 应用程序上选择选项

在 Gmail 应用程序上选择选项

在此输入图像描述

dart flutter flutter-layout

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

虽然“flutter devices”命令显示,但在 Flutter Android Studio 中未检测到 iPhone

$ flutter devices显示以下结果。

\n\n
$ flutter devices\n1 connected device:\n\nmy_iPhone \xe2\x80\xa2 <UDID> \xe2\x80\xa2 ios \xe2\x80\xa2 iOS 12.3.1\n
Run Code Online (Sandbox Code Playgroud)\n\n

但是,Android Studio 未检测到此 iphone。\nAndroid Studio GUI 显示 。\n我可以知道如何修复它吗???

\n\n

$ flutter doctor显示没有问题。

\n

android-studio flutter

5
推荐指数
4
解决办法
2万
查看次数

颤振 - 剪辑路径

如何创建上面的自定义clipPath小部件?(我附上了截图)

我试过了,但它不是确切的输出

快船类

class MessageClipper extends CustomClipper<Path> {
  final double borderRadius = 15;
  @override
  Path getClip(Size size) {
    double width = size.width;
    double height = size.height;
    double rheight = height - height / 3;
    double oneThird = width / 3;

    final path = Path()
      ..lineTo(0, rheight - borderRadius)
      ..cubicTo(0, rheight - borderRadius, 0, rheight, borderRadius, rheight)
      ..lineTo(oneThird, rheight)
      ..lineTo(width/2-borderRadius, height-borderRadius)
      ..cubicTo(width / 2 - borderRadius, height - borderRadius, width / 2,
          height, width / 2 + borderRadius, height - borderRadius …
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

有什么方法可以在不使用 dart 循环的情况下在两个列表之间找到唯一值

有没有办法在不使用循环的情况下在两个列表之间找到唯一值?

List<String> first = ['A','B','C','D']; 
List<String> second = ['B','D']; 
Run Code Online (Sandbox Code Playgroud)

我需要的结果是这样的:

result = ['A','C'];
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

Flutter 可以使用 Jenkins 吗?

是否可以使用 Jenkins 和 Flutter 创建构建发布到 Play 商店的管道?我需要为生产/开发构建一个版本来播放商店。

android ios jenkins flutter jenkins-pipeline

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

OPENCV_ENABLE_NONFREE CMake 选项并在函数“create”中重建库

我真的开始使用python了。我从互联网下载项目。但是当我尝试运行时,出现了这些错误。我认为该项目不支持我的安装模块。如何解决这个问题?

错误

回溯(最近一次调用):文件“compare.py”,第 20 行,在 sift = cv2.xfeatures2d.SIFT_create() cv2.error: OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python /opencv_contrib/modules/xfeatures2d/src/sift.cpp:1210: error: (-213:The function/feature is not implementation) 这个算法是专利的,被排除在这个配置中;设置 OPENCV_ENABLE_NONFREE CMake 选项并在函数“create”中重建库

完整代码

import cv2
import numpy as np

original = cv2.imread("images/original_golden_bridge.jpg")
image_to_compare = cv2.imread("images/george-washington-bridge.jpg")

# 1) Check if 2 images are equals
if original.shape == image_to_compare.shape:
    print("The images have same size and channels")
    difference = cv2.subtract(original, image_to_compare)
    b, g, r = cv2.split(difference)

    if cv2.countNonZero(b) == 0 and cv2.countNonZero(g) == 0 and cv2.countNonZero(r) == 0:
        print("The images are completely Equal") …
Run Code Online (Sandbox Code Playgroud)

python opencv python-2.7 python-3.x

5
推荐指数
0
解决办法
6818
查看次数

有没有办法在 Flutter 上为 firestore 数据库生成模型类?

我目前正在手动执行此过程。这是一个示例数据类。有没有办法自动生成?

class RideModel {
  final String docId;
  final bool hasRequest;
  final String rideCollectionId;
  final String vehicleTypeId;
  final double corporationRate;
  final double driverRate;
  final double driverInsurance;
  final double passengerInsurance;
  final List startUpCharge;
  final double waitingCharge;
  final double normalCharge;

  RideModel({this.docId, this.hasRequest, this.rideCollectionId,this.vehicleTypeId, this.corporationRate, this.driverRate, this.driverInsurance, this.passengerInsurance, this.startUpCharge, this.waitingCharge, this.normalCharge});

  factory RideModel.fromFirestore(DocumentSnapshot doc) {
    var data = doc.data;

    return RideModel(
        docId: data['docId'],
        hasRequest: data['hasRequest'],
        rideCollectionId: data['rideCollectionId'],
        vehicleTypeId: data['tripDetails']['vehicleType']['vehicleTypeId'],
        corporationRate: data['tripDetails']['vehicleType']['corporation'].toDouble()??0.0,
        driverRate: data['tripDetails']['vehicleType']['driver'].toDouble()??0.0,
        driverInsurance: data['tripDetails']['vehicleType']['driverInsurance'].toDouble()??0.0,
        passengerInsurance: data['tripDetails']['vehicleType']['passengerInsurance'].toDouble()??0.0,
        normalCharge: data['tripDetails']['vehicleType']['normalCharge'].toDouble()??0.0,
        startUpCharge: data['tripDetails']['vehicleType']['startUpCharge']??[],
        waitingCharge: data['tripDetails']['vehicleType']['waitingCharge'].toDouble()??0.0);
  } …
Run Code Online (Sandbox Code Playgroud)

dart firebase flutter google-cloud-firestore

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

如何在 Flutter 中添加多个相同类型的 ChangeNotifierProvider

是否可以添加相同类型的多个 ChangeNotifierProvider?

return MultiProvider(
  providers: [
      ChangeNotifierProvider<ValueNotifier<double>>(
        create: (_) => ValueNotifier<double>(0.0),
      ),
      ChangeNotifierProvider<ValueNotifier<double>>(
        create: (_) => ValueNotifier<double>(0.0),
      ),
  ],
Run Code Online (Sandbox Code Playgroud)

在我的构建方法中

 @override
  Widget build(BuildContext context) {
    ValueNotifier<double> firstNotifier = Provider.of(context, listen: true);
    ValueNotifier<double> secondNotifier = Provider.of(context, listen: true);

  print('First value ${firstNotifier.value} Second value ${secondNotifier.value}');

 ...
 onTap:(){
   firstNotifier.value = 10.0;
   secondNotifier.value = 30.0;
 }
Run Code Online (Sandbox Code Playgroud)

两个打印值相同 第一个值为 10 第二个值为 10

dart flutter flutter-provider

5
推荐指数
2
解决办法
9174
查看次数

在 Flutter 中禁用 firestore 上的缓存

如何禁用从 firestore 上的缓存获取/流数据?

我看到了这篇文章。该功能默认启用PersistenceEnabled

这样是不是就可以清除缓存了?

void main() async {
  await Firebase.initializeApp();
  await FirebaseFirestore.instance.clearPersistence();
Run Code Online (Sandbox Code Playgroud)

或者

是否需要添加到每个查询中?

  Future<List<BookModel>> _getBooks() async {
    await FirebaseFirestore.instance.clearPersistence();
    return _db.collection('books')...  
    }
Run Code Online (Sandbox Code Playgroud)

或者

如何始终禁用 firestore 上的缓存?

这是对的吗?

void main() async {
  await Firebase.initializeApp();
  FirebaseFirestore.instance.settings = 
Settings(
persistenceEnabled: false,
cacheSizeBytes: ?,//is it need add this fields too?
host: ?,
sslEnabled: ?
Run Code Online (Sandbox Code Playgroud)

);

dart firebase flutter google-cloud-firestore

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

是否可以删除 currentUser firebase 身份验证用户?

我使用firebase_authpackage 来处理 flutter。我使用电话身份验证进行登录。一切正常。但是当注销用户不会在 firebase 上删除时。

是否可以删除firebase用户?

 RaisedButton(
    onPressed: () async {
         await FirebaseAuth.instance.signOut();
    }
 )
Run Code Online (Sandbox Code Playgroud)

我尝试了这种方法,但错误来了..

删除名为 null

    _auth.onAuthStateChanged.listen((currentUser)=>{
             currentUser.delete()
}).onError((e)=>print("Error is $e"));
Run Code Online (Sandbox Code Playgroud)

dart firebase firebase-authentication flutter

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