Commit 7586ce3b authored by Uditha Prabhasha 's avatar Uditha Prabhasha

Update kidsReport.dart

parent 45c024a8
...@@ -15,17 +15,60 @@ class _KidsReportPageState extends State<KidsReportPage> { ...@@ -15,17 +15,60 @@ class _KidsReportPageState extends State<KidsReportPage> {
String id; String id;
_KidsReportPageState({required this.id}); _KidsReportPageState({required this.id});
List<String> dropdownValues = ['1', '2', '3', '4', '5']; List<String> dropdownValues = ['Select', '1', '2', '3', '4', '5'];
Map<String, String?> dropdownMap = { Map<String, String?> understandingDropdownMap = {
'Understanding commands': null, 'Understanding commands': 'Select',
'Answer questions': null, 'Answer questions': 'Select',
'Keeping eye contact.': null, 'Keeping eye contact': 'Select',
'Following rules.': null, 'Following rules': 'Select',
'Motor activities': null, };
'Correct posture': null,
'Can build/create new things': null, Map<String, String?> movementsDropdownMap = {
'Knows how to handle accessories': null, 'Motor activities': 'Select',
'Correct posture': 'Select',
};
Map<String, String?> manipulatingDropdownMap = {
'Can build/create new things': 'Select',
'Knows how to handle accessories': 'Select',
};
Map<String, String?> socializingDropdownMap = {
'Play with groups': 'Select',
'Help each other': 'Select',
'Friendly towards peers': 'Select',
'Close to teacher': 'Select',
};
Map<String, String?> speechDropdownMap = {
'Communicate well': 'Select',
'Like singing': 'Select',
};
Map<String, String?> recognitionDropdownMap = {
'Can express with pictures and words': 'Select',
'Identify shapes': 'Select',
'Knows Primary colors. s': 'Select',
'Identify basic objects in the environment': 'Select',
};
Map<String, String?> habitsDropdownMap = {
'Organized': 'Select',
'Have good eating habits': 'Select',
'Taking care of own needs': 'Select',
};
Map<String, String?> personalHygieneDropdownMap = {
'Stay clean': 'Select',
'Keep the workplace and environment clean': 'Select',
};
Map<String, String?> personalityDropdownMap = {
'Act according to the situation': 'Select',
'Finish allocated work': 'Select',
'More active': 'Select',
'Less active': 'Select',
}; };
final _formkey = GlobalKey<FormState>(); final _formkey = GlobalKey<FormState>();
...@@ -44,45 +87,54 @@ class _KidsReportPageState extends State<KidsReportPage> { ...@@ -44,45 +87,54 @@ class _KidsReportPageState extends State<KidsReportPage> {
child: Form( child: Form(
key: _formkey, key: _formkey,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Table(
columnWidths: {
0: FlexColumnWidth(3),
1: FlexColumnWidth(1),
},
children: dropdownMap.keys.map((String key) {
return TableRow(
children: [ children: [
Padding( SizedBox(height: 20),
padding: const EdgeInsets.all(8.0), _buildDropdownSection(
child: Text(key), title: 'Understanding',
dropdownMap: understandingDropdownMap,
), ),
Padding( SizedBox(height: 20),
padding: const EdgeInsets.all(8.0), _buildDropdownSection(
child: DropdownButtonFormField<String>( title: 'Movements',
value: dropdownMap[key], dropdownMap: movementsDropdownMap,
items: dropdownValues.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (String? value) {
setState(() {
dropdownMap[key] = value;
});
},
), ),
SizedBox(height: 20),
_buildDropdownSection(
title: 'Manipulating',
dropdownMap: manipulatingDropdownMap,
), ),
], SizedBox(height: 20),
); _buildDropdownSection(
}).toList(), title: 'Socializing',
dropdownMap: socializingDropdownMap,
),
SizedBox(height: 20),
_buildDropdownSection(
title: 'Speech',
dropdownMap: speechDropdownMap,
),
SizedBox(height: 20),
_buildDropdownSection(
title: 'Recognition',
dropdownMap: recognitionDropdownMap,
),
SizedBox(height: 20),
_buildDropdownSection(
title: 'Habits',
dropdownMap: habitsDropdownMap,
),
SizedBox(height: 20),
_buildDropdownSection(
title: 'Personal Hygiene',
dropdownMap: personalHygieneDropdownMap,
),
SizedBox(height: 20),
_buildDropdownSection(
title: 'Personality',
dropdownMap: personalityDropdownMap,
), ),
SizedBox(height: 20), SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
if (_formkey.currentState!.validate()) { if (_formkey.currentState!.validate()) {
...@@ -91,22 +143,86 @@ class _KidsReportPageState extends State<KidsReportPage> { ...@@ -91,22 +143,86 @@ class _KidsReportPageState extends State<KidsReportPage> {
}, },
child: Text('Save'), child: Text('Save'),
), ),
SizedBox(width: 15), SizedBox(height: 10),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
child: Text('Cancel'), child: Text('Cancel'),
), ),
SizedBox(height: 20),
], ],
), ),
],
), ),
), ),
), ),
), ),
);
}
Widget _buildDropdownSection({
required String title,
required Map<String, String?> dropdownMap,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
title,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10),
...dropdownMap.keys.map((String key) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Row(
children: [
Expanded(
flex: 3,
child: Text(
key,
style: TextStyle(fontSize: 16),
),
),
Expanded(
flex: 1,
child: Container(
width: 100, // Adjust the width as needed
child: DropdownButton<String>(
value: dropdownMap[key],
icon: Icon(Icons.arrow_drop_down),
iconSize: 24,
elevation: 16,
style: TextStyle(color: Colors.black),
underline: Container(
height: 1,
color: Colors.green,
),
onChanged: (String? value) {
setState(() {
dropdownMap[key] = value;
});
},
items: dropdownValues.map<DropdownMenuItem<String>>(
(String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
},
).toList(),
),
),
),
],
), ),
); );
}).toList(),
],
);
} }
postDetailsToFirestore(context) async { postDetailsToFirestore(context) async {
...@@ -118,7 +234,31 @@ class _KidsReportPageState extends State<KidsReportPage> { ...@@ -118,7 +234,31 @@ class _KidsReportPageState extends State<KidsReportPage> {
// Constructing the data to be saved // Constructing the data to be saved
Map<String, dynamic> data = {}; Map<String, dynamic> data = {};
dropdownMap.forEach((key, value) { understandingDropdownMap.forEach((key, value) {
data[key] = value;
});
movementsDropdownMap.forEach((key, value) {
data[key] = value;
});
manipulatingDropdownMap.forEach((key, value) {
data[key] = value;
});
socializingDropdownMap.forEach((key, value) {
data[key] = value;
});
speechDropdownMap.forEach((key, value) {
data[key] = value;
});
recognitionDropdownMap.forEach((key, value) {
data[key] = value;
});
habitsDropdownMap.forEach((key, value) {
data[key] = value;
});
personalHygieneDropdownMap.forEach((key, value) {
data[key] = value;
});
personalityDropdownMap.forEach((key, value) {
data[key] = value; data[key] = value;
}); });
data['sId'] = id; data['sId'] = id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment