-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtroverted.dart
More file actions
63 lines (54 loc) · 1.68 KB
/
Copy pathExtroverted.dart
File metadata and controls
63 lines (54 loc) · 1.68 KB
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
import 'package:flutter/material.dart';
import 'package:practice/checkboxState.dart';
import 'package:practice/suggestions.dart';
class Question_1 extends StatefulWidget {
const Question_1({super.key});
@override
State<Question_1> createState() => _Question_1State();
}
class _Question_1State extends State<Question_1> {
bool value = false;
final Extroverted = [
CheckBoxState(title: 'Going Out'),
CheckBoxState(title: 'Restaurants'),
CheckBoxState(title: 'Social Gatherings'),
CheckBoxState(title: 'Shopping'),
CheckBoxState(title: 'Local Spots'),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Preferances', style: TextStyle(fontSize: 18)),
centerTitle: true,
backgroundColor: Colors.amberAccent,
),
body: Container(
child: ListView(
padding: EdgeInsets.all(12),
children: [
...Extroverted.map(buildSingleCheckBox).toList(),
],
),
),
floatingActionButton: FloatingActionButton(
child: const Text('Submit'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Suggestion_1()),
);
},
),
);
}
Widget buildSingleCheckBox(CheckBoxState checkbox) => CheckboxListTile(
controlAffinity: ListTileControlAffinity.leading,
activeColor: Colors.deepOrange,
value: checkbox.value,
title: Text(checkbox.title),
onChanged: (value) => setState(() {
checkbox.value = value!;
}),
);
}