import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:mohem_flutter_app/widgets/input_widget.dart';
import 'package:mohem_flutter_app/widgets/radio/show_radio.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';

class SelectedItemSheet extends StatelessWidget {
  String title;

  SelectedItemSheet(this.title);

  TextEditingController username = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: MediaQuery.of(context).size.height - 80,
      child: Column(
        children: [
          Expanded(
            child: SingleChildScrollView(
              child: Padding(
                padding: EdgeInsets.all(21),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    title.toText24(),
                    24.height,
                    "Search".toText16(),
                    12.height,
                    Row(
                      children: [
                        Expanded(
                          flex: 2,
                          child: ShowRadio(
                              title: "Name", value: "Name", groupValue: "Name"),
                        ),
                        Expanded(
                          flex: 3,
                          child: ShowRadio(
                              title: "User Name",
                              value: "User Name",
                              groupValue: "Name"),
                        ),
                        Expanded(
                          flex: 2,
                          child: ShowRadio(
                              title: "Email",
                              value: "Email",
                              groupValue: "Name"),
                        ),
                      ],
                    ),
                    20.height,
                    showItem("name"),
                    20.height,
                    InputWidget(
                      "Enter a note",
                      "This is simple note",
                      username,
                      isBackgroundEnable: true,
                      lines: 5,
                    ),
                  ],
                ),
              ),
            ),
          ),
          Container(
            width: double.infinity,
            height: 1,
            color: MyColors.borderColor,
          ),
          Row(
            children: [
              Expanded(
                child: DefaultButton(
                  "Cancel",
                  () {
                    Navigator.pop(context);
                  },
                  textColor: Colors.black,
                  colors: [
                    Color(0xffE6E6E6),
                    Color(0xffE6E6E6),
                  ],
                ),
              ),
              16.width,
              Expanded(
                child: DefaultButton(
                  "Submit",
                  () {
                    Navigator.pop(context);
                  },
                  colors: [
                    Color(0xff32D892),
                    Color(0xff1AB170),
                  ],
                ),
              ),
            ],
          ).insideContainer
        ],
      ),
    );
  }

  Widget showItem(String name) {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(15),
        color: Color(0xffF7F7F7),
        border: Border.all(
          color: Color(0xffefefef),
          width: 1,
        ),
      ),
      padding: EdgeInsets.only(top: 16, bottom: 16, left: 21, right: 21),
      child: Row(
        children: [
          CircularAvatar(
            height: 30,
            width: 30,
          ),
          16.width,
          Expanded(
            child: name.toText12(),
          ),
          Container(
            decoration: BoxDecoration(
              color: MyColors.redColor,
              borderRadius: BorderRadius.all(Radius.circular(100)),
            ),
            padding: EdgeInsets.all(3),
            child: Icon(
              Icons.star,
              size: 12,
              color: Colors.white,
            ),
          ),
        ],
      ),
    );
  }
}
