Code Answers

Flutter styled map

Is it possible to use json generated from Google Styling Wizard to stylize the Flutter native map? Solution to answer: There is no such ability in current version. But soon it can be achieved due to this pull request Update Finally it has been merged with #1697 pull request! And it's published in 0.5.16 version of google_maps_flutter. H...

Flutter Outline Shows “Nothing to show” in android studio

I am trying to Extract Widget via Flutter Outline But I am facing below problem in android studio. Flutter Outline Shows "Nothing to show" See in this picture: After running "flutter doctor -v" Shows: Please help me if you know how to over come from this problem? Solution to answer: Move the mouse to any widget and Press Ctrl (or ⌘ ...

Flutter String to Icon value

how to convert String value to Icons value in Flutter, i'm getting Icon value from json as a String. I got following error when i'm tried to Use that value error: The argument type 'String' can't be assigned to the parameter type 'IconData'. (argument_type_not_assignable at [hippo] lib\screens\dynamic_list.dart:71) { "page": 1, "MenuIte...

Flutter app crash after converting Provider 3 to 4

I tried to upgrade my Flutter app to use Provider 4.0.1 today and the following code crashed on assigning a value to null. Here is the code I am attempting to convert. I only changed SingleChildCloneableWidget to SingleChildStatelessWidget which compiled OK. import 'package:provider/provider.dart'; import 'package:provider/single_child_widget.d...

Flutter App stuck at “Running Gradle task ‘assembleDebug’… “

When I run the app it get stuck Launching lib\main.dart on Lenovo A319 in debug mode... Running Gradle task 'assembleDebug'... (This is taking an unexpectedly long time.) It never initialize Gradle nor the dependencies Solution to answer: Here is solution in my case. Open your flutter Project directory. Change directory to android dir...

Flutter GlobalKey current state is null

What I'm basically trying to do (And I did, details up ahead) is create a screen with several forms the content of which is changed using a button (NEXT). So I have 3 forms, when I press next, I save the first form and pass to the other, what I did so far works when I put my class in main.dart. For example, here is my main.dart content. void ma...

Flutter Zoomable Widget

What I want to build is a widget that can make its child widget zoomable similar to the zoomable behavior. Gestures I want to cover are Pinch To Zoom Double Tap to Zoom Tap to get the local Position of the widget Here is my widget plan: ZoomableWidget( child: // My custom Widget which should be zoomable. ) Here is my current progress: imp...

Flutter: Get passed arguments from Navigator in Widget’s state’s initState

I have a StatefulWidget which I want to use in named route. I have to pass some arguments which I am doing as suggested in https://flutter.dev/docs/cookbook/navigation/navigate-with-arguments i.e. Navigator.pushNamed( context, routeName, arguments: , ); Now, I need to access these argument's in the state's initState metho...

Flutter-Web: Mouse hover -> Change cursor to pointer

UPDATE (2021/05/11): Flutter now natively has Hover Events implemented Widgets. There is a MouseCursor for Widgets like RaisedButton and properties like hoverColor or hoverElevation. https://api.flutter.dev/flutter/rendering/MouseCursor-class.html You can also use an InkWell anywhere else as stated in the accepted answer. Original Question: Ho...

Flutter packages get does not install new package

I'm trying to install a package (dynamic_theme) in flutter. When I run flutter packages get -v it does not even try to install the package. So far I've tried: Running flutter packages get Running flutter packages get Restarting my computer Updated flutter Added another package but that did not install either Updated Android Studio In my pubsp...

Flutter Text Field: How to add Icon inside the border

I would like to add the icon in the search bar. Here is my code so far: new TextField( decoration: new InputDecoration( icon: new Icon(Icons.search) labelText: "Describe Your Issue...", enabledBorder: const OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(20.0)), borderSide: const BorderSide( ...

Flutter – Change search hint text of SearchDelegate

In current implementation of SearchDelegate, there is no option to change the hint text. When the query is empty, search screen is displaying "Search" in the query field as a hint text. Hint text is currently defined on line 395 as follows: final String searchFieldLabel = MaterialLocalizations.of(context).searchFieldLabel; There is, however, ...

Flutter wrap text instead of overflow

When creating a Text widget with a long string in Flutter, it wraps its text when put directly in a Column. However, when it is inside Column-Row-Column, the text overflows the side of the screen. How do I wrap text inside a Column-Row-Column? And what is the reason for this difference? It would seem logical to me that any child of the upper co...

Flutter crossAxisAlignment vs mainAxisAlignment

I'm confused about crossAxisAlignment and mainAxisAlignment. Can anyone please explain it in simple words? Solution to answer: For Row: mainAxisAlignment = Horizontal Axis crossAxisAlignment = Vertical Axis For Column: mainAxisAlignment = Vertical Axis crossAxisAlignment = Horizontal Axis Image source ...

Flutter how to display datepicker when textformfield is clicked

new TextFormField( decoration: new InputDecoration(hintText: 'DOB'), maxLength: 10, validator: validateDob, onSaved: (String val) { strDob = val; }, ), Future _selectDate() async { DateTime picked = await showDatePicker( context: context, initialDate: new DateTime.now(), firstDate: new Da...

Flutter – How to change TextField hint color

I'm a bit confused how to change the hint color of the textfield. Someone can guide me how to do it.Thanks child: TextField( style: TextStyle(fontSize: 20), decoration: InputDecoration( hintText: "Password", border: new OutlineInputBorder( borderSide: new BorderSide( ...