resultado.dart 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  1. import 'dart:convert';
  2. import 'dart:io';
  3. import 'dart:typed_data';
  4. import 'package:flutter/material.dart';
  5. import 'package:fluttertoast/fluttertoast.dart';
  6. import 'package:google_fonts/google_fonts.dart';
  7. import 'package:path_provider/path_provider.dart';
  8. import '../../src/pages/pdf_viewer.dart';
  9. import '../models/info_calculadora.dart';
  10. import '../providers/archivos_provider.dart';
  11. class ResultadoPage extends StatefulWidget {
  12. final List<String> frecuencias;
  13. final Map<String, double> arrLwFinal;
  14. final double sumaLogaritmicaLwFinal;
  15. final Map<String, double> arrLwA;
  16. final double sumaLogaritmicaLwA;
  17. final double presionSonora;
  18. final Map<String, double> arrSumaLog;
  19. final double sumaLogaritmicaLwFinalVa;
  20. final Map<String, double> arrEspectroResultante;
  21. final double sumaLogaritmicaLwAVa;
  22. final double presionSonoraVa;
  23. final Atenuacion arrAtenuador;
  24. final Map<String, String> arrDatosEntrada;
  25. final Map<String, String> arrConversiones;
  26. const ResultadoPage({
  27. Key? key,
  28. required this.frecuencias,
  29. required this.arrLwFinal,
  30. required this.sumaLogaritmicaLwFinal,
  31. required this.arrLwA,
  32. required this.sumaLogaritmicaLwA,
  33. required this.presionSonora,
  34. required this.arrSumaLog,
  35. required this.sumaLogaritmicaLwFinalVa,
  36. required this.arrEspectroResultante,
  37. required this.sumaLogaritmicaLwAVa,
  38. required this.presionSonoraVa,
  39. required this.arrAtenuador,
  40. required this.arrDatosEntrada,
  41. required this.arrConversiones,
  42. }) : super(key: key);
  43. @override
  44. State<ResultadoPage> createState() => _ResultadoPageState();
  45. }
  46. class _ResultadoPageState extends State<ResultadoPage> {
  47. final _archivosProvider = ArchivosProvider();
  48. int _decimales = 2;
  49. bool _firstState = true;
  50. late Row _headerFrecuenciasF;
  51. late Row _valuesFrecuenciasF;
  52. late Row _headerFrecuenciasS;
  53. late Row _valuesFrecuenciasS;
  54. late Row _valuesFrecuenciasT;
  55. late Row _valuesFrecuenciasC;
  56. late Row _datosAtenuadorSelec;
  57. String _jsonInfo = '';
  58. void _initTable(List<String> frecuencias, Map<String, double> arrLwFinal, double sumaLogaritmicaLwFinal,
  59. Map<String, double> arrLwA, double sumaLogaritmicaLwA, Map<String, double> arrSumaLog,
  60. double sumaLogaritmicaLwAtenuado, Map<String, double> arrEspectroResultante, double sumaLogaritmicaLwAVa,
  61. Atenuacion arrAtenuador){
  62. setState(() {
  63. _firstState = false;
  64. List<Widget> headerFrecuenciasF = [];
  65. List<Widget> valuesFrecuenciasF = [];
  66. List<Widget> headerFrecuenciasS = [];
  67. List<Widget> valuesFrecuenciasS = [];
  68. List<Widget> valuesFrecuenciasT = [];
  69. List<Widget> valuesFrecuenciasC = [];
  70. List<Widget> datosAtenuadorSelec = [];
  71. for(int i = 0; i < frecuencias.length; i++){
  72. headerFrecuenciasF.add(Container(
  73. decoration: BoxDecoration(
  74. border: Border(
  75. left: BorderSide(
  76. color: Color(0xFFDDDDDD),
  77. width: i == 0 ? 2.0 : 1.0
  78. ),
  79. right: BorderSide(
  80. color: Color(0xFFDDDDDD),
  81. width: 1.0
  82. ),
  83. bottom: BorderSide(
  84. color: Color(0xFFDDDDDD),
  85. width: 1.0
  86. )
  87. )
  88. ),
  89. child: Text(
  90. frecuencias[i],
  91. textAlign: TextAlign.center,
  92. style: GoogleFonts.roboto(
  93. color: Color(0xFF333333),
  94. fontWeight: FontWeight.bold,
  95. fontSize: 24.0
  96. ),
  97. ),
  98. padding: EdgeInsets.all(16.0),
  99. width: 150.0,
  100. ));
  101. valuesFrecuenciasF.add(Container(
  102. decoration: BoxDecoration(
  103. border: Border(
  104. left: BorderSide(
  105. color: Color(0xFFDDDDDD),
  106. width: i == 0 ? 2.0 : 1.0
  107. ),
  108. right: BorderSide(
  109. color: Color(0xFFDDDDDD),
  110. width: 1.0
  111. ),
  112. top: BorderSide(
  113. color: Color(0xFFDDDDDD),
  114. width: 1.0
  115. )
  116. )
  117. ),
  118. child: Text(
  119. arrLwFinal[frecuencias[i]]!.toStringAsFixed(_decimales),
  120. textAlign: TextAlign.center,
  121. style: GoogleFonts.roboto(
  122. color: Color(0xFF666666),
  123. fontSize: 20.0
  124. ),
  125. ),
  126. padding: EdgeInsets.all(16.0),
  127. width: 150.0,
  128. ));
  129. headerFrecuenciasS.add(Container(
  130. decoration: BoxDecoration(
  131. border: Border(
  132. left: BorderSide(
  133. color: Color(0xFFDDDDDD),
  134. width: i == 0 ? 2.0 : 1.0
  135. ),
  136. right: BorderSide(
  137. color: Color(0xFFDDDDDD),
  138. width: 1.0
  139. ),
  140. bottom: BorderSide(
  141. color: Color(0xFFDDDDDD),
  142. width: 1.0
  143. )
  144. )
  145. ),
  146. child: Text(
  147. frecuencias[i],
  148. textAlign: TextAlign.center,
  149. style: GoogleFonts.roboto(
  150. color: Color(0xFF333333),
  151. fontWeight: FontWeight.bold,
  152. fontSize: 24.0
  153. ),
  154. ),
  155. padding: EdgeInsets.all(16.0),
  156. width: 150.0,
  157. ));
  158. valuesFrecuenciasS.add(Container(
  159. decoration: BoxDecoration(
  160. border: Border(
  161. left: BorderSide(
  162. color: Color(0xFFDDDDDD),
  163. width: i == 0 ? 2.0 : 1.0
  164. ),
  165. right: BorderSide(
  166. color: Color(0xFFDDDDDD),
  167. width: 1.0
  168. ),
  169. top: BorderSide(
  170. color: Color(0xFFDDDDDD),
  171. width: 1.0
  172. )
  173. )
  174. ),
  175. child: Text(
  176. arrLwA[frecuencias[i]]!.toStringAsFixed(_decimales),
  177. textAlign: TextAlign.center,
  178. style: GoogleFonts.roboto(
  179. color: Color(0xFF666666),
  180. fontSize: 20.0
  181. ),
  182. ),
  183. padding: EdgeInsets.all(16.0),
  184. width: 150.0,
  185. ));
  186. valuesFrecuenciasT.add(Container(
  187. decoration: BoxDecoration(
  188. border: Border(
  189. left: BorderSide(
  190. color: Color(0xFFDDDDDD),
  191. width: i == 0 ? 2.0 : 1.0
  192. ),
  193. right: BorderSide(
  194. color: Color(0xFFDDDDDD),
  195. width: 1.0
  196. ),
  197. top: BorderSide(
  198. color: Color(0xFFDDDDDD),
  199. width: 1.0
  200. )
  201. )
  202. ),
  203. child: Text(
  204. arrSumaLog[frecuencias[i]]!.toStringAsFixed(_decimales),
  205. textAlign: TextAlign.center,
  206. style: GoogleFonts.roboto(
  207. color: Color(0xFF666666),
  208. fontSize: 20.0
  209. ),
  210. ),
  211. padding: EdgeInsets.all(16.0),
  212. width: 150.0,
  213. ));
  214. valuesFrecuenciasC.add(Container(
  215. decoration: BoxDecoration(
  216. border: Border(
  217. left: BorderSide(
  218. color: Color(0xFFDDDDDD),
  219. width: i == 0 ? 2.0 : 1.0
  220. ),
  221. right: BorderSide(
  222. color: Color(0xFFDDDDDD),
  223. width: 1.0
  224. ),
  225. top: BorderSide(
  226. color: Color(0xFFDDDDDD),
  227. width: 1.0
  228. )
  229. )
  230. ),
  231. child: Text(
  232. arrEspectroResultante[frecuencias[i]]!.toStringAsFixed(_decimales),
  233. textAlign: TextAlign.center,
  234. style: GoogleFonts.roboto(
  235. color: Color(0xFF666666),
  236. fontSize: 20.0
  237. ),
  238. ),
  239. padding: EdgeInsets.all(16.0),
  240. width: 150.0,
  241. ));
  242. }
  243. headerFrecuenciasF.add(Container(
  244. decoration: BoxDecoration(
  245. border: Border(
  246. left: BorderSide(
  247. color: Color(0xFFDDDDDD),
  248. width: 1.0
  249. ),
  250. right: BorderSide(
  251. color: Color(0xFFDDDDDD),
  252. width: 2.0
  253. ),
  254. bottom: BorderSide(
  255. color: Color(0xFFDDDDDD),
  256. width: 1.0
  257. )
  258. )
  259. ),
  260. child: Text(
  261. 'Lw (dB)',
  262. textAlign: TextAlign.center,
  263. style: GoogleFonts.roboto(
  264. color: Color(0xFF333333),
  265. fontWeight: FontWeight.bold,
  266. fontSize: 24.0
  267. ),
  268. ),
  269. padding: EdgeInsets.all(16.0),
  270. width: 150.0,
  271. ));
  272. valuesFrecuenciasF.add(Container(
  273. decoration: BoxDecoration(
  274. border: Border(
  275. left: BorderSide(
  276. color: Color(0xFFDDDDDD),
  277. width: 1.0
  278. ),
  279. right: BorderSide(
  280. color: Color(0xFFDDDDDD),
  281. width: 2.0
  282. ),
  283. top: BorderSide(
  284. color: Color(0xFFDDDDDD),
  285. width: 1.0
  286. )
  287. )
  288. ),
  289. child: Text(
  290. sumaLogaritmicaLwFinal.toStringAsFixed(_decimales),
  291. textAlign: TextAlign.center,
  292. style: GoogleFonts.roboto(
  293. color: Color(0xFF666666),
  294. fontSize: 20.0
  295. ),
  296. ),
  297. padding: EdgeInsets.all(16.0),
  298. width: 150.0,
  299. ));
  300. headerFrecuenciasS.add(Container(
  301. decoration: BoxDecoration(
  302. border: Border(
  303. left: BorderSide(
  304. color: Color(0xFFDDDDDD),
  305. width: 1.0
  306. ),
  307. right: BorderSide(
  308. color: Color(0xFFDDDDDD),
  309. width: 2.0
  310. ),
  311. bottom: BorderSide(
  312. color: Color(0xFFDDDDDD),
  313. width: 1.0
  314. )
  315. )
  316. ),
  317. child: Text(
  318. 'Lw (dBA)',
  319. textAlign: TextAlign.center,
  320. style: GoogleFonts.roboto(
  321. color: Color(0xFF333333),
  322. fontWeight: FontWeight.bold,
  323. fontSize: 24.0
  324. ),
  325. ),
  326. padding: EdgeInsets.all(16.0),
  327. width: 150.0,
  328. ));
  329. valuesFrecuenciasS.add(Container(
  330. decoration: BoxDecoration(
  331. border: Border(
  332. left: BorderSide(
  333. color: Color(0xFFDDDDDD),
  334. width: 1.0
  335. ),
  336. right: BorderSide(
  337. color: Color(0xFFDDDDDD),
  338. width: 2.0
  339. ),
  340. top: BorderSide(
  341. color: Color(0xFFDDDDDD),
  342. width: 1.0
  343. )
  344. )
  345. ),
  346. child: Text(
  347. sumaLogaritmicaLwA.toStringAsFixed(_decimales),
  348. textAlign: TextAlign.center,
  349. style: GoogleFonts.roboto(
  350. color: Color(0xFF666666),
  351. fontSize: 20.0
  352. ),
  353. ),
  354. padding: EdgeInsets.all(16.0),
  355. width: 150.0,
  356. ));
  357. valuesFrecuenciasT.add(Container(
  358. decoration: BoxDecoration(
  359. border: Border(
  360. left: BorderSide(
  361. color: Color(0xFFDDDDDD),
  362. width: 1.0
  363. ),
  364. right: BorderSide(
  365. color: Color(0xFFDDDDDD),
  366. width: 2.0
  367. ),
  368. top: BorderSide(
  369. color: Color(0xFFDDDDDD),
  370. width: 1.0
  371. )
  372. )
  373. ),
  374. child: Text(
  375. sumaLogaritmicaLwAtenuado.toStringAsFixed(_decimales),
  376. textAlign: TextAlign.center,
  377. style: GoogleFonts.roboto(
  378. color: Color(0xFF666666),
  379. fontSize: 20.0
  380. ),
  381. ),
  382. padding: EdgeInsets.all(16.0),
  383. width: 150.0,
  384. ));
  385. valuesFrecuenciasC.add(Container(
  386. decoration: BoxDecoration(
  387. border: Border(
  388. left: BorderSide(
  389. color: Color(0xFFDDDDDD),
  390. width: 1.0
  391. ),
  392. right: BorderSide(
  393. color: Color(0xFFDDDDDD),
  394. width: 2.0
  395. ),
  396. top: BorderSide(
  397. color: Color(0xFFDDDDDD),
  398. width: 1.0
  399. )
  400. )
  401. ),
  402. child: Text(
  403. sumaLogaritmicaLwAVa.toStringAsFixed(_decimales),
  404. textAlign: TextAlign.center,
  405. style: GoogleFonts.roboto(
  406. color: Color(0xFF666666),
  407. fontSize: 20.0
  408. ),
  409. ),
  410. padding: EdgeInsets.all(16.0),
  411. width: 150.0,
  412. ));
  413. datosAtenuadorSelec.add(Container(
  414. decoration: BoxDecoration(
  415. border: Border(
  416. left: BorderSide(
  417. color: Color(0xFFDDDDDD),
  418. width: 2.0
  419. ),
  420. right: BorderSide(
  421. color: Color(0xFFDDDDDD),
  422. width: 1.0
  423. ),
  424. bottom: BorderSide(
  425. color: Color(0xFFDDDDDD),
  426. width: 2.0
  427. )
  428. )
  429. ),
  430. width: 450.0,
  431. padding: EdgeInsets.all(16.0),
  432. child: Text(
  433. 'Modelo',
  434. textAlign: TextAlign.center,
  435. style: GoogleFonts.roboto(
  436. color: Color(0xFF666666),
  437. fontSize: 20.0
  438. ),
  439. ),
  440. ));
  441. datosAtenuadorSelec.add(Container(
  442. decoration: BoxDecoration(
  443. border: Border(
  444. left: BorderSide(
  445. color: Color(0xFFDDDDDD),
  446. width: 1.0
  447. ),
  448. right: BorderSide(
  449. color: Color(0xFFDDDDDD),
  450. width: 1.0
  451. ),
  452. bottom: BorderSide(
  453. color: Color(0xFFDDDDDD),
  454. width: 2.0
  455. )
  456. )
  457. ),
  458. width: 300.0,
  459. padding: EdgeInsets.all(16.0),
  460. child: Text(
  461. arrAtenuador.modelo!,
  462. textAlign: TextAlign.center,
  463. style: GoogleFonts.roboto(
  464. color: Color(0xFF666666),
  465. fontSize: 20.0
  466. ),
  467. ),
  468. ));
  469. datosAtenuadorSelec.add(Container(
  470. decoration: BoxDecoration(
  471. border: Border(
  472. left: BorderSide(
  473. color: Color(0xFFDDDDDD),
  474. width: 1.0
  475. ),
  476. right: BorderSide(
  477. color: Color(0xFFDDDDDD),
  478. width: 1.0
  479. ),
  480. bottom: BorderSide(
  481. color: Color(0xFFDDDDDD),
  482. width: 2.0
  483. )
  484. )
  485. ),
  486. width: 450.0,
  487. padding: EdgeInsets.all(16.0),
  488. child: Text(
  489. 'Longitud del atenuador',
  490. textAlign: TextAlign.center,
  491. style: GoogleFonts.roboto(
  492. color: Color(0xFF666666),
  493. fontSize: 20.0
  494. ),
  495. ),
  496. ));
  497. datosAtenuadorSelec.add(Container(
  498. decoration: BoxDecoration(
  499. border: Border(
  500. left: BorderSide(
  501. color: Color(0xFFDDDDDD),
  502. width: 1.0
  503. ),
  504. right: BorderSide(
  505. color: Color(0xFFDDDDDD),
  506. width: 2.0
  507. ),
  508. bottom: BorderSide(
  509. color: Color(0xFFDDDDDD),
  510. width: 2.0
  511. )
  512. )
  513. ),
  514. width: 150.0,
  515. padding: EdgeInsets.all(16.0),
  516. child: Text(
  517. arrAtenuador.longitud!,
  518. textAlign: TextAlign.center,
  519. style: GoogleFonts.roboto(
  520. color: Color(0xFF666666),
  521. fontSize: 20.0
  522. ),
  523. ),
  524. ));
  525. _headerFrecuenciasF = Row(
  526. children: headerFrecuenciasF,
  527. );
  528. _valuesFrecuenciasF = Row(
  529. children: valuesFrecuenciasF,
  530. );
  531. _headerFrecuenciasS = Row(
  532. children: headerFrecuenciasS,
  533. );
  534. _valuesFrecuenciasS = Row(
  535. children: valuesFrecuenciasS,
  536. );
  537. _valuesFrecuenciasT = Row(
  538. children: valuesFrecuenciasT,
  539. );
  540. _valuesFrecuenciasC = Row(
  541. children: valuesFrecuenciasC,
  542. );
  543. _datosAtenuadorSelec = Row(
  544. children: datosAtenuadorSelec,
  545. );
  546. });
  547. }
  548. void showViewer(File document) {
  549. Navigator.of(context).push(MaterialPageRoute(
  550. builder: (context) => PDFViewer(
  551. localFile: true,
  552. file: document,
  553. )
  554. ));
  555. }
  556. @override
  557. Widget build(BuildContext context) {
  558. if(_firstState){
  559. _initTable(widget.frecuencias, widget.arrLwFinal, widget.sumaLogaritmicaLwFinal,
  560. widget.arrLwA, widget.sumaLogaritmicaLwA, widget.arrSumaLog, widget.sumaLogaritmicaLwFinalVa,
  561. widget.arrEspectroResultante, widget.sumaLogaritmicaLwAVa, widget.arrAtenuador);
  562. _jsonInfo += '{"arrDatosDeEntrada":' + jsonEncode(widget.arrDatosEntrada) + ',';
  563. _jsonInfo += '"arrConversiones":' + jsonEncode(widget.arrConversiones) + ',';
  564. _jsonInfo += '"frecuencias":' + jsonEncode(widget.frecuencias) + ',';
  565. _jsonInfo += '"arrLwFinal":' + jsonEncode(widget.arrLwFinal) + ',';
  566. _jsonInfo += '"sumaLogaritmicaLwFinal":' + widget.sumaLogaritmicaLwFinal.toString() + ',';
  567. _jsonInfo += '"arrLwA":' + jsonEncode(widget.arrLwA) + ',';
  568. _jsonInfo += '"sumaLogaritmicaLwA":' + widget.sumaLogaritmicaLwA.toString() + ',';
  569. _jsonInfo += '"presionSonora":' + widget.presionSonora.toString() + ',';
  570. _jsonInfo += '"arrSumaLog":' + jsonEncode(widget.arrSumaLog) + ',';
  571. _jsonInfo += '"sumaLogaritmicaLwFinalVa":' + widget.sumaLogaritmicaLwFinalVa.toString() + ',';
  572. _jsonInfo += '"arrEspectroResultante":' + jsonEncode(widget.arrEspectroResultante) + ',';
  573. _jsonInfo += '"sumaLogaritmicaLwAVa":' + widget.sumaLogaritmicaLwAVa.toString() + ',';
  574. _jsonInfo += '"presionSonoraVa":' + widget.presionSonoraVa.toString() + ',';
  575. _jsonInfo += '"modelo":"' + widget.arrAtenuador.modelo! + '",';
  576. _jsonInfo += '"longitud":' + widget.arrAtenuador.longitud! + '}';
  577. _jsonInfo = _jsonInfo.replaceAll('##', '%%');
  578. _jsonInfo = base64Encode(utf8.encode(_jsonInfo));
  579. }
  580. return Scaffold(
  581. appBar: AppBar(
  582. actions: [
  583. IconButton(
  584. icon: Icon(
  585. Icons.picture_as_pdf,
  586. color: Colors.white,
  587. ),
  588. onPressed: (){
  589. Fluttertoast.showToast(
  590. msg: 'Abriendo PDF...',
  591. toastLength: Toast.LENGTH_LONG,
  592. gravity: ToastGravity.CENTER,
  593. timeInSecForIosWeb: 1
  594. );
  595. _archivosProvider.fetchAtenuador(_jsonInfo).then((archivo){
  596. _createFileFromString(archivo.data!, archivo.name!).then((name){
  597. print("==DIRECTORIO: ${name.path}===");
  598. showViewer(name);
  599. });
  600. });
  601. },
  602. )
  603. ],
  604. ),
  605. body: SafeArea(
  606. child: SingleChildScrollView(
  607. child: SingleChildScrollView(
  608. scrollDirection: Axis.horizontal,
  609. child: Column(
  610. children: [
  611. Container(
  612. width: 1350.0,
  613. child: Text(
  614. 'Espectro de Potencia Sonora Ventilador Lw',
  615. textAlign: TextAlign.center,
  616. style: GoogleFonts.roboto(
  617. color: Color(0xFF333333),
  618. fontSize: 24.0,
  619. fontWeight: FontWeight.bold
  620. ),
  621. ),
  622. margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0),
  623. padding: EdgeInsets.all(16.0),
  624. decoration: BoxDecoration(
  625. border: Border.all(
  626. color: Color(0xFFDDDDDD),
  627. width: 2.0
  628. )
  629. ),
  630. ),
  631. _headerFrecuenciasF,
  632. _valuesFrecuenciasF,
  633. Container(
  634. width: 1350.0,
  635. child: Text(
  636. 'Espectro de Potencia Sonora Ventilador Ponderación A Lw(A)',
  637. textAlign: TextAlign.center,
  638. style: GoogleFonts.roboto(
  639. color: Color(0xFF333333),
  640. fontSize: 24.0,
  641. fontWeight: FontWeight.bold
  642. ),
  643. ),
  644. margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
  645. padding: EdgeInsets.all(16.0),
  646. decoration: BoxDecoration(
  647. border: Border.all(
  648. color: Color(0xFFDDDDDD),
  649. width: 2.0
  650. )
  651. ),
  652. ),
  653. _headerFrecuenciasS,
  654. _valuesFrecuenciasS,
  655. Row(
  656. children: [
  657. Container(
  658. padding: EdgeInsets.all(16.0),
  659. decoration: BoxDecoration(
  660. border: Border(
  661. left: BorderSide(
  662. color: Color(0xFFDDDDDD),
  663. width: 2.0
  664. ),
  665. top: BorderSide(
  666. color: Color(0xFFDDDDDD),
  667. width: 2.0
  668. ),
  669. right: BorderSide(
  670. color: Color(0xFFDDDDDD),
  671. width: 1.0
  672. )
  673. )
  674. ),
  675. width: 450.0,
  676. child: Text(
  677. 'Presión Sonora',
  678. textAlign: TextAlign.center,
  679. style: GoogleFonts.roboto(
  680. color: Color(0xFF333333),
  681. fontSize: 24.0,
  682. fontWeight: FontWeight.bold
  683. ),
  684. ),
  685. ),
  686. Container(
  687. padding: EdgeInsets.all(16.0),
  688. decoration: BoxDecoration(
  689. border: Border(
  690. left: BorderSide(
  691. color: Color(0xFFDDDDDD),
  692. width: 1.0
  693. ),
  694. top: BorderSide(
  695. color: Color(0xFFDDDDDD),
  696. width: 2.0
  697. ),
  698. right: BorderSide(
  699. color: Color(0xFFDDDDDD),
  700. width: 2.0
  701. )
  702. )
  703. ),
  704. width: 900.0,
  705. child: Text(
  706. widget.presionSonora.toStringAsFixed(_decimales),
  707. textAlign: TextAlign.center,
  708. style: GoogleFonts.roboto(
  709. color: Color(0xFF333333),
  710. fontSize: 24.0,
  711. fontWeight: FontWeight.bold
  712. ),
  713. ),
  714. )
  715. ],
  716. ),
  717. Container(
  718. width: 1350.0,
  719. child: Text(
  720. 'Espectro de Potencia Sonora Ventilador con Atenuador Lw',
  721. textAlign: TextAlign.center,
  722. style: GoogleFonts.roboto(
  723. color: Color(0xFF333333),
  724. fontSize: 24.0,
  725. fontWeight: FontWeight.bold
  726. ),
  727. ),
  728. margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
  729. padding: EdgeInsets.all(16.0),
  730. decoration: BoxDecoration(
  731. border: Border.all(
  732. color: Color(0xFFDDDDDD),
  733. width: 2.0
  734. )
  735. ),
  736. ),
  737. _headerFrecuenciasS,
  738. _valuesFrecuenciasT,
  739. Container(
  740. width: 1350.0,
  741. child: Text(
  742. 'Espectro de Potencia Sonora Ventilador con Atenuador Lw(A)',
  743. textAlign: TextAlign.center,
  744. style: GoogleFonts.roboto(
  745. color: Color(0xFF333333),
  746. fontSize: 24.0,
  747. fontWeight: FontWeight.bold
  748. ),
  749. ),
  750. margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
  751. padding: EdgeInsets.all(16.0),
  752. decoration: BoxDecoration(
  753. border: Border.all(
  754. color: Color(0xFFDDDDDD),
  755. width: 2.0
  756. )
  757. ),
  758. ),
  759. _headerFrecuenciasS,
  760. _valuesFrecuenciasC,
  761. Row(
  762. children: [
  763. Container(
  764. padding: EdgeInsets.all(16.0),
  765. decoration: BoxDecoration(
  766. border: Border(
  767. left: BorderSide(
  768. color: Color(0xFFDDDDDD),
  769. width: 2.0
  770. ),
  771. top: BorderSide(
  772. color: Color(0xFFDDDDDD),
  773. width: 2.0
  774. ),
  775. right: BorderSide(
  776. color: Color(0xFFDDDDDD),
  777. width: 1.0
  778. )
  779. )
  780. ),
  781. width: 450.0,
  782. child: Text(
  783. 'Presión Sonora',
  784. textAlign: TextAlign.center,
  785. style: GoogleFonts.roboto(
  786. color: Color(0xFF333333),
  787. fontSize: 24.0,
  788. fontWeight: FontWeight.bold
  789. ),
  790. ),
  791. ),
  792. Container(
  793. padding: EdgeInsets.all(16.0),
  794. decoration: BoxDecoration(
  795. border: Border(
  796. left: BorderSide(
  797. color: Color(0xFFDDDDDD),
  798. width: 1.0
  799. ),
  800. top: BorderSide(
  801. color: Color(0xFFDDDDDD),
  802. width: 2.0
  803. ),
  804. right: BorderSide(
  805. color: Color(0xFFDDDDDD),
  806. width: 2.0
  807. )
  808. )
  809. ),
  810. width: 900.0,
  811. child: Text(
  812. widget.presionSonoraVa.toStringAsFixed(_decimales),
  813. textAlign: TextAlign.center,
  814. style: GoogleFonts.roboto(
  815. color: Color(0xFF333333),
  816. fontSize: 24.0,
  817. fontWeight: FontWeight.bold
  818. ),
  819. ),
  820. )
  821. ],
  822. ),
  823. Container(
  824. width: 1350.0,
  825. child: Text(
  826. 'Datos del Atenuador Seleccionado',
  827. textAlign: TextAlign.center,
  828. style: GoogleFonts.roboto(
  829. color: Color(0xFF333333),
  830. fontSize: 24.0,
  831. fontWeight: FontWeight.bold
  832. ),
  833. ),
  834. margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
  835. padding: EdgeInsets.all(16.0),
  836. decoration: BoxDecoration(
  837. border: Border.all(
  838. color: Color(0xFFDDDDDD),
  839. width: 2.0
  840. )
  841. ),
  842. ),
  843. _datosAtenuadorSelec,
  844. SizedBox(height: 8.0),
  845. ],
  846. ),
  847. ),
  848. ),
  849. ),
  850. );
  851. }
  852. Future<File> _createFileFromString(String encoded, String name) async{
  853. Uint8List bytes = base64Decode(encoded);
  854. String dir = (await getApplicationDocumentsDirectory()).path;
  855. File file = File(
  856. "$dir/$name"
  857. );
  858. await file.writeAsBytes(bytes);
  859. return file;
  860. }
  861. }