import 'package:cached_network_image/cached_network_image.dart';
import 'package:e_commerce_training/res/R.dart';
import 'package:e_commerce_training/src/model/repository/app_repository.dart';
import 'package:e_commerce_training/src/page/home_favorite/home_favorite_cubit.dart';
import 'package:e_commerce_training/src/page/home_favorite/home_favorite_state.dart';
import 'package:e_commerce_training/src/page/login/login_page.dart';
import 'package:e_commerce_training/src/page/main/main.dart';
import 'package:e_commerce_training/src/util/navigation_util.dart';
import 'package:e_commerce_training/src/util/util.dart';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class HomeFavorite extends StatefulWidget {
  @override
  _HomeFavoriteState createState() => _HomeFavoriteState();
}

class _HomeFavoriteState extends State<HomeFavorite> {
  RefreshController _refreshController = RefreshController();
  TextEditingController controller = TextEditingController();
  late HomeFavoriteCubit cubit;
  late MainCubit mainCubit;

  @override
  void initState() {
    // TODO: implement initState
    AppRepository repository = AppRepository();
    cubit = HomeFavoriteCubit(repository);
    cubit.getListTagHome();
    cubit.getListCart();
    cubit.getListCommunity();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: R.color.white.withOpacity(0.95),
      body: BlocProvider(
        create: (context) => cubit,
        child: BlocConsumer<HomeFavoriteCubit, HomeFavoriteState>(
          listener: (context, state) {
            if (state is HomeFavoriteFailure) Util.showErrorSnackBar(context, state.error);
            if (!(state is HomeFavoriteLoading)) {
              _refreshController.refreshCompleted();
              _refreshController.loadComplete();
            }
            // TODO: implement listener
          },
          builder: (context, state) {
            return SmartRefresher(
              enablePullUp: true,
              controller: _refreshController,
              onRefresh: () => cubit.getListCart(isRefresh: true),
              onLoading: () => cubit.getListCart(isLoadMore: true),
              child: GestureDetector(
                onTap: () {
                  if (Util.isEmpty(cubit.isLoggedIn)||!cubit.isLoggedIn) {
                    showDialog<void>(
                      context: context,
                      barrierDismissible: false,
                      builder: (BuildContext context) {
                        return buildConfirmLogin(context);
                      },
                    );
                  }
                },
                child: buildPage(context, state),
              ),
            );
          },
        ),
      ),
    );
  }

  CupertinoAlertDialog buildConfirmLogin(BuildContext context) {
    return CupertinoAlertDialog(
      title: Text(R.string.confirm_home.tr()),
      content: Text(R.string.you_need_to_login.tr()),
      actions: <Widget>[
        CupertinoDialogAction(
          child: Text(R.string.cancel_home.tr()),
          onPressed: () {
            Navigator.of(context).pop();
          },
        ),
        CupertinoDialogAction(
          child: Text(R.string.ok_home.tr()),
          onPressed: () {
            NavigationUtil.rootNavigatePage(context, LoginPage());
          },
        ),
      ],
    );
  }

  Widget buildPage(BuildContext context, HomeFavoriteState state) {
    return SafeArea(
      child: Column(
        children: [
          Container(
            width: MediaQuery
                .of(context)
                .size
                .width,
            padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(20),
                bottomRight: Radius.circular(20),
              ),
              color: R.color.orange,
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SizedBox(height: 30),
                RichText(
                  text: TextSpan(
                      text: R.string.hello.tr(),
                      style: TextStyle(
                        fontSize: 20.sp,
                        color: R.color.white,
                        fontWeight: FontWeight.w600,
                      ),
                      children: <TextSpan>[
                        TextSpan(
                          text: " Công Ngọc",
                          style: TextStyle(
                            fontSize: 20.sp,
                            color: R.color.white,
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ]),
                ),
                SizedBox(height: 5),
                Row(
                  children: [
                    Icon(
                      MdiIcons.mapMarkerOutline,
                      color: R.color.white,
                      size: 20.h,
                    ),
                    SizedBox(width: 5),
                    Expanded(
                      child: Text(
                        "Hà Nội",
                        style: TextStyle(
                          fontSize: 14.sp,
                          color: R.color.white,
                          fontWeight: FontWeight.w600,
                        ),
                      ),
                    ),
                    CircleAvatar(
                      radius: 18.h,
                      backgroundColor: R.color.white,
                      child: Icon(
                        MdiIcons.bell,
                        color: R.color.orange,
                        size: 20.h,
                      ),
                    ),
                  ],
                ),
              ],
            ),
          ),
          SizedBox(height: 20),
          Container(
            padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
            color: R.color.white,
            child: Center(
              child: Row(
                children: [
                  Expanded(
                    child: InkWell(
                      child: Center(
                        child: Text(
                          R.string.favorite_content.tr(),
                          style: TextStyle(
                            fontSize: 16.sp,
                            color: R.color.black,
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ),
                      onTap: () async {
                        showModalBottomSheet(
                          context: context,
                          isScrollControlled: true,
                          backgroundColor: Colors.transparent,
                          builder: (context) => buildShowBottomSheetFavorite(context),
                        );
                      },
                    ),
                    flex: 1,
                  ),
                  Container(height: 20.h, width: 1, color: R.color.gray),
                  Expanded(
                    child: InkWell(
                      child: Center(
                        child: Text(
                          R.string.following.tr(),
                          style: TextStyle(
                            fontSize: 16.sp,
                            color: R.color.black,
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ),
                      onTap: () async {
                        showModalBottomSheet(
                          context: context,
                          isScrollControlled: true,
                          backgroundColor: Colors.transparent,
                          builder: (context) => buildShowBottomSheetChoose(context),
                        );
                      },
                    ),
                    flex: 1,
                  ),
                  SizedBox(height: 20),
                ],
              ),
            ),
          ),
          Expanded(
            child: ListView.builder(
              shrinkWrap: true,
              itemCount: cubit.listCart.length,
              itemBuilder: (BuildContext context, int index) {
                var data = cubit.listCart[index];
                return Container(
                  height: 400.h,
                  padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
                  child: Card(
                    color: R.color.white.withOpacity(0.95),
                    child: Padding(
                      padding: EdgeInsets.symmetric(horizontal: 15, vertical: 15),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Row(
                            children: [
                              CircleAvatar(
                                radius: 20.h,
                                backgroundColor: R.color.orange,
                                backgroundImage: AssetImage(R.drawable.admin),
                              ),
                              SizedBox(width: 10),
                              Expanded(
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text(
                                      data.title ?? "",
                                      style: TextStyle(
                                        fontSize: 16.sp,
                                        color: R.color.black,
                                        fontWeight: FontWeight.w600,
                                      ),
                                    ),
                                    Row(
                                      children: [
                                        RichText(
                                          text: TextSpan(
                                              text: R.string.admin.tr(),
                                              style: TextStyle(
                                                fontSize: 12.sp,
                                                color: R.color.black,
                                                fontWeight: FontWeight.w600,
                                              ),
                                              children: <TextSpan>[
                                                TextSpan(
                                                  text: data.nameUser ?? "",
                                                  style: TextStyle(
                                                    fontSize: 12.sp,
                                                    color: R.color.black,
                                                    fontWeight: FontWeight.w600,
                                                  ),
                                                ),
                                              ]),
                                        ),
                                        SizedBox(width: 10),
                                        Icon(
                                          MdiIcons.earth,
                                          size: 12.h,
                                        ),
                                      ],
                                    ),
                                  ],
                                ),
                              ),
                              Text(
                                "1 min",
                                style: TextStyle(
                                  fontSize: 14.sp,
                                  color: R.color.gray,
                                  fontWeight: FontWeight.w600,
                                ),
                              ),
                              SizedBox(width: 10),
                              Icon(
                                MdiIcons.dotsVertical,
                                size: 16,
                                color: R.color.gray,
                              )
                            ],
                          ),
                          SizedBox(height: 10),
                          Expanded(
                            child: CachedNetworkImage(
                              imageUrl: data.image ?? "",
                              fit: BoxFit.cover,
                              width: MediaQuery
                                  .of(context)
                                  .size
                                  .width,
                            ),
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          Text(
                            R.string.cool_and_run.tr(),
                            style: TextStyle(
                              fontSize: 16.sp,
                              fontWeight: FontWeight.w600,
                              color: R.color.black,
                            ),
                            textAlign: TextAlign.center,
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          Row(
                            children: [
                              Expanded(
                                child: InkWell(
                                  child: Text(
                                    R.string.likes.tr(),
                                    style: TextStyle(
                                      fontSize: 14.sp,
                                      color: R.color.black,
                                      fontWeight: FontWeight.w600,
                                    ),
                                  ),
                                  onTap: () async {
                                    showModalBottomSheet(
                                      context: context,
                                      isScrollControlled: true,
                                      backgroundColor: Colors.transparent,
                                      builder: (context) => buildShowLike(context),
                                    );
                                  },
                                ),
                              ),
                              SizedBox(width: 5),
                              Text(
                                R.string.reples.tr(),
                                style: TextStyle(
                                  fontSize: 14.sp,
                                  color: R.color.black,
                                  fontWeight: FontWeight.w600,
                                ),
                              ),
                              SizedBox(width: 10),
                              Text(
                                R.string.shares.tr(),
                                style: TextStyle(
                                  fontSize: 14.sp,
                                  color: R.color.black,
                                  fontWeight: FontWeight.w600,
                                ),
                              ),
                            ],
                          ),
                          SizedBox(height: 5),
                          Row(
                            children: [
                              Expanded(
                                child: Container(
                                  padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
                                  decoration:
                                  BoxDecoration(borderRadius: BorderRadius.circular(20), color: R.color.grey100),
                                  child: TextField(
                                    autofocus: false,
                                    textInputAction: TextInputAction.search,
                                    controller: controller,
                                    cursorColor: R.color.primaryColor,
                                    decoration: InputDecoration.collapsed(
                                      hintText: R.string.reply.tr(),
                                      border: InputBorder.none,
                                    ),
                                  ),
                                ),
                              ),
                              SizedBox(width: 10),
                              CircleAvatar(
                                radius: 20.h,
                                backgroundColor: R.color.white,
                                child: InkWell(
                                  onTap: () {
                                    cubit.checkLike();
                                  },
                                  child: Icon(
                                    MdiIcons.bookmarkOutline,
                                    color: cubit.like ? R.color.primaryColor : R.color.black,
                                  ),
                                ),
                              ),
                              SizedBox(width: 10),
                              CircleAvatar(
                                radius: 20.h,
                                backgroundColor: R.color.white,
                                child: InkWell(
                                  onTap: () {
                                    cubit.checkBookMark();
                                  },
                                  child: Icon(
                                    MdiIcons.thumbUpOutline,
                                    color: cubit.bookMark ? R.color.primaryColor : R.color.black,
                                  ),
                                ),
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
                  ),
                );
              },
            ),
          ),
        ],
      ),
    );
  }

  Container buildShowLike(BuildContext context) {
    return Container(
      height: 300.h,
      padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(20),
          topRight: Radius.circular(20),
        ),
        color: R.color.white,
      ),
      child: Column(
        children: [
          Row(
            children: [
              Expanded(
                child: Text(
                  R.string.likes.tr(),
                  style: TextStyle(
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w600,
                    color: R.color.black,
                  ),
                ),
              ),
              InkWell(
                onTap: () => NavigationUtil.pop(context),
                child: Icon(
                  MdiIcons.close,
                  color: Colors.deepOrangeAccent,
                ),
              )
            ],
          ),
          SizedBox(height: 10),
          Divider(
            color: R.color.orange,
            height: 1,
          ),
          SizedBox(height: 10),
          Expanded(
            child: ListView.builder(
              shrinkWrap: true,
              itemCount: 8,
              itemBuilder: (BuildContext context, int index) {
                return Container(
                  padding: EdgeInsets.symmetric(vertical: 5),
                  child: Row(
                    children: [
                      CircleAvatar(
                        radius: 20.h,
                        backgroundColor: R.color.orange,
                        backgroundImage: AssetImage(R.drawable.admin),
                      ),
                      SizedBox(width: 10),
                      Text(
                        "Page car AAM",
                        style: TextStyle(
                          fontSize: 16.sp,
                          color: R.color.black,
                          fontWeight: FontWeight.w600,
                        ),
                      ),
                    ],
                  ),
                );
              },
            ),
          ),
          SizedBox(height: 5),
        ],
      ),
    );
  }

  Widget buildShowBottomSheetChoose(BuildContext context) {
    return Container(
      height: 550.h,
      padding: EdgeInsets.symmetric(horizontal: 30, vertical: 15),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(20),
          topRight: Radius.circular(20),
        ),
        color: R.color.white,
      ),
      child: Column(
        children: [
          Row(
            children: [
              Expanded(
                child: Center(
                  child: Text(
                    R.string.choose_the_people.tr(),
                    style: TextStyle(
                      fontSize: 18.sp,
                      fontWeight: FontWeight.w600,
                      color: R.color.black,
                    ),
                  ),
                ),
              ),
              InkWell(
                onTap: () => NavigationUtil.pop(context),
                child: Icon(
                  MdiIcons.close,
                  color: Colors.deepOrangeAccent,
                  size: 30.h,
                ),
              )
            ],
          ),
          SizedBox(height: 5),
          Center(
            child: Text(
              R.string.choose_the_people.tr(),
              style: TextStyle(
                fontSize: 16.sp,
                fontWeight: FontWeight.w600,
                color: R.color.black,
              ),
              textAlign: TextAlign.center,
            ),
          ),
          SizedBox(height: 20),
          GridView.count(
            shrinkWrap: true,
            primary: false,
            crossAxisCount: 2,
            mainAxisSpacing: 10.0,
            crossAxisSpacing: 10.0,
            childAspectRatio: 3 / 3,
            children: List.generate(
              cubit.listCommunity.length,
                  (index) {
                var data = cubit.listCommunity[index];
                return Card(
                  color: R.color.grey100,
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Expanded(
                        child: Stack(
                          children: [
                            CachedNetworkImage(
                              imageUrl: "https://aphoto.vn/wp-content/uploads/2019/02/hinh8-16.jpg",
                              fit: BoxFit.cover,
                            ),
                            Positioned(
                              top: 5,
                              right: 5,
                              child: Container(
                                height: 30.h,
                                width: 30.h,
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(5.0),
                                  color: R.color.white,
                                ),
                                child: Center(
                                  child: Icon(
                                    MdiIcons.accountOutline,
                                    color: R.color.orange,
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 5,
                      ),
                      Padding(
                        padding: EdgeInsets.only(left: 10),
                        child: Text(
                          data.title ?? "",
                          style: TextStyle(
                            fontSize: 16.sp,
                            fontWeight: FontWeight.w600,
                            color: R.color.black,
                          ),
                          textAlign: TextAlign.center,
                        ),
                      ),
                      SizedBox(
                        height: 5,
                      ),
                      Padding(
                        padding: EdgeInsets.only(left: 10),
                        child: Row(
                          children: [
                            Text(
                              data.number ?? "",
                              style: TextStyle(
                                fontSize: 16.sp,
                                fontWeight: FontWeight.w600,
                                color: R.color.orange,
                              ),
                              textAlign: TextAlign.center,
                            ),
                            SizedBox(width: 5),
                            Text(
                              data.unit ?? "",
                              style: TextStyle(
                                fontSize: 12.sp,
                                fontWeight: FontWeight.w600,
                                color: R.color.black,
                              ),
                              textAlign: TextAlign.center,
                            ),
                          ],
                        ),
                      ),
                      SizedBox(height: 5),
                    ],
                  ),
                );
              },
            ),
          ),
          SizedBox(height: 20),
          Container(
            padding: EdgeInsets.symmetric(vertical: 15),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(25),
              color: Colors.deepOrangeAccent,
            ),
            child: Center(
              child: Text(
                "Apply",
                style: TextStyle(
                  fontSize: 18.sp,
                  fontWeight: FontWeight.w500,
                  color: R.color.white,
                ),
                textAlign: TextAlign.center,
                maxLines: 2,
              ),
            ),
          ),
          SizedBox(height: 5),
        ],
      ),
    );
  }

  Widget buildShowBottomSheetFavorite(BuildContext context) {
    return Container(
      height: MediaQuery
          .of(context)
          .size
          .height * 0.45,
      padding: EdgeInsets.symmetric(horizontal: 30, vertical: 15),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(20),
          topRight: Radius.circular(20),
        ),
        color: R.color.white,
      ),
      child: Column(
        children: [
          Row(
            children: [
              Expanded(
                child: Center(
                  child: Text(
                    R.string.choose_your_favorite_contents.tr(),
                    style: TextStyle(
                      fontSize: 18.sp,
                      fontWeight: FontWeight.w600,
                      color: R.color.black,
                    ),
                  ),
                ),
              ),
              InkWell(
                onTap: () => NavigationUtil.pop(context),
                child: Icon(
                  MdiIcons.close,
                  color: Colors.deepOrangeAccent,
                  size: 30.h,
                ),
              )
            ],
          ),
          SizedBox(height: 5),
          Center(
            child: Text(
              R.string.choose_the_best_favorite.tr(),
              style: TextStyle(
                fontSize: 16.sp,
                fontWeight: FontWeight.w600,
                color: R.color.black,
              ),
              textAlign: TextAlign.center,
            ),
          ),
          SizedBox(height: 20),
          Container(
            padding: EdgeInsets.symmetric(vertical: 10),
            child: Wrap(
              spacing: 15,
              runSpacing: 15,
              children: List<Widget>.generate(cubit.listTagHome.length, (int index) {
                return InkWell(
                  onTap: () {
                    cubit.checkSelected(index);
                  },
                  child: Container(
                    padding: EdgeInsets.symmetric(horizontal: 30, vertical: 5),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: cubit.isSelected == index ? R.color.primaryColor : R.color.orange,
                      boxShadow: [
                        BoxShadow(
                          color: Colors.grey.withOpacity(0.5),
                          spreadRadius: 1,
                          blurRadius: 9,
                          offset: Offset(0, 3), // changes position of shadow
                        ),
                      ],
                    ),
                    child: Text(
                      cubit.listTagHome[index].title ?? "",
                      style: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w400,
                        color: R.color.black,
                      ),
                    ),
                  ),
                );
              }),
            ),
          ),
          SizedBox(height: 20),
          Container(
            padding: EdgeInsets.symmetric(vertical: 15),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(25),
              color: Colors.deepOrangeAccent,
            ),
            child: Center(
              child: Text(
                "Apply",
                style: TextStyle(
                  fontSize: 18.sp,
                  fontWeight: FontWeight.w500,
                  color: R.color.white,
                ),
                textAlign: TextAlign.center,
                maxLines: 2,
              ),
            ),
          ),
          SizedBox(height: 5),
        ],
      ),
    );
  }

  Widget buildCard(BuildContext context) {
    return Card(
      color: R.color.white.withOpacity(0.95),
      child: Padding(
        padding: EdgeInsets.symmetric(horizontal: 15, vertical: 15),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              children: [
                CircleAvatar(
                  radius: 20.h,
                  backgroundColor: R.color.orange,
                  backgroundImage: AssetImage(R.drawable.admin),
                ),
                SizedBox(width: 10),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        "Page car AAM",
                        style: TextStyle(
                          fontSize: 16.sp,
                          color: R.color.black,
                          fontWeight: FontWeight.w600,
                        ),
                      ),
                      Row(
                        children: [
                          RichText(
                            text: TextSpan(
                                text: R.string.admin.tr(),
                                style: TextStyle(
                                  fontSize: 12.sp,
                                  color: R.color.black,
                                  fontWeight: FontWeight.w600,
                                ),
                                children: <TextSpan>[
                                  TextSpan(
                                    text: " CôngNgọc",
                                    style: TextStyle(
                                      fontSize: 12.sp,
                                      color: R.color.black,
                                      fontWeight: FontWeight.w600,
                                    ),
                                  ),
                                ]),
                          ),
                          SizedBox(width: 10),
                          Icon(
                            MdiIcons.earth,
                            size: 12.h,
                          ),
                        ],
                      ),
                    ],
                  ),
                ),
                Text(
                  "1 min",
                  style: TextStyle(
                    fontSize: 14.sp,
                    color: R.color.gray,
                    fontWeight: FontWeight.w600,
                  ),
                ),
                SizedBox(width: 10),
                Icon(
                  MdiIcons.dotsVertical,
                  size: 16,
                  color: R.color.gray,
                )
              ],
            ),
            SizedBox(height: 10),
            Expanded(
              child: CachedNetworkImage(
                imageUrl: "https://aphoto.vn/wp-content/uploads/2019/02/hinh8-16.jpg",
                fit: BoxFit.cover,
                width: MediaQuery
                    .of(context)
                    .size
                    .width,
              ),
            ),
            SizedBox(
              height: 5,
            ),
            Text(
              R.string.cool_and_run.tr(),
              style: TextStyle(
                fontSize: 16.sp,
                fontWeight: FontWeight.w600,
                color: R.color.black,
              ),
              textAlign: TextAlign.center,
            ),
            SizedBox(
              height: 5,
            ),
            Row(
              children: [
                Expanded(
                  child: InkWell(
                    child: Text(
                      R.string.likes.tr(),
                      style: TextStyle(
                        fontSize: 14.sp,
                        color: R.color.black,
                        fontWeight: FontWeight.w600,
                      ),
                    ),
                    onTap: () async {
                      showModalBottomSheet(
                        context: context,
                        isScrollControlled: true,
                        backgroundColor: Colors.transparent,
                        builder: (context) => buildShowLike(context),
                      );
                    },
                  ),
                ),
                SizedBox(width: 5),
                Text(
                  R.string.reples.tr(),
                  style: TextStyle(
                    fontSize: 14.sp,
                    color: R.color.black,
                    fontWeight: FontWeight.w600,
                  ),
                ),
                SizedBox(width: 10),
                Text(
                  R.string.shares.tr(),
                  style: TextStyle(
                    fontSize: 14.sp,
                    color: R.color.black,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ],
            ),
            SizedBox(height: 5),
            Row(
              children: [
                Expanded(
                  child: Container(
                    padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
                    decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: R.color.grey100),
                    child: TextField(
                      autofocus: false,
                      textInputAction: TextInputAction.search,
                      controller: controller,
                      cursorColor: R.color.primaryColor,
                      decoration: InputDecoration.collapsed(
                        hintText: R.string.reply.tr(),
                        border: InputBorder.none,
                      ),
                    ),
                  ),
                ),
                SizedBox(width: 10),
                CircleAvatar(
                  radius: 20.h,
                  backgroundColor: R.color.white,
                  child: InkWell(
                    onTap: () {
                      cubit.checkLike();
                    },
                    child: Icon(
                      MdiIcons.bookmarkOutline,
                      color: cubit.like ? R.color.primaryColor : R.color.black,
                    ),
                  ),
                ),
                SizedBox(width: 10),
                CircleAvatar(
                  radius: 20.h,
                  backgroundColor: R.color.white,
                  child: InkWell(
                    onTap: () {
                      cubit.checkBookMark();
                    },
                    child: Icon(
                      MdiIcons.thumbUpOutline,
                      color: cubit.bookMark ? R.color.primaryColor : R.color.black,
                    ),
                  ),
                ),
                SizedBox(width: 10),
                CircleAvatar(
                  radius: 20.h,
                  backgroundColor: R.color.white,
                  child: InkWell(
                    onTap: () {
                      cubit.checkBookMark();
                    },
                    child: Icon(
                      MdiIcons.shareVariantOutline,
                      color: cubit.bookMark ? R.color.primaryColor : R.color.black,
                    ),
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }

}
