How to set Custom height for Widget in GridView in Flutter?

The key is the childAspectRatio. This value is use to determine the layout in GridView. In order to get the desired aspect you have to set it to the (itemWidth / itemHeight). The solution would be this: class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => … Read more

How to center the title of an appbar

Centering the title is the default on iOS. On Android, the AppBar‘s title defaults to left-aligned, but you can override it by passing centerTitle: true as an argument to the AppBar constructor. Example: AppBar( centerTitle: true, // this is all you need … )

Flutter how to programmatically exit the app

Below worked perfectly with me in both Android and iOS, I used exit(0) from dart:io import ‘dart:io’; @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text(widget.title), ), body: new … (…), floatingActionButton: new FloatingActionButton( onPressed: ()=> exit(0), tooltip: ‘Close app’, child: new Icon(Icons.close), ), ); } UPDATE Jan 2019 Preferable … Read more

Cannot run with sound null safety because dependencies don’t support null safety

First, you should read through the guide to understand unsound null safety. If you are sure that you want to run your application with unsound null safety, you can use the following command: flutter run –no-sound-null-safety The –no-sound-null-safety option is not documented in the article, however, I have not experienced any problems with it for … Read more

How to downgrade Flutter SDK (Dart 1.x)

Flutter is versioned using git. Changing the Flutter version is as simple as changing git branch. There are 2 different ways: flutter channel <branch> (example: flutter channel stable) This command is used to change between branches – usually stable/dev/beta/master. We can also put a specific commit id from git. flutter downgrade <version> (example: flutter downgrade … Read more

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