Untitled

mail@pastecode.io avatar
unknown
dart
2 years ago
3.5 kB
1
Indexable
Never
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:iketfaa_delivery/App/Common/Utilities/Constants/AppColors.dart';
import 'package:iketfaa_delivery/App/Delivery/Modules/DeliveryHome/controller/delivery_home_controller.dart';

class DelvieryDrawerHeader extends GetView<DeliveryHomeController> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      padding: EdgeInsets.only(top: 30.0),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          controller.authManager.appUser.value.id == null
              ? Container(
                  width: Get.width * 0.15,
                  height: Get.height * 0.15,
                  child: CircleAvatar(
                    child: SvgPicture.asset(
                      "assets/svg/profile_bnb.svg",
                      color: AppColors.white,
                    ),
                    backgroundColor: AppColors.primary,
                  ),
                )
              : Row(
                  children: [
                    SizedBox(width: 20),
                    Container(
                      width: Get.width * 0.15,
                      height: Get.height * 0.15,
                      decoration: BoxDecoration(
                        shape: BoxShape.circle,
                        image: DecorationImage(
                          fit: BoxFit.cover,
                          image: CachedNetworkImageProvider(controller
                              .authManager.appUser.value.profilePictureUrl!),
                        ),
                      ),
                    ),
                    SizedBox(width: 20),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        //TODO make function cut name to show first and second name
                        Row(
                          children: [
                            Text(
                              controller.authManager.appUser.value.name ?? "",
                              style: Get.textTheme.headline5!
                                  .copyWith(fontWeight: FontWeight.w700),
                            ),
                          ],
                        ),
                        controller.authManager.deliveryUser.value.userMode == 1
                            ? Row(
                                children: [
                                  Icon(
                                    Icons.star,
                                    color: AppColors.yellow,
                                  ),
                                  SizedBox(
                                    width: 5.0,
                                  ),
                                  Text(
                                      controller.authManager.deliveryUser.value
                                          .driver!.rate!
                                          .toString(),
                                      style: Get.textTheme.bodyText1),
                                ],
                              )
                            : SizedBox(),
                      ],
                    ),
                  ],
                ),
          SizedBox(height: 20),
          Divider(),
        ],
      ),
    );
  }
}