-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
99 lines (86 loc) · 2.63 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import 'package:flutter/material.dart';
import './qustions.dart';
import './answer.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return MyAppState();
}
}
class MyAppState extends State<MyApp> {
var qusIndex = 0;
void answerQus() {
setState(() {
qusIndex = qusIndex + 1;
});
print(qusIndex);
}
@override
Widget build(BuildContext context) {
var qustions = [
'(1) what is your favourite colour ??',
'(2) what is your favourite animal ??',
'(3) what is your favorite hero ??',
];
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true
),
home: Scaffold(
appBar: AppBar(
title: Text('QUIZ APP'),
backgroundColor: Colors.lightBlueAccent,
),
body: Column(
children: <Widget>[
Qustion(qustions.elementAt(qusIndex)),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
),
child: Container(
alignment: Alignment.center,
width: double.infinity,
child: Text('answer 1')),
onPressed: () => answerQus(),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
),
child: Container(
alignment: Alignment.center,
width: double.infinity,
child: Text('answer 2')),
onPressed: () => answerQus(),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
),
child: Container(
alignment: Alignment.center,
width: double.infinity,
child: Text('answer 2')),
onPressed: () => answerQus(),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
),
child: Container(
alignment: Alignment.center,
width: double.infinity,
child: Text('answer 2')),
onPressed: () => answerQus(),
),
],
),
),
);
}
}