import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart';
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/perfecture_widget.dart';

class BreadCrumbWidget extends StatelessWidget {
  BreadCrumbWidget({Key? key, this.mapController}) : super(key: key);

  final MapController? mapController;

  final IndexController indexController = Get.find<IndexController>();


  @override
  Widget build(BuildContext context) {
    print("------ map controller is $mapController------------");
    return 
      Obx(()=> 
        indexController.perfectures.isNotEmpty && mapController != null  ?
        BreadCrumb.builder(
          itemCount: indexController.perfectures.length, 
          builder: (index){
            return
              BreadCrumbItem(
                content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
              );
          }
        ): 
        const Text("Empty")
      );
  }
}