Flutter
Flutter
SYBScIT
import 'package:flutter/material.dart';
void main()
{
runApp(MyApp());
}
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.