import 'package:cached_network_image/cached_network_image.dart';
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ProfileWelcomeWidget extends StatelessWidget {
  final Widget clinicWidget;
  final double height;
  final bool isClinic;

  ProfileWelcomeWidget(this.clinicWidget,
      {this.height = 150, this.isClinic = false});

  @override
  Widget build(BuildContext context) {
    AuthenticationViewModel authenticationViewModel = Provider.of(context);

    return Container(
      height: height,
      // color: HexColor('#515B5D'),
      width: double.infinity,
      child: FractionallySizedBox(
          widthFactor: 0.9,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.end,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              this.isClinic == true ? clinicWidget : SizedBox(),
              SizedBox(
                width: 20,
              ),
              if (authenticationViewModel.doctorProfile != null)
                CircleAvatar(
                  //     radius: (52)
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(20),
                    child: CachedNetworkImage(
                      imageUrl:
                          authenticationViewModel.doctorProfile!.doctorImageURL!,
                      fit: BoxFit.fill,
                      width: 75,
                      height: 75,
                    ),
                  ),
                  backgroundColor: Colors.transparent,
                ),
              SizedBox(
                height: 20,
              ),
            ],
          )),
    );
  }
}
