import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:marking_app/provider/user_provider.dart';
import 'package:marking_app/routes/RouterManager.dart';
import 'package:marking_app/utils/index.dart';

class TopUserInfo extends ConsumerWidget {
  const TopUserInfo({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final userState = ref.read(userProvider);

    return InkWell(
      onTap: () {
        RouterManager.router.navigateTo(context, RouterManager.userMinePath, transition: getTransition());
      },
      child: Row(
        children: [
          Container(
            decoration: BoxDecoration(
              color: 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: Color.fromRGBO(163, 211, 255, 1),
                    padding: EdgeInsets.all(1.r),
                    child: Image.asset('assets/images/logo.png', width: 32.w, height: 32.w),
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(left: 10.h),
                  child: Text(
                    userState.userName,
                    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)
              ],
            ),
          ),
          Expanded(child: SizedBox())
        ],
      ),
    );
  }
}