小编Nit*_*esh的帖子

Flutter canvas:如何避免在图像区域之外绘制

import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'dart:ui' as ui;

class EditImage extends StatefulWidget {
  final String filePath;
  EditImage({this.filePath});

  @override
  _EditImageState createState() => _EditImageState();
}

class _EditImageState extends State<EditImage> {
  ui.Image decodedImage;
  String newFilePath;
  GlobalKey myCanvasKey = GlobalKey();
  ImageEditor editor;
  Color color = Colors.blue;

  @override
  void initState() {
    loadImage(File(widget.filePath));
    super.initState();
  }

  void loadImage(File image) async {
    final data = await image.readAsBytes();
    decodedImage = await decodeImageFromList(data);
    editor = ImageEditor(image: decodedImage, strokeColor: color);
    setState(() {});
  }

  @override
  Widget build(BuildContext context) …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout flutter-canvas

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

DioError [DioErrorType.response]:Http 状态错误 [401]

final dio = Dio();
    try {
      await dio.request(
        'https://api.example.com/api/v1/auth/validateMobile',
        data: {"phoneNo": "+91999999999"},
        options: Options(
          method: 'GET',
          headers: {
            HttpHeaders.authorizationHeader:
                'Bearer $token',
            'content-Type': 'application/json'
          },
        ),
      );
    } on DioError catch (e) {
      print(e);
    }
Run Code Online (Sandbox Code Playgroud)
I/flutter (16336): DioError [DioErrorType.response]: Http status error [401]
I/flutter (16336): #0      DioMixin.assureDioError (package:dio/src/dio_mixin.dart:819:20)
I/flutter (16336): #1      DioMixin._dispatchRequest (package:dio/src/dio_mixin.dart:678:13)
I/flutter (16336): <asynchronous suspension>
I/flutter (16336): #2      DioMixin.fetch.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart)
I/flutter (16336): <asynchronous suspension>
Run Code Online (Sandbox Code Playgroud)

即使我使用正确的令牌传递授权标头,我仍收到 401 错误。感谢您的帮助。

dart flutter dio

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

文件选择器:在 &lt;manifest&gt; 中发现了意外的元素 &lt;queries&gt;

每当我将文件选择器包添加到 pubspec.yaml 文件并重新运行应用程序时,我都会收到以下错误:

FAILURE:构建失败,出现异常。

  • 出了什么问题:任务 ':app:processDebugResources' 执行失败。

执行com.android.build.gradle.internal.tasks.Workers$ActionFacade Android资源链接失败D:\MY_PROJECTS\flutter_projects\health_app\build\file_picker\intermediates\library_manifest\debug\AndroidManifest.xml:9:5 -15:15: AAPT: 错误: 在 .

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • https://help.gradle.org获取更多帮助

BUILD FAILED in 19s 构建失败可能是由于插件中的 AndroidX 不兼容。该工具即将尝试使用Jetfier来解决不兼容问题。构建插件 cloud_firestore... 正在运行 Gradle 任务 'assembleAarRelease'... 例外:由于上述问题,无法构建插件 cloud_firestore。

filepicker flutter

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

Flutter 发布版本 apk 显示黑屏或无法解析配置“:app:profileRuntimeClasspath”的所有工件

我在应用程序的发布版本中遇到黑屏问题,调试版本工作正常。当我在手机上安装并打开该应用程序的发行版时,它只显示黑屏,没有其他显示。

Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18363.1198], locale en-US)

[?] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[?] Android Studio (version 3.6)
[?] Connected device (1 available)

• No issues found!

Run Code Online (Sandbox Code Playgroud)

在构建 apk 的发布版本时,出现以下错误

Could not resolve all artifacts for configuration ':app:profileRuntimeClasspath'.
Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: D:\MY_PROJECTS\flutter_projects\sabr_health_app\build\app\intermediates\flutter\profile\libs.jar.
> Transform's input file …
Run Code Online (Sandbox Code Playgroud)

flutter

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

按下后退按钮转到上一条路线时如何处理颤动底部导航栏?

我正在处理底部导航栏,但我无法完全回到上一条路线。

如果我从底部导航栏视图项中选择两个以上的导航按钮,那么当我按下后退按钮时,它将关闭应用程序。

   return Scaffold(
    body: (_getBody(index, model)),
    bottomNavigationBar: BottomNavigationBar(
      backgroundColor: Colors.white,
      selectedItemColor: Color(0xFFf5851f),
      unselectedItemColor: Colors.grey,
      type: BottomNavigationBarType.fixed,
      currentIndex: index,

      // onTap: (value) => setState(() => index = value),
      onTap: (value) {
        setState(() => index = value);
        print(value);
      },
      items: [
        BottomNavigationBarItem(
            icon: Icon(Icons.restaurant),
            title: Text('GMA', style: Theme.of(context).textTheme.body2)),
        BottomNavigationBarItem(
            icon: Icon(Icons.call),
            title: Text('CALL ON ORDER',
                style: Theme.of(context).textTheme.body2)),
        BottomNavigationBarItem(
            icon: Icon(Icons.notifications),
            title:
                Text('NOTIFICATION', style: Theme.of(context).textTheme.body2)),
        BottomNavigationBarItem(
            icon: Icon(Icons.shopping_cart),
            title: Text('CART', style: Theme.of(context).textTheme.body2)),
        //TextStyle(fontSize: 12, fontWeight: FontWeight.w600))),
      ],
    ), 
       


Widget _getBody(int index, MainModel …
Run Code Online (Sandbox Code Playgroud)

flutter

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

标签 统计

flutter ×5

dart ×1

dio ×1

filepicker ×1

flutter-canvas ×1

flutter-layout ×1