import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/page/home_page/home_logic.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart';

class TopUserInfo extends StatelessWidget {
  TopUserInfo({Key? key}) : super(key: key);
  final controller = Get.find<HomeLogic>;
  final state = Get.find<HomeLogic>().state;
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        Get.toNamed(Routes.myInfo);
      },
      child: Container(
        color: Colors.white,
        padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top + 4.h, left: 14.w, right: 14.w, bottom: 19.h),
        child: Row(
          children: [
            Container(
              decoration: BoxDecoration(
                color: const Color.fromRGBO(245, 246, 251, 1),
                borderRadius: BorderRadius.circular(30.r),
              ),
              child: Row(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  ClipRRect(
                    borderRadius: BorderRadius.circular(50.w),
                    child: Container(
                      alignment: Alignment.center,
                      color: const Color.fromRGBO(163, 211, 255, 1),
                      padding: EdgeInsets.all(1.r),
                      child: Image.asset('assets/images/login_logo_icon.png', width: 32.w, height: 32.w),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 10.h),
                    child: Text(
                      state.userInfo.value!.givenname,
                      style: TextStyle(fontSize: 15.sp, color: const Color.fromRGBO(45, 56, 76, 0.9)),
                    ),
                  ),
                  Container(
                    padding: EdgeInsets.symmetric(horizontal: 4.w),
                    child: Icon(
                      Icons.arrow_forward_ios_rounded,
                      size: 12.sp,
                      color: const Color.fromRGBO(45, 56, 76, 0.9),
                    ),
                  ),
                  SizedBox(width: 5.w)
                ],
              ),
            ),
            const Expanded(child: SizedBox())
          ],
        ),
      ),
    );
  }
}
