dart

flutter: taking screenshots of a widget from its sibling

时光总嘲笑我的痴心妄想 提交于 2021-01-29 06:17:12
问题 Goal I have a view that has two children Widget A and Widget B, standing side by side. Widget B has a button that triggers a screenshot on Widget A, Problem but referring to questions such as this one, it seems that the implementation of screen capture must stay within Widget A. So the button callback in Widget B needs to talk to Widget A. Since both are stateful widgets, I find it difficult for B to call A's function inside its state. The various provider and inheritedWidget mechanisms seem

My Flutter App keeps crashing on my Android Kitkat 4.4.4 tablet when installing

不羁的心 提交于 2021-01-29 06:11:06
问题 i am trying to test my app on my old android tablet that runs android KitKat 4.4.4 but every time I try to run the flutter app in vs code, it's able to build the debug Apk then when installing and the app launches it crashes with the message "unfortunately app has stopped" i tried using this command "Flutter run enable software rendering" hoping it will be able to run my app but the same problem occurs, don't know what to do now, how can I run it on my tablet? this is my app/build.gradle

build JsonSerializable models in sub-modules with build_runner

北战南征 提交于 2021-01-29 06:09:24
问题 I have a Flutter project with sub-modules: - root Flutter project - Flutter module 1 - Flutter module 2 ... - Flutter module N Each module contains classes annotated with @JsonSerializable() . Currently i build models with this script: for dir in [DIR_LIST] do echo "Building models in ${dir}" cd ${BASE_DIR}/${dir} flutter packages pub run build_runner build --delete-conflicting-outputs done Is there a way to build every sub-module in my project with a single command in the root directory

I have static Gridview from local List How to make it dynamic

早过忘川 提交于 2021-01-29 06:05:29
问题 i have gridview from local list now i want to populate that gridview from api any idea how to do it, this is how my api response look like { "status": "SUCCESS", "data": [ { "img": "http://3.127.255.230/rest_ci/assets/uploads/products/1589784928__food12.jpg", "name": "Fruit Salad" }, { "img": "http://3.127.255.230/rest_ci/assets/uploads/products/1589784733__food12.jpg", "name": "Fruit Salad" }, { "img": "assets/food3.jpeg", "name": "Hamburger" }, ] } this is my static (local list) code for

Flutter http post response is limiting to 1023 characters

此生再无相见时 提交于 2021-01-29 06:05:22
问题 I'm creating an app using flutter, in this I'm creating a post request then reading the response as string (later to convert into json). Future<String> post([String url = "https://example.com/get-new"]) async { return await http.post(Uri.encodeFull(url), headers: {"Accept": "application/json"}).then((http.Response response) { final int statusCode = response.statusCode; if (statusCode < 200 || statusCode > 400) { throw new Exception("Error while fetching data"); } return response.body; }); }

How to pass Json data to another screen in flutter

☆樱花仙子☆ 提交于 2021-01-29 06:00:32
问题 List results; setState(() { var resBody = json.decode(res.body); print('Response body: ${resBody}'); results = resBody; }); Navigator.push( context, MaterialPageRoute( builder: (context) => SecondScreen(jsondata: results,), )); results is a jsondata and pass it to the second screen as jsondata In secondscreen how to retrieve jsondata ? 回答1: This may help you. Let me know class SecondScreen extends StatefulWidget { final List jsondata; SecondScreen({Key key, this.jsondata}) : super(key: key);

Not viewing Table Layout from a csv in flutter

故事扮演 提交于 2021-01-29 05:57:22
问题 I am making an app which loads the CSV file and show it as a list view But I can't see my data I don't know why it is doing like this. Here is the csv link a link! When I run my app I see only this Instead, I want to fill the empty space like this Here is the code import 'package:flutter/material.dart'; import 'package:csv/csv.dart'; import 'dart:async' show Future; import 'package:flutter/services.dart' show rootBundle; class TableLayout extends StatefulWidget { @override _TableLayoutState

Adding Multiple List Tile Items in Flutter to List

情到浓时终转凉″ 提交于 2021-01-29 05:55:22
问题 I have this code that I can't get to work properly. I have a Food class and I have initialized the name, price, and unique ID strings on it. I made the unique ID to be Uuid().v4(), which would give each food item a random string. FOOD CLASS class Food { String name; String price; String uniqueID = Uuid().v4(); Food({this.name, this.price, this.uniqueID})} On another page I have a Provider function that would add items in the cart, it is a list of string items (this may not be the best option)

keystore password was incorrect when building Appbundle (Flutter)

ε祈祈猫儿з 提交于 2021-01-29 05:54:38
问题 So I am currently trying to create an Appbundle so I can upload my app to the google play store. Unfortunately, I encountered a problem with the signature release portion of the project. Below is the copy of the error from the terminal: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:packageRelease'. > com.android.ide.common.signing.KeytoolException: Failed to read key key from store "/Users/herb/Downloads/morningly/android/app/key.jks": keystore

Flutter how to show single value from List?

守給你的承諾、 提交于 2021-01-29 05:43:17
问题 I am trying to filter data from array and then need to just a single value from data. Its showing filtered data but need to know how can i show a single value from that data ? class _ViewPostScreenState extends State<ViewPostScreen> { List showPost; String data; @override void initState(){ super.initState(); print(widget.id); showPost = posts.where((i) => i.id == widget.id).toList(); data = showPost.toString(); print(data); } The response or print output of data is this I/flutter ( 7374): [