How can I add shadow to the widget in flutter?

Check out BoxShadow and BoxDecoration A Container can take a BoxDecoration (going off of the code you had originally posted) which takes a boxShadow return Container( margin: EdgeInsets.only(left: 30, top: 100, right: 30, bottom: 50), height: double.infinity, width: double.infinity, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10) ), boxShadow: … Read more

Yellow lines under Text Widgets in Flutter?

The problem is having a Scaffold or not. Scaffold is a helper for Material apps (AppBar, Drawer, that sort of stuff). But you’re not forced to use Material. What you’re missing is an instance of DefaultTextStyle as a parent: DefaultTextStyle( style: TextStyle(…), child: Text(‘Hello world’), ) Various widgets add one to change the default text … Read more

How to show/hide widgets programmatically in Flutter

Definition: Invisible: The widget takes up physical space on the screen but is not visible to user. This can be achieved using Visibility widget. Gone: The widget doesn’t take up any physical space and is completely gone. This can be achieved using Visibility, if or if-else condition. Invisible example: Visibility( child: Text(“Invisible”), maintainSize: true, maintainAnimation: … Read more

How to deal with unwanted widget build?

The build method is designed in such a way that it should be pure/without side effects. This is because many external factors can trigger a new widget build, such as: Route pop/push Screen resize, usually due to keyboard appearance or orientation change The parent widget recreated its child An InheritedWidget the widget depends on (Class.of(context) … Read more

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

(I assume you’re using a Row because you want to put other widgets beside the TextField in the future.) The Row widget wants to determine the intrinsic size of its non-flexible children so it knows how much space that it has left for the flexible ones. However, TextField doesn’t have an intrinsic width; it only … Read more

Sizing elements to percentage of screen width/height

This is a supplemental answer showing the implementation of a couple of the solutions mentioned. FractionallySizedBox If you have a single widget you can use a FractionallySizedBox widget to specify a percentage of the available space to fill. Here the green Container is set to fill 70% of the available width and 30% of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)