Junior — Middle
What types of widgets do you usually use in your projects?
sobes.tech AI
Answer from AI
In Flutter projects, I often use the following standard widgets:
-
Container — a versatile widget for creating rectangular areas with padding, borders, and background.
-
Column and Row — for vertical and horizontal arrangement of child widgets.
-
Text — for displaying text.
-
ListView — for creating scrollable lists.
-
Stack — for overlaying widgets on top of each other.
-
Scaffold — the basic screen layout supporting AppBar, Drawer, and other elements.
-
ElevatedButton — for buttons with a raised effect.
Example of a simple screen with text and a button:
import 'package:flutter/material.dart';
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Example')),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Hello, Flutter!'),
SizedBox(height: 20),
ElevatedButton(
onPressed: () => print('Button pressed'),
child: Text('Press me'),
),
],
),
),
);
}
}