-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DiagnosticDataRequest class and update ExpertDoctor repository
- Loading branch information
Showing
6 changed files
with
145 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gohealth/api/models/expert_doctor_models.dart'; | ||
import 'package:gohealth/api/repositories/expert_doctor_repository.dart'; | ||
|
||
class Diagnois extends StatefulWidget { | ||
Diagnois({Key? key, required this.array}) : super(key: key); | ||
|
||
final List<String> array; | ||
|
||
@override | ||
_DiagnoisState createState() => _DiagnoisState(); | ||
} | ||
|
||
class _DiagnoisState extends State<Diagnois> { | ||
final ExpertDoctor _expertDoctor = ExpertDoctor(); | ||
late final DiagnosticDataRequest _diagnosticDataRequest; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_fetchSymptoms(); | ||
} | ||
|
||
Future<void> _fetchSymptoms() async { | ||
try { | ||
final result = await _expertDoctor.getDiagnosis(widget.array); | ||
setState(() { | ||
_diagnosticDataRequest = result; | ||
}); | ||
} catch (e) { | ||
_fetchSymptoms(); | ||
rethrow; | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Diagnóstico'), | ||
), | ||
body: _diagnosticDataRequest == null | ||
? const Center( | ||
child: CircularProgressIndicator(), | ||
) | ||
: Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Column( | ||
children: <Widget>[ | ||
Text( | ||
'Diagnóstico: ${_diagnosticDataRequest.title}', | ||
style: const TextStyle(fontSize: 20), | ||
), | ||
const SizedBox(height: 10), | ||
Text( | ||
'Descrição: ${_diagnosticDataRequest.description}', | ||
style: const TextStyle(fontSize: 20), | ||
), | ||
const SizedBox(height: 10), | ||
Text( | ||
'Porcentagem: ${_diagnosticDataRequest.score} / 10', | ||
style: const TextStyle(fontSize: 20), | ||
), | ||
], | ||
), | ||
), | ||
|
||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters