πBasic Interactivity
1. Handling Button Presses π±οΈ
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
void handlePress() {
print('Button Pressed!');
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Button Example'),
),
body: Center(
child: ElevatedButton(
onPressed: handlePress,
child: Text('Press me'),
),
),
),
);
}
}
2. Handling Text Input π

3. Using Gesture Detectors π
Assignments π
Last updated