我正在尝试将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.java,doReturn确实像这样超载:
public static Stubber doReturn(Object toBeReturned)
public static Stubber doReturn(Object toBeReturned, Object... toBeReturnedNext)
Run Code Online (Sandbox Code Playgroud)
这在地球上怎么不总是模棱两可?如何进行编译?
谢谢
我正在尝试ConstraintLayout在Android Studio中添加一个障碍,但并没有在设计视图中显示出应有的方式。
我一直在关注本教程,但是无法正常工作。
我目前正在使用:
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 start或left根本不可见。如果我设置了,end或者right虚线出现了,但被卡在了布局的左侧。
在另一个从头开始的项目中,屏障似乎工作正常,但这使用的android.support.constraint.ConstraintLayout是androidx库而不是库的。
我正在尝试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.iconTheme,AppBar.iconTheme或者AppBar.actionsIconTheme确实生效Icon.color确实有效,但我认为我不应该这样做,对吗?我如何获得IconButton尊重我的主题?
谢谢托马斯
编辑:通过Icon直接使用 a而不是 aIconButton我实际上能够让图标尊重我的主题,但我如何使其可点击?据https://api.flutter.dev/flutter/material/AppBar/actions.html …
经过一段时间的停机后,我尝试为 iOS 构建 Flutter 应用程序,但没有成功。pod intall给我以下输出(即使在清理 XCode 工作区之后):
$ 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)