Posts

Showing posts with the label Responsive

Learn Layout Builder on Flutter and Build Responsive UI

Image
What is Layout Builder? Flutter Layout Builder is a Method that Builds a widget tree based on it's  parent widget's max size. By using this , you can build responsive UI for your Flutter App. In this guide you will learn how to use Layout builder on Flutter and build a responsive UI. Difference between MediaQuery and LayoutBuilder The main difference between MediaQuery and LayoutBuilder in Flutter is MediaQuery uses the complete context of the screen but Layout Builder uses it's parent Widget Size. For making a responsive UI , we need both of them. But in this tutorial  we are going to implement LayoutBuilder. Flutter LayoutBuilder As I told you, LayoutBuilder is a method of Flutter. So it has a return type. Here the Return type is a Widget or Widget Tree. Look at the example below. LayoutBuilder(           builder: (context, size) {             final getWidth = size.maxWidth;            ...