Handling Gestures
import "package:flutter/material.dart";
void main() {
runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyButton(),
),
),
),
);
}
class MyButton extends StatelessWidget {
const MyButton({super.key});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
print("MyButton was Tapped!");
},
child: Container(
height: 50.0,
padding: const EdgeInsets.all(8.0,),
margin: const EdgeInsets.symmetric(horizontal: 8.0,),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0,),
color: Colors.lightGreen[500],
),
child: const Center(
child: Text("Engage"),
),
),
);
}
}
Comments
Post a Comment