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:
'Geeks For Geeks'
,
theme: ThemeData(
primarySwatch: Colors.green,
),
home: MyHomePage(),
);
}
}
class
MyHomePage extends StatefulWidget {
const
MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class
_MyHomePageState extends State<MyHomePage> {
var currentindex = 0;
void
buttonClicked() {
setState(() {
currentindex = currentindex + 1;
});
print(
"button one"
);
}
@override
Widget build(BuildContext context) {
var questions = [
"Priyanshu is a developer"
,
"You can also become the gfg developer"
,
];
return
Scaffold(
appBar: AppBar(
title: Text(
"Geeks For Geeks"
),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment
.center,
children: [
Text(
questions[
currentindex],
style: TextStyle(fontSize: 30),
),
SizedBox(
height:
40,
),
ElevatedButton(
onPressed: buttonClicked,
child: Text(
"Press Here"
),
),
],
),
),
);
}
}