tuberculosis_prescription.dart 820 B

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:vitalapp/pages/form/form_view.dart';
  4. class TuberculosisPrescription extends StatefulWidget {
  5. @override
  6. State<StatefulWidget> createState() {
  7. return TuberculosisPrescriptionState();
  8. }
  9. }
  10. class TuberculosisPrescriptionState extends State<TuberculosisPrescription> {
  11. String? _template;
  12. @override
  13. void initState() {
  14. var _path = "assets/tuberculosis_prescription.json";
  15. rootBundle.loadString(_path).then((value) {
  16. setState(() {
  17. _template = value;
  18. });
  19. });
  20. super.initState();
  21. }
  22. @override
  23. Widget build(BuildContext context) {
  24. return _template == null
  25. ? Center(
  26. child: CircularProgressIndicator(),
  27. )
  28. : FormView(_template!);
  29. }
  30. }