Flutter some default styling on new project - flutter

i'm starting on flutter, already sorry if it's a noob question
Basically started with a new project and there I am getting an already applied theme
How to remove this?
Thanks

Right now, you have a completely black screen because you don't have a Scaffold widget.
The Scaffold widget is screen that will be displayed on your display.
You can add your Text widget in the body property of your Scaffold
return const MaterialApp(
home: Scaffold(
body: Text("Hello")
)
);

Related

How do I toggle dark mode in a flutter app

I have a flutter app which has some code like the following:
MaterialApp(
home: Scaffold(/*...*/)
)
and a ThemeData(). However, I don't want the Scaffold's child Widget to be rebuilt and it doesn't have a const constructor either. I know that I can wrap the scaffold in a new widget and set its state but that would rebuild the children! What do I do?

MaterialApp ThemeData iconTheme

I have some ListTile widgets around my app, and all of them have an icon.
From here I see that I need to override my ListTile with
ListTileTheme(
iconColor: Colors.blue,
child: ..
)
since the ListTile.iconColor is gray by default and doesn't fallback to ThemeData.iconTheme.iconColor.
I wonder if there is a way to specify the list tile theme in ThemeData, so I don't have to create a new widget just for that.
For now, there isn't, but this feature may arrive in the next flutter release: https://github.com/flutter/flutter/issues/31247

flutter SafeArea hides system icons unexpectedly

I'm using SafeArea to avoid my display area clashing with the latest phones statusbar and camera notch. I use Scaffold without an AppBar.
Problem
Although the display area works as expected, a side-effect happens: the statusbar becomes a single-color region and all system icons include WIFI and battery disappear.
Attempts
I've tried various tips, including
Flutter - System bar colors with SafeArea
Flutter - How to set status bar color when AppBar not present
But all they do is set the color. The icons are still missing.
Question
Is this by design or am I missing any useful properties of SafeArea?
Try this
If you are using like this
Widget build(BuildContext context) { return SafeArea(...); }
then try this
Widget build(BuildContext context) { return AnnotatedRegion( value: SystemUiOverlayStyle.light, child:SafeArea(...);

how to yellow and black lines from flutter android emulator

In the android emulator it appears this yellow and black lines when tipping in the form, someone knows how to fix it?
You can add the resizeToAvoidBottomInset parameter to your scaffold to automatically move your contents up when you open your keyboard to prevent a bottom overflow.
Scaffold(
resizeToAvoidBottomInset: false,
child: ...
);
alternatively you can wrap your from in a SingleChildScrollView widget to make any overflow scrollable.
SingleChildScrollView(
child: Column(...),
);

How to work with a CustomAppBar in flutter when the phone has a notch?

does anyone know how to use the SafeArea widget in a custom app bar. I am having a red overflow flex box appear on my custom app bar due to a notch in my emulator. I want to still show my custom app bar without the red overflow box in a way that looks presentable. When I tried surrounding my appbar in a safeArea widget I received an error in my Scaffold widget where I had placed my appBar. The code looked like this: Scaffold( appBar: customAppBar(context)). The error read: The argument type 'SafeArea' can't be assigned to the parameter type 'PreferredSizeWidget'. I believe that the Scaffold expects a PreferredSizeWidget but is receiving a safeArea widget instead. Please let me know if there are any other solutions out there other than using the SafeArea widget. Below is a photo of what my emulator looks like with the custom app bar and the red overflow box.
If you always want to make sure notches and punch holes don't get into your AppBar or UI, use the builder function from MaterialApp like this:
#override
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, child) => SafeArea(child: child),
home: MyApp(),
);
}
Now every single Page/Screen will be safe from being cut on the top.