- Introduction
- Basics
- App1 : Elon Musk’s Resume
- App2 : 5K Quotes
- App3 : Calculator
- App4_v1 : Flags Quiz
- Running Apps On Different Devices
- Debbuging
- App5 : Yacht Charter
- App6_v1 : My Books
- Creating responsive and adaptive apps
- App6_v2: My Books
- App7 : Short Vacation
- App8 : Movie Time
- App9 : Schedule Planner
- Shared Preferences
- App10 : Local Weather
- App11 : Discover Tunisia
Const Widget
There are several techniques one can use to minimize the impact of rebuilding a stateful widget such as using const widgets where possible. This helps Flutter to rebuild only widgets that should be updated.
Example :
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Test"),
),
body: Column(
children: [
const Text("Text 1"),
Container(
margin: const EdgeInsets.all(20),
color: const Color.fromRGBO(210, 120, 80, 1),
child: const Text("Text 2"),
),
const Padding(
padding: EdgeInsets.all(40),
child: Text("Text 3"),
),
],
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {},
),
);
}
}