Questions tagged [flutter]

Use this tag for questions about the Flutter cross-platform UI toolkit. If your question is platform-specific, tag the platform as well (e.g., [android], [ios], etc.). You may also wish to include the [dart] tag for coding questions.

Filter by
Sorted by
Tagged with
747 votes
30 answers
352k views

How can I remove the debug banner in Flutter?

I'm using flutter screenshot and I expected the screenshot to not have a banner, but it has. Note that I get a not supported for emulator message for profile and release mode.
Tree's user avatar
  • 29.3k
611 votes
34 answers
601k views

How do I use hexadecimal color strings in Flutter?

How do I convert a hexadecimal color string like #b74093 to a Color in Flutter? I want to use a HEX color code in Dart.
creativecreatorormaybenot's user avatar
555 votes
38 answers
757k views

Create a rounded button / button with border-radius in Flutter

I'm currently developing an Android app in Flutter. How can I add a rounded button?
Kingsley CA's user avatar
  • 10.7k
550 votes
14 answers
557k views

How to change the application launcher icon on Flutter?

When I create an app with a flutter create command, the flutter logo is used as an application icon for both platforms. If I want to change the app icon, shall I go to both platforms directories and ...
RobertoAllende's user avatar
542 votes
18 answers
930k views

How can I add a border to a widget in Flutter?

I'm using Flutter and I'd like to add a border to a widget (in this case, a Text widget). I tried TextStyle and Text, but I didn't see how to add a border.
Seth Ladd's user avatar
  • 113k
505 votes
23 answers
479k views

I am getting error "cmdline-tools component is missing" after installing Flutter and Android Studio... I added the Android SDK. How can I solve them?

Android toolchain - I develop for Android devices (Android SDK version 30.0.3): X cmdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools;latest"` See https://...
Ashfaq's user avatar
  • 5,053
486 votes
27 answers
274k views

How do you build a Singleton in Dart?

The singleton pattern ensures only one instance of a class is ever created. How do I build this in Dart?
Seth Ladd's user avatar
  • 113k
480 votes
34 answers
438k views

How to change package name in flutter?

Is there any way to change Package Name of Flutter project? I want to change package name and application name in flutter project.
Abc Xyz's user avatar
  • 5,937
472 votes
33 answers
333k views

How can I dismiss the on screen keyboard?

I am collecting user input with a TextFormField and when the user presses a FloatingActionButton indicating they are done, I want to dismiss the on screen keyboard. How do I make the keyboard go away ...
Collin Jackson's user avatar
468 votes
28 answers
374k views

No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp() in Flutter and Firebase

I am building a Flutter application and I have integrated Firebase, but I keep getting this error when I click on a button either to register, login, or logout. I have seen other people have asked the ...
Kennedy Owusu's user avatar
449 votes
20 answers
258k views

How do you detect the host platform from Dart code?

For UI that should differ slightly on iOS and Android, i.e. on different platforms, there must be a way to detect which one the app is running on, but I couldn't find it in the docs. What is it?
Gavin's user avatar
  • 6,545
445 votes
40 answers
467k views

How to run CocoaPods on Apple Silicon (M1)

I have a Flutter project that I'm trying to run on iOS. It runs normally on my Intel-based Mac, but on my new Apple Silicon-based M1 Mac it fails to install pods. LoadError - dlsym(0x7f8926035eb0, ...
Jacobo Koenig's user avatar
436 votes
24 answers
503k views

Flutter - Wrap text on overflow, like insert ellipsis or fade

I'm trying to create a line in which center text has a maximum size, and if the text content is too large, it fits in size. I insert the TextOverflow.ellipsis property to shorten the text and ...
rafaelcb21's user avatar
  • 12.5k
424 votes
19 answers
469k views

How to do Rounded Corners Image in Flutter

