import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/view_models/liked_tenders_view_model.dart';
import 'package:tm_app/views/liked_tenders/pages/liked_tenders_desktop_page.dart';
import 'package:tm_app/views/liked_tenders/pages/liked_tenders_mobile_page.dart';
import 'package:tm_app/views/liked_tenders/pages/liked_tenders_tablet_page.dart';
import 'package:tm_app/views/shared/responsive_builder.dart';

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

  @override
  State<LikedTendersScreen> createState() => _LikedTendersScreenState();
}

class _LikedTendersScreenState extends State<LikedTendersScreen> {
  late final LikedTendersViewModel viewModel;

  @override
  void initState() {
    viewModel = context.read<LikedTendersViewModel>();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      viewModel.getLikedTenders(reset: true);
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    SizeConfig.init(context);
    return const ResponsiveBuilder(
      mobile: LikedTendersMobilePage(),
      tablet: LikedTendersTabletPage(),
      desktop: LikedTendersDesktopPage(),
    );
  }
}
