Flutter Widget | 10 | SingleChildScrollView

Here is the video tutorial


Code

 main.dart

import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primaryColor: Color(0xFF832685),
primaryColorLight: Color(0xFFC81379),
accentColor: Colors.black,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String title = 'SingleChildScrollView';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
centerTitle: true,
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
color: Colors.grey,
height: 1500,
width: MediaQuery.of(context).size.width,
child: Center(
child: Text(
'Scroll',
style: TextStyle(fontSize: 22),
)),
),
],
),
));
}
}

Post a Comment

0 Comments