import 'package:flutter/material.dart';
import 'package:ui_kit/ui_kit.dart';

class InputsSection extends StatefulWidget {
  const InputsSection({super.key});

  @override
  State<InputsSection> createState() => _InputsSectionState();
}

class _InputsSectionState extends State<InputsSection> {
  static final inputsList = [
    {"initText": ""},
    {"initText": "Ivan"},
    {"initText": "", 'label': "Name"},
    {"initText": "", 'isError': "true"},
    {'label': "Name"},
    {"initText": "Enter Name", 'label': "Name"},
    {"initText": "*********", 'isPassword': "true"},
  ];
  @override
  Widget build(BuildContext context) {
    return Container(
      width: width(context) * 100,
      height: height(context) * 30,
      margin: EdgeInsets.only(top: height(context) * 3),
      child: ListView.builder(
        itemCount: inputsList.length,
        itemBuilder: (BuildContext context, int index) {
          final currentItem = inputsList[index];
          return Container(
            margin: EdgeInsets.only(bottom: 10),
            child: InputWidget(
              controller: TextEditingController(text: currentItem['initText']),
              label: currentItem['label'],
              hintText: 'Введите имя',
              isError: currentItem['isError'] ?? "",
              errorText: 'Enter your name',
              isPassword: currentItem['isPassword'],
            ),
          );
        },
      ),
    );
  }
}
