Skip to main content

Posts

Showing posts with the label What is Widget

Flutter SingleChildScrollView

What is SingleChildScrollView? To create a simple vertical ScrollView which can contain different types of widgets with different behavior we would use SingleChildScrollView Widget.SingleChildScrollView Widget is a box that can scroll a single widget. Widget In the below example code snippet we are creating a function called _createContainer() that accepts Color and text as an argument and it returns Container() widget with height: 200 pixels. We will reuse this widget many times in the Column. Without SingleChildScrollView Now we are creating a Column widget and add some containers to it with the use of creating widget function _createContainer(). If you run this code snippet in your app, the column will look like this as shown in the image below. With SingleChildScrollView Now we are wrapping the Column widget with a SingleChildScrollView scrolling widget, the information on the page should scroll and not showing any error. If you run this code snippet in your app, the colu...

What is Widget ? Types of Widget

What is Widget? In Flutter, we interact with the UI so the whole UI is made up of Widgets. If you are known to Android and Ios so in that we are using Views and UIViews same as in flutter it's called Widget but  - The widget is not only about view it is more than that.  Widgets describe what their view should look like given their current configuration and state. Types of Widgets :  Before we are discussing types of widgets first will know about State and what is the function we can use in that. What is State? - According to Flutter, State is information that can be read synchronously when the widget is built and might change during the lifetime of the widget.  - It is the responsibility of the widget implementer to ensure that the State is promptly notified when such state changes with the use of function State.setState. State objects are created by the framework by calling the StatefulWidget.createState. A widget can be either a stateless widget or a stateful widge...