InkWell Widget
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: "Hello Flutter",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.amber,
),
home: const FlutterApp(),
);
}
}
class FlutterApp extends StatelessWidget {
const FlutterApp({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(
"Welcome!",
style: TextStyle(fontWeight: FontWeight.bold),
),
centerTitle: true,
backgroundColor: Colors.grey,
),
/*body: Container(
child: ElevatedButton(
child: const Text("Click Here!"),
onPressed: (){
print("Elevated Button clicked!");
},
),
),*/
body: Center(
child: InkWell(
onTap: () {
print("Tapped on Container");
},
onLongPress: () {
print("Long Pressed on Container");
},
onDoubleTap: () {
print("Double Tapped on Container");
},
child: Container(
width: 200,
height: 200,
color: Colors.indigo,
child: InkWell(
onTap: () {
print("Text Widget Tapped!");
},
child: const Center(
//child: Colors.amber,
child: Text(
"Click Here!",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w700,
color: Colors.white),
),
),
),
),
),
),
);
}
}
Comments
Post a Comment