import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/constants/constants.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/store/auth.store.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';

class CustomAppBar extends StatelessWidget {
  CustomAppBar({super.key});
  final controller = Get.put(InventoryInoutController());
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: ScreenAdaper.width(30)),
      child: Row(
        children: [
          if (ScreenAdaper.isLandspace()) const Spacer(),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                TextEnum.homeWelcomeText,
                style: Theme.of(context).textTheme.titleMedium!.copyWith(
                    color: Colors.black87,
                    fontWeight: FontWeight.w400,
                    height: 0,
                    letterSpacing: 2,
                    fontSize: ScreenAdaper.sp(25)),
              ),
              Obx(
                () => Text(
                  AuthStore.to.userInfo.value.username ?? '',
                  style: Theme.of(context).textTheme.titleMedium!.copyWith(
                      color: Colors.black,
                      fontWeight: FontWeight.bold,
                      letterSpacing: 2,
                      height: 0,
                      fontSize: ScreenAdaper.sp(30)),
                ),
              )
            ],
          ),
          const Spacer(
            flex: 10,
          ),
          Container(
            height: ScreenAdaper.height(70),
            width: ScreenAdaper.width(70),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(20),
                color: AppTheme.primaryColorLight,
                boxShadow: [
                  BoxShadow(
                      color: AppTheme.primaryColor,
                      blurRadius: ScreenAdaper.sp(20),
                      offset: Offset(0, ScreenAdaper.height(10)))
                ]),
            child: Icon(
              Icons.account_circle_outlined,
              size: ScreenAdaper.sp(40),
              color: Colors.white,
            ),
          ),
          if (ScreenAdaper.isLandspace()) const Spacer(),
        ],
      ),
    );
  }
}
