dart

ShaderMask LinearGradient's stops strange behavior

北城以北 提交于 2021-01-28 12:30:40
问题 I want to fade both side (edges) of a content. I use a ShaderMask along with a LinearGradient , it works great except that I don't understand why my stops are not centered correctly, I use stops: [0.0, 0.05, 0.95, 1.0] so that it should be faded 0.05 on each side, but I get the following (I added a Container gradient with same configuration for comparison): With debug paint mode : I use exactly the same stops for the Container and for the ShaderMask but get different results. Of course I can

How to use ML Kit cloud text recognizer for flutter?

空扰寡人 提交于 2021-01-28 12:27:58
问题 I am using the package 'firebase_ml_vision' in my project to do OCR. I can read Latin based languages just fine, however, I want to read Chinese characters. I know that there are on the device and cloud-based versions of the text recognizer. However, I can't find out how to 'enable' the cloud-based version in my app. I have already activated cloud-based APIs in Firebase as seen in this image: Activated cloud apis The code that I currently use is: void _initializeVision() async{ final File

Create a countdown timer that prints a remaining time every 5 seconds for each value in a list

独自空忆成欢 提交于 2021-01-28 12:20:06
问题 I'm trying to create a countdown timer in Flutter that prints the remaining time every 5 seconds until the timer runs out, and then runs the same countdown timer for the next value in a list of values. The following recursive function gets close, but it waits the "iteration" before going to the next value in the List even when there is less time remaining for that Timer . import 'dart:async'; Future main() async { final _sequence = [21, 10, 8]; final _iteration = 5; void _countdown(seq) async

Flutter PhotoView - Rotation about the point between the fingers

时间秒杀一切 提交于 2021-01-28 12:13:47
问题 I am using PhotoView (https://pub.dev/packages/photo_view) to showcase a map saved in gif format. I need the ability to zoom and rotate. My code: class MapView extends StatelessWidget { @override Widget build(BuildContext context) { return PhotoView( imageProvider: AssetImage("assets/maps/my_map.gif"), enableRotation: true, backgroundDecoration: BoxDecoration( color: Colors.white, ), ); } } The problem is that the picture is rotated relative to the center of the picture, which is inconvenient

Flutter: setState() or markNeedsBuild() called during build

有些话、适合烂在心里 提交于 2021-01-28 12:09:25
问题 I have a page that shows video. But when I complete the video and pop back to the previous page I get this bellow error. My app works all fine and good with no breaks, but this below error bothers me. setState() or markNeedsBuild() called during build is the error that I am unable to fix I need help to fix this error. Here is my error: ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════ The following assertion was thrown while dispatching

Heart Rate Value in BLE

霸气de小男生 提交于 2021-01-28 11:13:17
问题 I am having a hard time getting a valid value out of the HR characteristics. I am clearly not handling the values properly in Dart. Example Data: List<int> value = [22, 56, 55, 4, 7, 3]; Flags Field: I convert the first item in the main byte array to binary to get the flags 22 = 10110 (as binary) this leads me to believe that it is U16 (bit[0] is == 1) HR Value: Because it is 16 bit I am trying to get the bytes in the 1 & 2 indexes. I then try to buffer them into a ByteData. From there I get

Flutter FCM Navigation onResume/onLaunch

自古美人都是妖i 提交于 2021-01-28 10:55:18
问题 In my app, I got a class "home" where the user is navigated to after he is authorized. Within "home" there is a PageView with BottomNavigationBar. When the user is getting a push notification from firebase (new message) he should be navigated to ChatHome and to the specific chat after tapping. How can I do this? Home does look like this @override Widget build(BuildContext context) { return Scaffold( key: _scaffoldKey, body: PageView( children: <Widget>[ Feed(userID: widget.userID), SearchView

Assertion failed: url != null is not true

半城伤御伤魂 提交于 2021-01-28 10:21:24
问题 ════════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building HomePage(dirty, state: _HomePageState#493d9): Assertion failed: F:\…\painting_network_image_web.dart:23 url != null is not true This is the error I get when I add this codes in home.dart WallpaperModel wallpaperModel = WallpaperModel(); wallpaperModel = WallpaperModel.fromMap(element); wallpapers.add(wallpaperModel); also /widget/widget.dart Widget wallpapersList({List

Assertion failed: url != null is not true

99封情书 提交于 2021-01-28 10:20:54
问题 ════════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building HomePage(dirty, state: _HomePageState#493d9): Assertion failed: F:\…\painting_network_image_web.dart:23 url != null is not true This is the error I get when I add this codes in home.dart WallpaperModel wallpaperModel = WallpaperModel(); wallpaperModel = WallpaperModel.fromMap(element); wallpapers.add(wallpaperModel); also /widget/widget.dart Widget wallpapersList({List

Assertion failed: url != null is not true

与世无争的帅哥 提交于 2021-01-28 10:20:17
问题 ════════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building HomePage(dirty, state: _HomePageState#493d9): Assertion failed: F:\…\painting_network_image_web.dart:23 url != null is not true This is the error I get when I add this codes in home.dart WallpaperModel wallpaperModel = WallpaperModel(); wallpaperModel = WallpaperModel.fromMap(element); wallpapers.add(wallpaperModel); also /widget/widget.dart Widget wallpapersList({List