import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.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: TranslationBase.of(context).prescriptions,
      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: AppText(
                            prescriptionReport.itemDescription.isNotEmpty
                                ? prescriptionReport.itemDescription
                                : prescriptionReport.itemDescriptionN),
                      ),
                    ),
                  )
                ],
              ),
            ),
            Container(
              color: Colors.white,
              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: AppText(
                            TranslationBase.of(context).route,
                            fontSize: 14,
                          ))),
                      Container(
                          color: Colors.white,
                          height: 30,
                          width: double.infinity,
                          child: Center(
                              child: AppText(
                            TranslationBase.of(context).frequency,
                            fontSize: 14,
                          ))),
                      Container(
                          color: Colors.white,
                          width: double.infinity,
                          padding: EdgeInsets.symmetric(horizontal: 4),
                          child: Center(
                              child: AppText(
                            "${TranslationBase.of(context).dailyDoses}",
                            fontSize: 14,
                          ))),
                      Container(
                          color: Colors.white,
                          height: 30,
                          width: double.infinity,
                          child: Center(
                              child: AppText(
                            TranslationBase.of(context).duration,
                            fontSize: 14,
                          ))),
                    ],
                  ),
                  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>[
                    AppText(TranslationBase.of(context).notes),
                    SizedBox(
                      height: 5,
                    ),
                    Divider(
                      height: 0.5,
                      color: Colors.grey[300],
                    ),
                    SizedBox(
                      height: 5,
                    ),
                    AppText(prescriptionReport.remarks ?? ''),
                  ],
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
