import 'package:cargocalculaterapp/core/extension/build_context_extension.dart';
import 'package:cargocalculaterapp/core/utils/app_utils.dart';
import 'package:cargocalculaterapp/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../../../../../core/app_bloc/app_bloc.dart';

class LanguageDialog extends StatelessWidget {
  const LanguageDialog({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      decoration: BoxDecoration(
        color: context.color.scaffoldBackgroundColor,
        borderRadius: AppUtils.kBorderRadiusTop24,
      ),
      child: SafeArea(
        minimum: AppUtils.kPaddingL16R16T16B24,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              AppLocalization.current.change_language,
              style: context.text.orderTitle,
            ),
            AppUtils.kBoxHeight32,
            InkWell(
              onTap: () {
                context.read<AppBloc>().add(const AppChangeLocale("uz"));
                Navigator.pop(context);
              },
              child: Ink(
                child: Row(
                  children: [
                    const Image(
                      width: 20,
                      height: 20,
                      image: AssetImage("assets/png/ic_uz.png"),
                    ),
                    AppUtils.kBoxWidth16,
                    Text("O'zbek", style: context.text.profileCategory),
                  ],
                ),
              ),
            ),
            AppUtils.kBoxHeight32,
            InkWell(
              onTap: () {
                context.read<AppBloc>().add(const AppChangeLocale("ru"));
                Navigator.pop(context);
              },
              child: Ink(
                child: Row(
                  children: [
                    const Image(
                      width: 20,
                      height: 20,
                      image: AssetImage("assets/png/ic_ru.png"),
                    ),
                    AppUtils.kBoxWidth16,
                    Text("Русский", style: context.text.profileCategory),
                  ],
                ),
              ),
            ),
            AppUtils.kBoxHeight32,
            InkWell(
              onTap: () {
                context.read<AppBloc>().add(const AppChangeLocale("zh"));
                Navigator.pop(context);
              },
              child: Ink(
                child: Row(
                  children: [
                    const Image(
                      width: 20,
                      height: 20,
                      image: AssetImage("assets/png/ic_china.png"),
                    ),
                    AppUtils.kBoxWidth16,
                    Text("Chinese", style: context.text.profileCategory),
                  ],
                ),
              ),
            ),
            AppUtils.kBoxHeight16,
          ],
        ),
      ),
    );
  }
}
