0% found this document useful (0 votes)
4 views4 pages

Flutter Week 2

Uploaded by

dharnakarthik160
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
4 views4 pages

Flutter Week 2

Uploaded by

dharnakarthik160
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 4

Balaji Lanka,CSE UI Design using Flutter

2 a) Explore various Flutter widgets (Text, Image, Container,


etc.).
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatefulWidget {


const MyApp({super.key});

@override
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {


@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Image'),
),
body: Center(
child: Container(
height: 200,
width: 300,
child:
Image.network('https://upload.wikimedia.org/wikipedia/commons/1/1
7/Google-flutter-logo.png'),
),
),
Balaji Lanka,CSE UI Design using Flutter

));
}
}

output :

2 b) Implement different layout structures using Row, Column,


and Stack widgets.

import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context) {
Balaji Lanka,CSE UI Design using Flutter

return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Combined Layout Example')),
body: Center(
child: Column(
//mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
//mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(color: Colors.red, width: 50, height: 50),
Container(color: Colors.green, width: 50, height: 50),
Container(color: Colors.blue, width: 50, height: 50),
],
),
SizedBox(height: 20),
Stack(
alignment: Alignment.center,
children: <Widget>[
Container(color: Colors.red, width: 200, height: 200),
Container(color: Colors.green, width: 150, height: 150),
Container(color: Colors.blue, width: 100, height: 100),
],
),
],
),
),
),
);
}
}
Balaji Lanka,CSE UI Design using Flutter

You might also like