import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';


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

  @override
  State<SystemDesignPage> createState() => _SystemDesignPageState();
}

class _SystemDesignPageState extends State<SystemDesignPage> {
  List<bool> _isOpen = [false, false, false, false, false, false];

  void _handleAdd() {
    print("Add FAB pressed");
  }

  void _handleEdit() {
    print("Edit FAB pressed");
  }

  void _handleDelete() {
    print("Delete FAB pressed");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("System design"), centerTitle: true),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: ExpansionPanelList(
            expansionCallback: (panelIndex, isExpanded) {
              setState(() {
                _isOpen[panelIndex] = isExpanded;
              });
            },
            children: [
              buttonWidget(),
              fabWidget(),
              outlinedFabWidget(),
              paginationWidget(),
              tabWidget(),
              inputsWidget(),
            ],
          ),
        ),
      ),
    );
  }

  ExpansionPanel inputsWidget() {
    return ExpansionPanel(
      isExpanded: _isOpen[5],
      headerBuilder: (context, isExpanded) {
        return ListTile(
          title: Text(
            "inputs",
            style: AppFonts.yekan20.copyWith(color: Colors.red),
          ),
        );
      },
      body: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
          spacing: 14,
          children: [
           RTextField(
          controller: TextEditingController(),
              hintText: 'حجم کشتار را در روز به قطعه وارد کنید',
              hintStyle: AppFonts.yekan13,
            ),
           RTextField(
          controller: TextEditingController(),
              label: 'تلفن مرغداری',
              labelStyle: AppFonts.yekan10,
            ),
          ],
        ),
      ),
    );
  }

  ExpansionPanel tabWidget() {
    return ExpansionPanel(
      isExpanded: _isOpen[4],
      headerBuilder: (context, isExpanded) {
        return ListTile(
          title: Text(
            "tab",
            style: AppFonts.yekan20.copyWith(color: Colors.red),
          ),
        );
      },
      body: Column(
        spacing: 14,
        children: [
          CupertinoSegmentedControlDemo(),
          CupertinoSegmentedControlDemo2(),
        ],
      ),
    );
  }

  ExpansionPanel paginationWidget() {
    return ExpansionPanel(
      isExpanded: _isOpen[3],
      headerBuilder: (context, isExpanded) {
        return ListTile(
          title: Text(
            "پیجینیشن",
            style: AppFonts.yekan20.copyWith(color: Colors.red),
          ),
        );
      },
      body: Column(spacing: 14, children: [RShowMore(), PaginationFromUntil()]),
    );
  }

  ExpansionPanel outlinedFabWidget() {
    return ExpansionPanel(
      isExpanded: _isOpen[2],
      headerBuilder: (context, isExpanded) {
        return ListTile(
          title: Text(
            "Outlined Fab ",
            style: AppFonts.yekan20.copyWith(color: Colors.green),
          ),
        );
      },
      body: Column(
        spacing: 14,
        children: [
          Row(),
/*
          RFabOutlined.smallAdd(onPressed: () {}),
          RFabOutlined.smallAdd(onPressed: null),

          RFabOutlined.smallAddNoBorder(onPressed: () {}),
          RFabOutlined.smallAddNoBorder(onPressed: null),

          RFabOutlined.add(onPressed: () {}),
          RFabOutlined.add(onPressed: null),

          RFabOutlined.addNoBorder(onPressed: () {}),
          RFabOutlined.addNoBorder(onPressed: null),*/
        ],
      ),
    );
  }

  ExpansionPanel fabWidget() {
    return ExpansionPanel(
      isExpanded: _isOpen[1],
      headerBuilder: (context, isExpanded) {
        return ListTile(
          title: Text(
            "Fab",
            style: AppFonts.yekan20.copyWith(color: Colors.green),
          ),
        );
      },
      body: Column(
        spacing: 14,
        children: [
          Row(),

   /*       RFab.smallAdd(onPressed: () {}),
          RFab.smallAdd(onPressed: null),

          RFab.add(onPressed: () {}),
          RFab.add(onPressed: null),

          RFab.smallEdit(onPressed: null),
          RFab.smallEdit(onPressed: () {}),

          RFab.edit(onPressed: () {}),
          RFab.edit(onPressed: null),

          RFab.smallDelete(onPressed: () {}),
          RFab.smallDelete(onPressed: null),

          RFab.delete(onPressed: () {}),
          RFab.delete(onPressed: null),

          RFab.smallAction(onPressed: () {}),
          RFab.smallAction(onPressed: null),

          RFab.action(onPressed: () {}),
          RFab.action(onPressed: null),

          RFab.smallFilter(onPressed: () {}),
          RFab.smallFilter(onPressed: null),

          RFab.filter(onPressed: () {}),
          RFab.filter(onPressed: null),

          RFab.smallDownload(onPressed: () {}),
          RFab.smallDownload(onPressed: null),

          RFab.download(onPressed: () {}),
          RFab.download(onPressed: null),

          RFab.smallExcel(onPressed: () {}),
          RFab.smallExcel(onPressed: null),

          RFab.excel(onPressed: () {}),
          RFab.excel(onPressed: null),

          RFab.smallBack(onPressed: () {}),
          RFab.smallBack(onPressed: null),

          RFab.back(onPressed: () {}),
          RFab.back(onPressed: null),*/
        ],
      ),
    );
  }

  ExpansionPanel buttonWidget() {
    return ExpansionPanel(
      isExpanded: _isOpen[0],
      headerBuilder: (context, isExpanded) {
        return ListTile(
          title: Text(
            "دکمه ها",
            style: AppFonts.yekan20.copyWith(color: Colors.green),
          ),
        );
      },
      body: Column(
        spacing: 14,
        children: [
          Row(),

          RElevated(text: 'ثبت', onPressed: () {}),

          RElevated(text: 'ثبت', onPressed: null),

          ROutlinedElevated(text: 'ثبت', onPressed: () {}),
          ROutlinedElevated(
            text: 'ثبتwwww',
            onPressed: () {},
            backgroundColor: AppColor.blueNormal.disabledColor,
            pressedBackgroundColor: AppColor.blueNormal,
          ),
          ROutlinedElevated(text: 'ثبت', onPressed: null),

          RTextButton(text: 'ثبت', onPressed: () {}),
          RTextButton(text: 'ثبت', onPressed: null),
        ],
      ),
    );
  }
}
