import 'package:flutter/material.dart';
import 'package:satu/shared/app_colors.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'note_text.dart';

class LineTile extends StatelessWidget {
  const LineTile(this.text,
      {required this.onTap, this.labelText, this.placeholder = 'Выберите'});

  final String text;
  final String placeholder;
  final String? labelText;
  final Function() onTap;

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        if (labelText != null)
          Padding(
            padding:
                const EdgeInsets.symmetric(horizontal: 14.0, vertical: 5.0),
            child: NoteText(labelText ?? ''),
          ),
        Container(
          decoration: const BoxDecoration(color: whiteColor),
          child: Material(
            color: Colors.transparent,
            child: InkWell(
              onTap: onTap,
              child: Padding(
                padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 12.w),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    if (text.isNotEmpty)
                      Text(
                        text,
                        style: const TextStyle(
                            fontSize: 14,
                            fontWeight: FontWeight.normal,
                            color: textColor),
                      ),
                    if (text.isEmpty)
                      Text(
                        placeholder,
                        style: const TextStyle(
                            fontSize: 12,
                            fontWeight: FontWeight.normal,
                            color: placeholderColor),
                      ),
                    const SizedBox(
                      width: 20,
                      child: Icon(
                        Icons.chevron_right,
                        color: textColor,
                      ),
                    )
                  ],
                ),
              ),
            ),
          ),
        ),
      ],
    );
  }
}
