import 'package:common_pub/ui/history_detail/trace_bar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

abstract class HomeController extends GetxController
    with GetTickerProviderStateMixin {
  final selectMapName = ''.obs;
  late final TabController tabController;
  late final traceController = TraceBarController();
  int get initTabIdx => 1;
  List<HomeTab> get tabs;

  @override
  void onInit() {
    super.onInit();
    tabController = TabController(
        length: tabs.length, initialIndex: initTabIdx, vsync: this);
  }

  @override
  void onClose() {
    super.onClose();
    tabController.dispose();
  }
}

class HomeTab {
  HomeTab(this.title, this.builder);
  final String title;
  final Widget Function() builder;
}
