import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart';
import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class DoctorPostPreImagesPage extends StatefulWidget{
  final DoctorPrePostImages doctorPrePostImages;

  const DoctorPostPreImagesPage({this.doctorPrePostImages});

  @override
  State<StatefulWidget> createState() => DoctorPostPreImagesPageState();
}

class DoctorPostPreImagesPageState extends State<DoctorPostPreImagesPage>{

  @override
  Widget build(BuildContext context) {
    var images = widget.doctorPrePostImages;
    return AppScaffold(
        appBarTitle: TranslationBase.of(context).beforeAfterImages,
        isShowAppBar: true,
        isShowDecPage: false,
        body: Padding(
          padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
          child: Row(
            children: [
              Expanded(
                  child: Column(
                    children: [
                      Text("Before Image", style: TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),),
                      Image.memory(images.getPreBytes(), errorBuilder: (ctx,err, trace){
                        return Container(
                          color: Colors.grey.withOpacity(0.25),
                        );
                      },)
                    ],
                  )
              ),
              Divider(color: Colors.grey.withOpacity(0.5)),
              Expanded(
                  child: Column(
                    children: [
                      Text("After Image", style: TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),),
                      Image.memory(images.getPostBytes(),errorBuilder: (ctx,err, trace){
                        return Container(
                          color: Colors.grey.withOpacity(0.25),
                        );
                      },)
                    ],
                  )
              )
            ],
          ),
        )
    );
  }

}


class DoctorPostPreImagesContent extends StatefulWidget{
  final DoctorPrePostImages doctorPrePostImages;

  const DoctorPostPreImagesContent({this.doctorPrePostImages});

  @override
  DoctorPostPreImagesContentState createState() => DoctorPostPreImagesContentState();
}

class DoctorPostPreImagesContentState extends State<DoctorPostPreImagesContent>{

  @override
  Widget build(BuildContext context) {
    var images = widget.doctorPrePostImages;
    return Material(
      color: Colors.transparent,
      child: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Row(
              children: [
                Expanded(
                    child: Column(
                      children: [
                        Text("Before", style: TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),),
                        SizedBox(height: 10,),
                        Image.memory(images.getPreBytes(), errorBuilder: (ctx,err, trace){
                          return Container(
                            color: Colors.grey.withOpacity(0.25),
                          );
                        },)
                      ],
                    )
                ),
                Divider(color: Colors.grey.withOpacity(0.5)),
                Expanded(
                    child: Column(
                      children: [
                        Text("After", style: TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),),
                        SizedBox(height: 10,),
                        Image.memory(images.getPostBytes(),errorBuilder: (ctx,err, trace){
                          return Container(
                            color: Colors.grey.withOpacity(0.25),
                          );
                        },)
                      ],
                    )
                )
              ],
            ),
          ],
        ),
      ),
    );
  }

}