0% found this document useful (0 votes)
13 views3 pages

Flutter 2a ND 2b

Uploaded by

kaartheeka18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Flutter 2a ND 2b

Uploaded by

kaartheeka18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2b

import 'package:flutter/material.dart';

void main() {

runApp(MaterialApp(home: MyApp()));

class MyApp extends StatelessWidget {

@override

Widget build(BuildContext context) {

return DefaultTabController(

length: 3,

child: Scaffold(

appBar: AppBar(

title: Text('Layouts'),

bottom: TabBar(tabs: [Tab(text: 'Row'), Tab(text: 'Column'), Tab(text: 'Stack')]),

),

body: TabBarView(

children: [

Row(

mainAxisAlignment: MainAxisAlignment.spaceEvenly,

children: layoutContainers(),

),

Column(

mainAxisAlignment: MainAxisAlignment.spaceEvenly,

children: layoutContainers(),

),

Stack(

alignment: Alignment.center,

children: layoutContainers(sizeOffset: 50),


),

],

),

),

);

List<Widget> layoutContainers({int sizeOffset = 0}) {

return [

Container(color: Colors.red, width: 100 + sizeOffset.toDouble(), height: 100 +


sizeOffset.toDouble()),

Container(color: Colors.green, width: 75 + sizeOffset.toDouble(), height: 75 +


sizeOffset.toDouble()),

Container(color: Colors.blue, width: 50 + sizeOffset.toDouble(), height: 50 +


sizeOffset.toDouble()),

];

2a
Example 1: Text Widget

// main.dart

import 'package:flutter/material.dart';

void main() {

runApp(const HelloWorldApp());

class HelloWorldApp extends StatelessWidget {

const HelloWorldApp({Key? key}) : super(key: key);

UI DESIGN-FLUTTER LAB – AY – 2024-25 B.Tech IV Year I Semester - IT- A & B

Prepared by: G SUDHAKAR RAJU Page 4 of 13

@override

Widget build(BuildContext context) {


return MaterialApp(

home: Scaffold(

appBar: AppBar(

title: const Text('Hello World App'),

),

body : const Center(

child: Text('Hello, World!!!'),

),

);

You might also like