dart

Flutter: send Data from TabBarView (StatefullWidgets) back to main Scaffold

可紊 提交于 2021-02-08 10:28:29
问题 I want to create an App with Tabs to get the users input. The Problem is, that the different Tabs get different inputs, but i have to collect the inputs for the Database. My idea her was, that the main Scaffhold collects the inputs from all Tabs and write it in a database! My Problem is, that i dont know to send data from the tab (statefullWidget in an other file) to the parent class (Scaffold) or run a function from there! Please help me and sorry for my bad english! Jonas 回答1: You can pass

How to notifyListeners with nested child from Provider in Flutter?

回眸只為那壹抹淺笑 提交于 2021-02-08 10:21:29
问题 guys, I'm starting with flutter and I decided to make a mini game like "cookie clicker" to train but I've just run into a problem with the state management... I use a provider to propagate the "GameController" which aims to update the player's resources and do the calculations. I manage to get the "GameController" everywhere but when I interact with a resource (object in the "GameController") and this one is up to date but not in the UI, it doesn't change... main.dart : import 'package

uploaded files to Azure are corrupted when using dio

谁说我不能喝 提交于 2021-02-08 10:13:17
问题 I'm trying to upload a file from my phone to azure blob storage as a BlockBlob with a SAS. I can get the file to upload, but it can't be opened once downloaded. The file gets corrupted somehow. I thought this was a content-type problem, but I have tried several different approaches to changing to content-type. Nothing has worked so far. My code: FileInfo _fileInfo = await filePicker(); // get the file path and file name // my getUploadInfo fires a call to my backend to get a SAS. // I know

How to save my current state by using json or something else in Flutter

陌路散爱 提交于 2021-02-08 08:52:08
问题 I want to know how to save my current state by modifying the existing JSON file. but I can't find a way to saving..... So I want to ask you about that. The size of the JSON file is not so big. So I considered total - loading and total - saving when the loading and saving state is called. but I think it is not efficient and unstable... So can I get some help? 回答1: please use this package https://pub.dev/packages/shared_preferences Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android

Flutter qrImage convert to Image

你。 提交于 2021-02-08 08:06:37
问题 I'm using qr_flutter to create QrImage. It's ok but I would like to convert QrImage into image in order to create a PDF file to print on the printer. Please kindly help! QrImage( data: qrString, size: 300.0, version: 10, backgroundColor: Colors.white, ), 回答1: Use a RepaintBoundary widget with a key to export the widget to a a b64 string which then you can export as an image. Example: Future<Uint8List> _getWidgetImage() async { try { RenderRepaintBoundary boundary = _renderObjectKey

Flutter qrImage convert to Image

拜拜、爱过 提交于 2021-02-08 08:04:46
问题 I'm using qr_flutter to create QrImage. It's ok but I would like to convert QrImage into image in order to create a PDF file to print on the printer. Please kindly help! QrImage( data: qrString, size: 300.0, version: 10, backgroundColor: Colors.white, ), 回答1: Use a RepaintBoundary widget with a key to export the widget to a a b64 string which then you can export as an image. Example: Future<Uint8List> _getWidgetImage() async { try { RenderRepaintBoundary boundary = _renderObjectKey

Using InjectorFactory for routerProviders or routerProvidersHash can be automated?

天涯浪子 提交于 2021-02-08 08:00:15
问题 I'm bootstrap angular with runApp and the namend Parameter "createInjector" to define the routerStrategy "routerProviders" or "routerProvidersHash". Is there any way to automate this definition like i wish to do this in my first line? For local development i wish to use "routerProvidersHash" and for live environment is wanna use the "routerProvider". const List<Provider<Object>> routerStrategy = Environment.isLive() ? routerProviders : routerProvidersHash; @GenerateInjector([ routerStrategy,

Flutter URL Launcher Google Maps

爷,独闯天下 提交于 2021-02-08 07:59:56
问题 List.dart import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class List extends StatefulWidget { @override ListState createState() { return new ListState(); } } class ListState extends State<List> { static const double lat = 2.813812, long = 101.503413; static const String map_api= "API_KEY"; @override Widget build(BuildContext context) { //method to launch maps void launchMap() async{ const url = "https://maps.google.com/maps/search/?api=$map_api&query=

Using InjectorFactory for routerProviders or routerProvidersHash can be automated?

坚强是说给别人听的谎言 提交于 2021-02-08 07:59:28
问题 I'm bootstrap angular with runApp and the namend Parameter "createInjector" to define the routerStrategy "routerProviders" or "routerProvidersHash". Is there any way to automate this definition like i wish to do this in my first line? For local development i wish to use "routerProvidersHash" and for live environment is wanna use the "routerProvider". const List<Provider<Object>> routerStrategy = Environment.isLive() ? routerProviders : routerProvidersHash; @GenerateInjector([ routerStrategy,

Expand DataTable to fill height in Flutter

两盒软妹~` 提交于 2021-02-08 07:25:00
问题 I have a problem with flutter. I need to fill a DataTable in the height of screen. I tried to add the dataTable inside a Flex widget, but I don't get changes. When I set the heigh of the Container, that's work let me a white space at the button of the screen Thank you! and i'm sorry for mi poor english This my code: products.addAll(Product.getExampleList()); var table = Container( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child:SizedBox( child: Column( children: <Widget>