import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tone_snap/components/base_scrollbar.dart';
import 'package:tone_snap/components/view_state_widget.dart';
import 'package:tone_snap/modules/sideb/widgets/playlist_item.dart';
import 'package:tone_snap/modules/sideb/widgets/remove_padding_music_bar.dart';

import 'collect_playlists_controller.dart';

class CollectPlaylistsView extends GetView<CollectPlaylistsController> {
  const CollectPlaylistsView({super.key});

  @override
  Widget build(BuildContext context) {
    Get.put(CollectPlaylistsController());

    return Column(
      children: [
        Expanded(
          child: Obx(() {
            return ViewStateWidget(
              viewState: controller.viewState.value,
              child: BaseScrollbar(
                scrollController: controller.scrollController,
                child: Obx(() {
                  return ListView.builder(
                    controller: controller.scrollController,
                    itemCount: controller.playLists.length,
                    itemBuilder: (context, index) {
                      return PlaylistItem(
                        index: 1,
                        playlistModel: controller.playLists[index],
                      );
                    },
                  );
                }),
              ),
            );
          }),
        ),
        const RemovePaddingMusicBar(),
      ],
    );
  }
}