I am using Flutter to make a list of information about movies. Now I want the cover image on the left to be a rounded corners picture. I did the following, but it didn’t work. Thanks! getItem(var ...
Liu Silong's user avatar
  • 4,952
412 votes
27 answers
468k views

How to create number input field in Flutter?

I'm unable to find a way to create an input field in Flutter that would open up a numeric keyboard and should take numeric input only. Is this possible with Flutter material widgets? Some GitHub ...
Janne Annala's user avatar
  • 26.1k
390 votes
20 answers
335k views

How can I change the app display name build with Flutter?

I have created the app using Flutter create testapp. Now, I want to change the app name from "testapp" to "My Trips Tracker". How can I do that? I have tried changing from the ...
rajaishwary's user avatar
  • 4,392
389 votes
18 answers
261k views

How to add a ListView to a Column in Flutter?

I'm trying to construct a simple login page for my Flutter app. I've successfully built the TextFields and log in/Sign in buttons. I want to add a horizontal ListView. When I run the code my ...
Charles Jr's user avatar
  • 8,383
383 votes
24 answers
205k views

Waiting for another flutter command to release the startup lock

When I run my flutter application it show Waiting for another flutter command to release the startup lock this messages and not proceed further.
Viren V Varasadiya's user avatar
374 votes
35 answers
432k views

Dart SDK is not configured

I installed Flutter and set up Android Studio. Then I cloned an example of flutter on GitHub (https://github.com/flutter/flutter) and launched it in Android Studio, but it warns me "Dart SDK is ...
Katelyn's user avatar
  • 3,751
369 votes
62 answers
569k views

Message "flutter run: No connected devices"

I am trying to create a sample application with Flutter (fresh installation). Android Studio is also installed (fresh installation). Here is the output of flutter run flutter run No connected devices. ...
FULL STACK DEV's user avatar
365 votes
20 answers
302k views

How do I supply an initial value to a text field?

I'd like to supply an initial value to a text field and redraw it with an empty value to clear the text. What's the best approach to do that with Flutter's APIs?
Seth Ladd's user avatar
  • 113k
362 votes
27 answers
337k views

Flutter : How to change Android minSdkVersion in Flutter Project?

I was trying to start a flutter project for an App using Bluetooth to communicate. For that, I was using flutter blue. Unfortunately, when trying to run (on an Android device) the first example I ...
Maldus's user avatar
  • 10.6k
360 votes
32 answers
583k views

How to use conditional statement within child attribute of a Flutter Widget (Center Widget)

So far whenever I needed to use a conditional statement within a Widget I have done the following (Using Center and Containers as simplified dummy examples): new Center( child: condition == true ? ...
Marko's user avatar
  • 4,897
354 votes
16 answers
147k views

Scaffold.of() called with a context that does not contain a Scaffold

As you can see, my button is inside the Scaffold's body. But I get this exception: Scaffold.of() called with a context that does not contain a Scaffold. import 'package:flutter/material.dart'; void ...
Figen Güngör's user avatar
345 votes
18 answers
374k views

Sizing elements to percentage of screen width/height

Is there a simple (non-LayoutBuilder) way to size an element relative to screen size (width/height)? For example: how do I set the width of a CardView to be 65% of the screen width. It can't be done ...
Luke's user avatar
  • 6,418
345 votes
8 answers
234k views

Passing data to StatefulWidget and accessing it in its state in Flutter

I have 2 screens in my Flutter app: a list of records and a screen for creating and editing records. If I pass an object to the second screen that means I am going to edit this and if I pass null it ...
moonvader's user avatar
  • 19.9k
343 votes
25 answers
523k views

Error:(1, 0) Plugin with id 'com.android.application' not found

This is my first attempt at Android Studio. I installed 0.8.0 and updated to 0.8.2. As soon as a project is created I get the error message: Error:(1, 0) Plugin with id 'com.android.application' ...
Bob Kusik's user avatar
  • 3,439
333 votes
24 answers
216k views

Flutter: how to prevent device orientation changes and force portrait?

I would like to prevent my application from changing its orientation and force the layout to stick to "portrait". In the main.dart, I put: void main(){ SystemChrome.setPreferredOrientations([ ...
boeledi's user avatar
  • 6,897
330 votes
14 answers
118k views

flutter doctor --android-licenses gives a java error

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156) ...
Vivek Kogilathota's user avatar
326 votes
27 answers
293k views

Vertical viewport was given unbounded height

This is my code: @override Widget build(BuildContext context) { return new Material( color: Colors.deepPurpleAccent, child: new Column( mainAxisAlignment: MainAxisAlignment.center, ...
pallav bohara's user avatar
326 votes
16 answers
132k views

Yellow lines under Text Widgets in Flutter?

The main app screen doesn't have this issue, all the texts show up as they should. However, in the new screen, all the text widget have some weird yellow line / double-line underneath. Any ideas on ...
dasfima's user avatar
  • 4,871
322 votes
17 answers
330k views

How do I disable a Button in Flutter?

I'm having trouble figuring out how to set the enabled state of a button in Flutter. From the docs, it says to set onPressed to null to disable a button, and give it a value to enable it. This is fine ...
chris84948's user avatar
  • 3,950
319 votes
15 answers
314k views

Flutter: Run method on Widget build complete

I would like to be able to run functions once a Widget has finished building/loading but I am unsure how. My current use case is to check if a user is authenticated and if not, redirect to a login ...
KingLagalot's user avatar
  • 3,234
317 votes
16 answers
354k views

How to show/hide widgets programmatically in Flutter

In Android, every single View subclass has a setVisibility() method that allows you modify the visibility of a View object There are 3 options of setting the visibility: Visible: Renders the View ...
user3217522's user avatar
  • 5,836
317 votes
6 answers
56k views

What is the difference between functions and classes to create reusable widgets?

I have realized that it is possible to create widgets using plain functions instead of subclassing StatelessWidget. An example would be this: Widget function({ String title, VoidCallback callback }) ...
Rémi Rousselet's user avatar
314 votes
12 answers
355k views

Flutter: how to make a TextField with HintText but no Underline?

This is what I'm trying to make: In the Flutter docs for Text Fields (https://flutter.io/text-input/) it says you can remove the underline by passing null to the decoration. However, that also gets ...
juan park's user avatar
  • 3,254
309 votes
25 answers
364k views

Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15

In Stripe, my client wants email and cardholder name, but the Stripe payment UI doesn't provide that option in com.stripe.android.view.CardMultilineWidget. I wanted to give it a try with the latest ...
Karthy Sbk's user avatar
  • 3,213
308 votes
11 answers
159k views

TextField inside of Row causes layout exception: Unable to calculate size

I’m getting a rendering exception that I don’t understand how to fix. I’m attempting to create a column that has 3 rows. Row [Image] Row [TextField ] Row [Buttons] Here is my code to build the ...
Matthew Smith's user avatar
305 votes
9 answers
264k views

setState() or markNeedsBuild called during build

class MyHome extends StatefulWidget { @override State<StatefulWidget> createState() => new MyHomePage2(); } class MyHomePage2 extends State<MyHome> { List items = new List(); ...
Divyang Shah's user avatar
  • 3,587

1
2 3 4 5
3807