import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class PrescriptionDetailsPage extends StatelessWidget {
  final PrescriptionReport prescriptionReport;

  PrescriptionDetailsPage({Key key, this.prescriptionReport});

  @override
  Widget build(BuildContext context) {
    return AppScaffold(
      isShowAppBar: true,
      appBarTitle: 'Prescription Details',
      body: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: double.infinity,
              margin: EdgeInsets.only(top: 10, left: 10, right: 10),
              padding: EdgeInsets.all(8.0),
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.all(
                  Radius.circular(10.0),
                ),
                border: Border.all(color: Colors.grey[200], width: 0.5),
              ),
              child: Row(
                children: <Widget>[
                  ClipRRect(
                    borderRadius: BorderRadius.all(Radius.circular(5)),
                    child: Image.network(
                      prescriptionReport.imageSRCUrl,
                      fit: BoxFit.cover,
                      width: 60,
                      height: 70,
                    ),
                  ),
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Center(
                          child: Texts(prescriptionReport.itemDescription)),
                    ),
                  ),
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.all(8),
              child: InkWell(
                  onTap: () => Navigator.push(
                        context,
                        FadePage(
                          page: PharmacyForPrescriptionsPage(
                              prescriptionReport: prescriptionReport),
                        ),
                      ),
                  child: Center(
                    child: Column(
                      children: <Widget>[
                        Container(
                          width: 50,
                          decoration: BoxDecoration(
                              color: Colors.white, shape: BoxShape.rectangle),
                          child: Column(
                            children: <Widget>[
                              Icon(
                                Icons.pin_drop,
                                color: Colors.red[800],
                                size: 55,
                              ),
                            ],
                          ),
                        ),
                        SizedBox(
                          height: 5,
                        ),
                        Texts('Ports')
                      ],
                    ),
                  )),
            ),
            Container(
              margin: EdgeInsets.only(top: 10, left: 10, right: 10),
              child: Table(
                border: TableBorder.symmetric(
                    inside: BorderSide(width: 0.5),
                    outside: BorderSide(width: 0.5)),
                children: [
                  TableRow(
                    children: [
                      Container(
                          color: Colors.white,
                          height: 30,
                          width: double.infinity,
                          child: Center(child: Texts('Way'))),
                      Container(
                          color: Colors.white,
                          height: 30,
                          width: double.infinity,
                          child: Center(child: Texts('Average'))),
                      Container(
                          color: Colors.white,
                          height: 30,
                          width: double.infinity,
                          child: Center(child: Texts('Daily doses'))),
                      Container(
                          color: Colors.white,
                          height: 30,
                          width: double.infinity,
                          child: Center(child: Texts('Period'))),
                    ],
                  ),
                  TableRow(
                    children: [
                      Container(
                          color: Colors.white,
                          height: 50,
                          width: double.infinity,
                          child:
                              Center(child: Text(prescriptionReport.routeN))),
                      Container(
                          color: Colors.white,
                          height: 50,
                          width: double.infinity,
                          child: Center(
                              child: Text(prescriptionReport.frequencyN))),
                      Container(
                          color: Colors.white,
                          height: 50,
                          width: double.infinity,
                          child: Center(
                              child: Text(
                                  '${prescriptionReport.doseDailyQuantity}'))),
                      Container(
                          color: Colors.white,
                          height: 50,
                          width: double.infinity,
                          child:
                              Center(child: Text('${prescriptionReport.days}')))
                    ],
                  ),
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: 10, left: 10, right: 10),
              width: double.infinity,
              color: Colors.white,
              padding: EdgeInsets.all(5),
              child: Center(
                child: Column(
                  children: <Widget>[
                    Texts('Notes'),
                    SizedBox(
                      height: 5,
                    ),
                    Divider(
                      height: 0.5,
                      color: Colors.grey[300],
                    ),
                    SizedBox(
                      height: 5,
                    ),
                    Texts(' '),
                  ],
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
