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

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter