小编tja*_*and的帖子

Mockito doReturn:对重载定义的不明确引用

我正在尝试将Scala系统移植到Mockito2。有一些测试用例doReturn,现在在Mockito中出现2.18.0此错误:

Error:(34, 5) ambiguous reference to overloaded definition,
both method doReturn in object Mockito of type (x$1: Any, x$2: Object*)org.mockito.stubbing.Stubber
and  method doReturn in object Mockito of type (x$1: Any)org.mockito.stubbing.Stubber
match argument types (com.twitter.util.Future[Unit])
doReturn(Future.Unit).when(f.adapterSpy).myFunction(userData, Some(offerId), Always)
Run Code Online (Sandbox Code Playgroud)

进入Mockito.javadoReturn确实像这样超载:

public static Stubber doReturn(Object toBeReturned) 
public static Stubber doReturn(Object toBeReturned, Object... toBeReturnedNext)
Run Code Online (Sandbox Code Playgroud)

这在地球上怎么不总是模棱两可?如何进行编译?

谢谢

java scala mockito

6
推荐指数
3
解决办法
1653
查看次数

ConstraintLayout屏障在设计视图中不可见

我正在尝试ConstraintLayout在Android Studio中添加一个障碍,但并没有在设计视图中显示出应有的方式。

我一直在关注本教程,但是无法正常工作。

我目前正在使用:

  • Android Studio 3.1.1
  • androidx.constraintlayout:constraintlayout:1.1.3

我尝试过的事情:

  • 使缓存无效/重启
  • 删除属性 tools:layout_editor_absoluteX
  • 摆弄!

这是我的test.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                   xmlns:app="http://schemas.android.com/apk/res-auto"
                                                   xmlns:tools="http://schemas.android.com/tools"
                                                   android:layout_width="match_parent"
                                                   android:layout_height="match_parent">

    <Button
            android:text="Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button" android:layout_marginTop="8dp"
            app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
            android:layout_marginStart="8dp"/>
    <Button
            android:text="Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button2" android:layout_marginTop="8dp"
            app:layout_constraintTop_toBottomOf="@+id/button" app:layout_constraintStart_toStartOf="parent"
            android:layout_marginStart="8dp"/>
    <androidx.constraintlayout.widget.Barrier android:layout_width="wrap_content" android:layout_height="wrap_content"
                                              android:id="@+id/barrier2" app:barrierDirection="end"
                                              app:constraint_referenced_ids="button,button2"
                                              tools:layout_editor_absoluteX="411dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

在设计视图中,它看起来像这样

障碍固定在布局的边缘,无论我做什么都不会移动。如果设置barrierDirection startleft根本不可见。如果我设置了,end或者right虚线出现了,但被卡在了布局的左侧。

在另一个从头开始的项目中,屏障似乎工作正常,但这使用的android.support.constraint.ConstraintLayoutandroidx库而不是库的。

android android-studio android-constraintlayout androidx

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

如何在 Flutter 中设置 AppBar 操作按钮颜色

我正在尝试AppBar使用主题设置我的动作图标的颜色,但由于某种原因它不起作用。这是我的最小代码示例:

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
        iconTheme: IconThemeData(color: Colors.purple),
        primaryIconTheme: IconThemeData(color: Colors.red),
        accentIconTheme: IconThemeData(color: Colors.amber)
      ),
    home: Scaffold(
      appBar: AppBar(
        iconTheme: IconThemeData(color: Colors.green),
        actionsIconTheme: IconThemeData(color: Colors.yellow),
        actions: [
          IconButton(icon: Icon(Icons.add))
        ]
      )
    ));
  }
}
Run Code Online (Sandbox Code Playgroud)
  • 没有iconTheme任何颜色值有任何影响。
  • 在 中设置不透明度MaterialApp.iconThemeAppBar.iconTheme或者AppBar.actionsIconTheme确实生效
  • 显式设置Icon.color确实有效,但我认为我不应该这样做,对吗?

我如何获得IconButton尊重我的主题?

谢谢托马斯

编辑:通过Icon直接使用 a而不是 aIconButton我实际上能够让图标尊重我的主题,但我如何使其可点击?据https://api.flutter.dev/flutter/material/AppBar/actions.html …

flutter

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

flutter iOS 项目中的 pod install 给出了 base64: invalid input

经过一段时间的停机后,我尝试为 iOS 构建 Flutter 应用程序,但没有成功。pod intall给我以下输出(即使在清理 XCode 工作区之后):

\n
$ pod install\nAnalyzing dependencies\ncloud_firestore: Using Firebase SDK version '8.15.0' defined in 'firebase_core'\nfirebase_analytics: Using Firebase SDK version '8.15.0' defined in 'firebase_core'\nfirebase_auth: Using Firebase SDK version '8.15.0' defined in 'firebase_core'\nfirebase_core: Using Firebase SDK version '8.15.0' defined in 'firebase_core'\nWarning: firebase_app_id_file.json file does not exist. This may cause issues in upload-symbols. If this error is unexpected, try running flutterfire configure again.\nfirebase_crashlytics: Using Firebase SDK version '8.15.0' defined in 'firebase_core'\nfirebase_dynamic_links: Using Firebase SDK version …
Run Code Online (Sandbox Code Playgroud)

ios cocoapods boringssl flutter

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