Skip to main content

Posts

Showing posts with the label SingleChildScrollView

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...