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.

flutter
Filter by
Sorted by
Tagged with
774 votes
16 answers
382k 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
  • 30.2k
644 votes
33 answers
653k 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
581 votes
25 answers
570k 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,813
577 votes
40 answers
808k 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
  • 11.1k
575 votes
16 answers
614k 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
567 votes
22 answers
1.0m 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
  • 116k
544 votes
87 answers
761k views

Getting error "No such module" using Xcode, but the framework is there

I'm currently coding in Swift, and I've got an error: No such module Social But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "...
alexandresecanove's user avatar
507 votes
31 answers
296k 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
  • 116k
507 votes
35 answers
491k 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
  • 6,307
499 votes
34 answers
368k 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
490 votes
28 answers
418k 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
478 votes
23 answers
288k 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,915
459 votes
41 answers
528k 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
457 votes
24 answers
549k 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.8k
450 votes
20 answers
516k 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
  • 5,222
428 votes
28 answers
509k 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
  • 27.2k
417 votes
20 answers
375k 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,672
408 votes
20 answers
280k 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,671
400 votes
36 answers
474k 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
  • 4,011
396 votes
25 answers
228k 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
394 votes
28 answers
378k 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
  • 11.1k
380 votes
62 answers
594k 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
378 votes
32 answers
631k 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
  • 5,087
375 votes
20 answers
325k 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
  • 116k
363 votes
16 answers
155k 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
360 votes
37 answers
488k 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,723
359 votes
18 answers
404k 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,628
353 votes
10 answers
248k 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
  • 20.5k
353 votes
25 answers
540k 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,539
352 votes
24 answers
238k 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
  • 7,207
349 votes
27 answers
319k 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
347 votes
17 answers
359k 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
  • 4,210
343 votes
18 answers
144k 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
  • 5,071
343 votes
15 answers
341k 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,474
339 votes
15 answers
132k 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
336 votes
16 answers
375k 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
  • 6,106
336 votes
7 answers
60k 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
330 votes
15 answers
521k views

Flutter- wrapping text

I want wrap text as text grows. I searched through and tried wrap with almost everything but still text stays one line and overflows from the screen. Does anyone know how to achieve this? Any help is ...
Daibaku's user avatar
  • 12k
329 votes
12 answers
291k 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,837
325 votes
13 answers
385k 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,364
322 votes
11 answers
169k 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

1
2 3 4 5
3938