import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebViewAppController extends GetxController {
  late final WebViewController webViewController;
  final isLoading = true.obs;


  void initializeWebViewController(String url) {
    webViewController = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..loadRequest(Uri.parse(url));

    webViewController.setNavigationDelegate(
      NavigationDelegate(
        onPageStarted: (_) => setLoading(true),
        onPageFinished: (_) => setLoading(false),
      ),
    );
  }


  void setLoading(bool value) {
    isLoading.value = value;
  }
}
