0% found this document useful (0 votes)
4 views

Flutter

Uploaded by

affanshaikh006
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Flutter

Uploaded by

affanshaikh006
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Flutter

SYBScIT
import 'package:flutter/material.dart';
void main()
{
runApp(MyApp());
}

class MyApp extends StatelessWidget


{
@override
Widget build(BuildContext context)
{
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget
{
@override
Widget build(BuildContext context)
{
return Scaffold(
appBar: AppBar(
title: Text("Welcome to Flutter")
),
drawer: Drawer(),

floatingActionButton:
FloatingActionButton
(
child: Icon(Icons.add),
onPressed: ()
{ },
),
body: Container(
child: Column(
children: [
Text("Column 1"),
Text("Column 2"),
],)
)
);
}
}
A state is basically dynamic information that determines how a widget looks and behaves.

•A button’s state could be “enabled” or “disabled,” affecting its appearance and functionality.
•A text field’s state could be the text the user enters, changing what’s displayed.
•A progress bar’s state could be the completion percentage, affecting its length and color.
Stateless widget: Stateful Widget:
Just like a static billboard, Stateless widgets display Stateful widgets are dynamic and can change their behavior
information that doesn’t need to change or update during based on events or user interactions. Stateful widgets have
the app’s runtime. Flutter stateless widgets are built once internal data (their state) that can change, affecting their
and remain unchanged. Stateless widgets are simple, appearance or behavior. Hence, Stateful widgets are perfect
lightweight, and ideal for displaying fixed content like for interactive elements like
text, icons, or simple buttons. •Buttons that change color when pressed
•Forms that update as you type
•Counters that keep track of a score
//This function triggers the build process
•Text fields that update content
class MyApp extends StatelessWidget
•Progress bars that show loading
{
const MyApp({Key? key}) : super(key: key);
// StatefulWidget
class MyApp extends StatefulWidget
{
const MyApp({Key? key}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp>
{
Flutter widgets are the building blocks that
Widgets in Flutter empower developers to create stunning, feature-
rich applications across multiple platforms.

THERE ARE MAINLY TWO TYPES OF WIDGETS IN FLUTTER:


1. Stateless widget 2. Stateful widget
❖ Accessibility
❖ Assets, Images, and Icons
❖ Async
Depending on the two types, ❖ Animation and Motion
we can categorize these widgets into ❖ Basics
14 different categories. ❖ Cupertino widget
❖ Input
❖ Interaction Models
❖ Layout
❖ Material Components
❖ Painting and Effects
❖ Scrolling
❖ Styling
❖ Text

You might also like