import 'package:flutter/cupertino.dart';

class CustomTabsState {
  int? useTag = 0;
  int? activeTabIndex = 0;
  List? tabsList;
  Widget? Function(BuildContext)? tabItemBuilder;
  VoidCallback? onClickAction;

  CustomTabsState({
    this.useTag,
    this.activeTabIndex,
    this.tabsList,
    this.tabItemBuilder,
    this.onClickAction,
  });

  CustomTabsState copyWith({
    int? useTag,
    int? activeTabIndex,
    List? tabsList,
    Widget? Function(BuildContext)? tabItemBuilder,
    VoidCallback? onClickAction,
  }) {
    return CustomTabsState(
      useTag: useTag ?? this.useTag,
      activeTabIndex: activeTabIndex ?? this.activeTabIndex,
      tabsList: tabsList ?? this.tabsList,
      tabItemBuilder: tabItemBuilder ?? this.tabItemBuilder,
      onClickAction: onClickAction ?? this.onClickAction,
    );
  }

  Map<String, dynamic> toMap() {
    return {
      'useTag': this.useTag,
      'activeTabIndex': this.activeTabIndex,
      'tabsList': this.tabsList,
      'tabItemBuilder': this.tabItemBuilder,
      'onClickAction': this.onClickAction,
    };
  }

  factory CustomTabsState.fromMap(Map<String, dynamic> map) {
    return CustomTabsState(
      useTag: map['useTag'] as int,
      activeTabIndex: map['activeTabIndex'] as int,
      tabsList: map['tabsList'] as List,
      tabItemBuilder: map['tabItemBuilder'] as Widget? Function(BuildContext),
      onClickAction: map['onClickAction'] as VoidCallback,
    );
  }
}