import
'package:flutter/material.dart'
;
void
main() {
runApp(
const
MyApp());
}
class
MyApp extends StatelessWidget {
const
MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return
MaterialApp(
title:
'Raised Button'
,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home:
const
MyHomePage(),
debugShowCheckedModeBanner:
false
,
);
}
}
class
MyHomePage extends StatefulWidget {
const
MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class
_MyHomePageState extends State<MyHomePage> {
String istapped =
''
;
@override
Widget build(BuildContext context) {
return
Scaffold(
appBar: AppBar(
title:
const
Text(
'GeeksforGeeks'
),
backgroundColor: Colors.green,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
padding:
const
EdgeInsets.all(20),
textColor: Colors.white,
color: Colors.green,
onPressed: () {
setState(() {
istapped =
'Button tapped'
;
});
},
child:
const
Text(
'Enabled Button'
),
),
const
SizedBox(
height: 20,
),
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.green),
padding:
MaterialStateProperty.all(
const
EdgeInsets.all(20)),
textStyle: MaterialStateProperty.all(
const
TextStyle(fontSize: 14, color: Colors.white))),
onPressed: () {
setState(() {
istapped =
'Button tapped'
;
});
},
child:
const
Text(
'Enabled Button'
)),
const
SizedBox(height: 20),
Text(
istapped,
textScaleFactor: 2,
)
],
),
),
backgroundColor: Colors.lightBlue[50],
);
}
}