小编Abd*_*nas的帖子

Flutter 生成的 3 个 APK 有什么区别?

我需要了解 Android 设备架构,以及为什么在我使用时会生成三种不同类型的 APK:

flutter build apk --split-per-abi.

当我使用

flutter build apk

我得到一个名为 fat APK 的大 APK 文件,其中包含该应用程序的 3 个版本。

android apk flutter android-architecture-components

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

如何在flutter项目中添加相机权限?

我想通过点击按钮打开相机,但无法在iOS包中添加相机图库权限。

我有这些钥匙:

NSPhotoLibraryUsageDescription
NSCameraUsageDescription
NSMicrophoneUsageDescription
Run Code Online (Sandbox Code Playgroud)

我不知道应该把这些线放在哪里。

ios ios-camera flutter ios-permissions

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

Android 中 Flutter 的“getApplicationContext()”替代方案是什么

我想创建一个通用的公共方法,如果有任何响应,则将应用程序导航到登录屏幕:unauthenticated

问题是我没有context在我的Navigator.

Android中我曾经使用:getApplicationContext(),我如何在Flutter中做到这一点?

android flutter flutter-navigation

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

如何在 Flutter 的原生 iOS 代码中使用 print 方法?

我正在尝试在 Flutter 项目的本机 iOS 代码中使用 print 方法。

这就是我尝试的方法:

print("")
debugPrint("")
OSLog("")
Run Code Online (Sandbox Code Playgroud)

但控制台上没有打印任何内容!

我怎样才能做到这一点?

console ios dart console.log flutter

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

如何在 Flutter 中使用 Dio 处理超时错误?

我正在使用 Dio 来处理 API 功能。

这是我的代码:

  Future<List<ItemModel>> getItems() async {
    try {
      Response response = await dio.get("$_apiUrl$_itemEndPoint",
          options: Options(headers: {
            "Accept": 'application/json',
          }));

      List<ItemModel> _items = List<ItemModel>();

      response.data['data']?.forEach((c) {
        _items.add(ItemModel.fromMap(c));
      });
      return _items;
    } catch (e) {
      throw (e);
    }
  }
Run Code Online (Sandbox Code Playgroud)

如何根据发送和接收超时捕获错误?

dart flutter dio

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

我可以将 Button 放在 ScrollView 中 ConstraintLayout 的底部吗?

我有一个ScrollView包含一个ConstraintLayout. 在 中ConstraintLayout,我放置了许多带有属性layout_constraintTop_toBottomOf的视图,以在视图和视图顶部之间建立关系,并且我曾经layout_marginTop在视图之间放置空格。

在我的设计中,我有一个 Button 应该在布局的底部,它不会发生在 ,layout_marginTop因为它应该与ConstraintLayout.

这是我的代码:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="10dp"
        android:paddingBottom="10dp">

        <TextView
            android:id="@+id/logo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_margin="120dp"
            android:text="Logo"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <EditText
            android:id="@+id/un_et"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginLeft="28dp"
            android:layout_marginTop="25dp"
            android:layout_marginRight="28dp"
            android:gravity="center"
            android:hint="User name"
            android:textColor="#bebebe"
            android:textCursorDrawable="@null"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@id/logo" />


        <EditText
            android:id="@+id/pw_et"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginLeft="28dp"
            android:layout_marginTop="13dp"
            android:layout_marginRight="28dp"
            android:gravity="center"
            android:hint="Password"
            android:inputType="textPassword"
            android:textColor="#bebebe"
            android:textCursorDrawable="@null"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@id/un_et" />

        <RelativeLayout
            android:id="@+id/save_pw"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp" …
Run Code Online (Sandbox Code Playgroud)

android scrollview android-constraintlayout

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

如何在 Flutter 中更改提示大小?

我有一个hintTextin a TextField,我可以改变它的颜色但不能改变它的大小。

我怎样才能改变它?

这是文档中的代码示例:

  decoration: InputDecoration(
    border: InputBorder.none,
    hintText: 'Enter a search term'
  ),
);
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

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