dart

VSCode intellisense appears if only space bar pressed in Flutter

会有一股神秘感。 提交于 2021-02-10 20:15:12
问题 I'm using VSCode to develop Flutter Apps, but, intellisense only shows up when I press space bar first. For instance when I create any widget within the widget tree, such as IconButton(icon:), the property 'icon' doesn't show up in intellisense when typing the first characters, like 'ic', only if I press the space bar, or after the property was completely typed and then if it is removed, the next time when typing, then the intellisense works fine. Does anyone else having the same issue? it is

How do I add a container at the end of my grid view in Flutter?

ε祈祈猫儿з 提交于 2021-02-10 19:53:53
问题 I have a GridView and I want to add a bannerAd after the gridview scroll ends. The bannerAd is called from the dependency https://github.com/kmcgill88/admob_flutter. The code for the GridView is as follows Widget build(BuildContext context) { SystemChrome.setEnabledSystemUIOverlays([]); return WillPopScope( onWillPop: () async { return true; }, child: Scaffold( body: Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [const Color(0xFFFEFEFE), const Color(0xFFFEFEFE)],

Flutter - Dynamically adding widget that needs to change state as well

不羁的心 提交于 2021-02-10 19:52:27
问题 What I want to achieve is explained below:- To show several widgets by clicking a button. The dynamically displayed widgets are basically FlatButtons with Icons as child. So when I click these buttons, I want the icon to change. However, on testing it - I found that their state doesn't change. Below is a sample code import 'package:flutter/material.dart'; class Test extends StatefulWidget { @override _TestState createState() => _TestState(); } class _TestState extends State<Test> { IconData

i want to display data in DropDownButton From rest api using flutter

断了今生、忘了曾经 提交于 2021-02-10 19:51:36
问题 I was trying to get data from api and display it into DropDownButton I want to get country name and country id from api My code is: My get function List country_data = List(); String countryid; Future<String> country() async { final prefs = await SharedPreferences.getInstance(); final key = 'session_id'; final value = prefs.get(key ) ?? 0; var res = await http.get( Uri.encodeFull("http://husam.from-ar.com/api/api-ad/en/1"), headers: {"Accept": "application/json", "Authorization" : "$value", }

i want to display data in DropDownButton From rest api using flutter

若如初见. 提交于 2021-02-10 19:51:08
问题 I was trying to get data from api and display it into DropDownButton I want to get country name and country id from api My code is: My get function List country_data = List(); String countryid; Future<String> country() async { final prefs = await SharedPreferences.getInstance(); final key = 'session_id'; final value = prefs.get(key ) ?? 0; var res = await http.get( Uri.encodeFull("http://husam.from-ar.com/api/api-ad/en/1"), headers: {"Accept": "application/json", "Authorization" : "$value", }

Flutter - How to change state from inside another widget

爷,独闯天下 提交于 2021-02-10 19:50:38
问题 I'm trying to implement both a Drawer and the Bottom Navigation Bar. The below class NavigationHomeScreen is my home screen and when the user clicks a menu item in the Drawer the Changeindex function updates the screenView I would like to know how I can similarly update the screenView but from the BottomNavigationBarApp using the onTabTapped method. class NavigationHomeScreen extends StatefulWidget { @override _NavigationHomeScreenState createState() => _NavigationHomeScreenState(); } class

Flutter Mixed Layout - Grid with Rows

99封情书 提交于 2021-02-10 19:39:20
问题 I'm trying to create a basic Flutter app that has a a 2 by 2 grid of text inputs & a button below it. Initially, I just had the grid & no buttons with no problems: void main() => runApp(new App()); class App extends StatelessWidget { ... Widget build(BuildContext context) { return new MaterialApp( ... home: new InputWidget() ... class InputWidget extends StatefulWidget { Widget build(BuildContext context) { ... _InputWidgetState createState() => new _InputWidgetState(); ... class

Flutter app is running on Android Emulator but not on Physical Device (OnePlus 7T)

∥☆過路亽.° 提交于 2021-02-10 18:33:44
问题 When I run my flutter app on Android Emulator it runs without errors but when I am running it on my mobile device it shows following error in Debug Console: Launching lib\main.dart on HD1901 in debug mode... FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugKotlin'. > Could not resolve all artifacts for configuration ':app:debugCompileClasspath'. > Failed to transform artifact 'arm64_v8a_debug.jar (io.flutter:arm64_v8a_debug:1.0.0

Flutter how to change image after onTap with Gesture Detector

≡放荡痞女 提交于 2021-02-10 18:23:24
问题 I have a Image inside a GestureDetector widget. I want to change this image when onTapDown is called, and then change it again when onTapUp is called. Is there possible to do that? In other app (Native Android app with java), I used to do it using a button and changing its background with a selector xml, like this: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/image1" /> <item

Run Flutter builder runner in compiled app

倾然丶 夕夏残阳落幕 提交于 2021-02-10 15:01:01
问题 I have an idiot question. is it possible to run the build runner in an application compiled for dynamic code generation? 回答1: In a Flutter application, no. Flutter apps neither have the ability to dynamically evaluate Dart code, nor do they have access to the tools needed to parse and generate source code. 来源: https://stackoverflow.com/questions/61015321/run-flutter-builder-runner-in-compiled-app