import
'package:flutter/material.dart'
;
void
main() => runApp(MyApp());
class
MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final title =
'GeeksForGeeks'
;
return
MaterialApp(
title: title,
home: MyHomePage(title: title),
);
}
}
class
MyHomePage extends StatelessWidget {
final String title;
MyHomePage({Key key,
this
.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return
Scaffold(
appBar: AppBar(
title: Text(title),
backgroundColor: Colors.green,
),
body: Center(child: MyButton()),
);
}
}
class
MyButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return
InkWell(
onTap: () {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(
'Hello Geeks!'
),
));
},
child: Container(
padding: EdgeInsets.all(12.0),
color: Colors.green,
child: Text(
' Button'
),
),
);
}
}