Flutter builds UIs from widgets — everything is a widget. You compose small widgets into trees to build complex layouts. Today you will set up Flutter and build a column/row layout from scratch.
# Install Flutter SDK from flutter.dev
flutter doctor # check setup
flutter create my_app
cd my_app
flutter run// lib/main.dart
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
useMaterial3: true,
),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Home')),
body: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Hello Flutter',
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold)),
const SizedBox(height: 12),
Row(
children: [
_chip('Dart'),
const SizedBox(width: 8),
_chip('Material 3'),
],
),
],
),
),
);
}
Widget _chip(String label) => Chip(label: Text(label));
}