dart

flutter: fcm ios push notifications doesn't work in release mode

雨燕双飞 提交于 2021-02-07 12:57:59
问题 I have bound my flutter-iOS app to firebase and i'm also using firebase-messaging and cloud functions for sending notifications via subscribing to topics, i'm using the APNs push notifications key of apple developer account. when i use the option runner>flutter run main.dart in release mode to build my app on my phone, fcm notifications doesn't work anymore, while it works in development mode, anyone can help me fix this? this is my index.json code: const functions = require('firebase

Convert Image object to rgb pixel array and back in Flutter

半城伤御伤魂 提交于 2021-02-07 12:48:17
问题 Is there a way to get an image's rgb matrix representation? and vice versa? I would like to perform image masking/filtering on the original image so it needs to be applied to its rgb matrix representation. Currently using this library to get an image from a device: https://pub.dartlang.org/packages/image_picker 回答1: https://pub.dartlang.org/packages/image provides image conversion and manipulation utility functions. 回答2: import 'dart:ui' as ui; import 'package:flutter/material.dart'; // for a

Flutter - Custom button tap area

允我心安 提交于 2021-02-07 12:43:31
问题 I'm building a Flutter application where a big portion of the screen will be occupied by a circular button. I already tried several different approaches in order to create a circular button, but I always end up having the same problem: the 'tappable' area is not actually circular, but rectangular. Here is an example obtained with a FloatingActionButton : For small-sized buttons this is not really a problem - I would even say that it is somehow helpful - but in my case it is very annoying. So

Flutter - Custom button tap area

梦想与她 提交于 2021-02-07 12:42:06
问题 I'm building a Flutter application where a big portion of the screen will be occupied by a circular button. I already tried several different approaches in order to create a circular button, but I always end up having the same problem: the 'tappable' area is not actually circular, but rectangular. Here is an example obtained with a FloatingActionButton : For small-sized buttons this is not really a problem - I would even say that it is somehow helpful - but in my case it is very annoying. So

How does Flutter calculate pixels for different resolutions?

会有一股神秘感。 提交于 2021-02-07 12:35:25
问题 Flutter apps can run on a variety of hardware, operating systems, and form factors. How are "pixels" calculated for different resolutions? 回答1: From https://docs.flutter.io/flutter/dart-ui/Window/devicePixelRatio.html : The number of device pixels for each logical pixel. This number might not be a power of two. Indeed, it might not even be an integer. For example, the Nexus 6 has a device pixel ratio of 3.5. Device pixels are also referred to as physical pixels. Logical pixels are also

flutter_facebook_login CocoaPods dependency error

非 Y 不嫁゛ 提交于 2021-02-07 12:24:24
问题 I am try add facebook login to Flutter app. I am use flutter_facebook_login . But when I try build for iOS give error: Resolving dependencies of `Podfile` [!] CocoaPods could not find compatible versions for pod "FBSDKLoginKit": In Podfile: flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`) was resolved to 0.0.1, which depends on FBSDKLoginKit (= 4.39.1) None of your spec sources contain a spec satisfying the dependency: `FBSDKLoginKit (= 4.39.1)`. You have either: *

Flutter: How to implement FlutterError.OnError correctly

≯℡__Kan透↙ 提交于 2021-02-07 12:22:27
问题 Can someone show me how to implement overriding flutter errors during widget test so I can check for my own custom errors. I have seen snippets online mentioning this but all of my implementations fail void main() { testWidgets('throws an error when scanning unknown term types', (WidgetTester tester) async { await tester.pumpWidget(injectTestWidget(new ItemScanScreen())); await tester.enterText(find.byKey(new Key('term')), ''); await tester.tap(find.byIcon(Icons.send)); await tester.pump();

Bad state: Cannot set the body fields of a Request with content-type “application/json”

懵懂的女人 提交于 2021-02-07 11:17:00
问题 Map<String,String> headers = {'Content-Type':'application/json','authorization':'Basic c3R1ZHlkb3RlOnN0dWR5ZG90ZTEyMw=='}; var response = await post(Urls.getToken, headers: headers, body: {"grant_type":"password","username":"******","password":"*****","scope":"offline_access"}, ); When I execute this I am unable to recieve data and the error thrown is Bad state: Cannot set the body fields of a Request with content-type "application/json" 回答1: You need to wrap the body in jsonEncode . import

Bad state: Cannot set the body fields of a Request with content-type “application/json”

心已入冬 提交于 2021-02-07 11:16:41
问题 Map<String,String> headers = {'Content-Type':'application/json','authorization':'Basic c3R1ZHlkb3RlOnN0dWR5ZG90ZTEyMw=='}; var response = await post(Urls.getToken, headers: headers, body: {"grant_type":"password","username":"******","password":"*****","scope":"offline_access"}, ); When I execute this I am unable to recieve data and the error thrown is Bad state: Cannot set the body fields of a Request with content-type "application/json" 回答1: You need to wrap the body in jsonEncode . import

How to set size to FloatingActionButton

时光怂恿深爱的人放手 提交于 2021-02-07 11:16:07
问题 I'm trying to set a size to a FloatingActionButton in flutter, I wanna set width / height , I mean, make the button bigger, I was looking for a circular button, but the only one that I got was this one, so, I started to work with this, but I need it a little bigger. 回答1: Use a Container where you can specify width and height , then use a RawMaterialButton , like this: myFabButton = Container( width: 200.0, height: 200.0, child: new RawMaterialButton( shape: new CircleBorder(), elevation: 0.0,