The Webview Univeral Flutter package for Appeto SDK.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

64 lignes
1.3 KiB

  1. //
  2. // Created by boyan on 10/21/21.
  3. //
  4. #ifndef WEBVIEW_WINDOW_LINUX_WEBVIEW_WINDOW_H_
  5. #define WEBVIEW_WINDOW_LINUX_WEBVIEW_WINDOW_H_
  6. #include <flutter_linux/flutter_linux.h>
  7. #include <gtk/gtk.h>
  8. #include <webkit2/webkit2.h>
  9. #include <functional>
  10. #include <string>
  11. class WebviewWindow {
  12. public:
  13. WebviewWindow(
  14. FlMethodChannel *method_channel,
  15. int64_t window_id,
  16. std::function<void()> on_close_callback,
  17. const std::string &title, int width, int height,
  18. int title_bar_height
  19. );
  20. virtual ~WebviewWindow();
  21. void Navigate(const char *url);
  22. void RunJavaScriptWhenContentReady(const char *java_script);
  23. void Close();
  24. void SetApplicationNameForUserAgent(const std::string &app_name);
  25. void OnLoadChanged(WebKitLoadEvent load_event);
  26. void GoBack();
  27. void GoForward();
  28. void Reload();
  29. void StopLoading();
  30. gboolean DecidePolicy(WebKitPolicyDecision *decision,
  31. WebKitPolicyDecisionType type);
  32. void EvaluateJavaScript(const char *java_script, FlMethodCall* call);
  33. private:
  34. FlMethodChannel *method_channel_;
  35. int64_t window_id_;
  36. std::function<void()> on_close_callback_;
  37. std::string default_user_agent_;
  38. GtkWidget *window_ = nullptr;
  39. GtkWidget *webview_ = nullptr;
  40. GtkBox *box_ = nullptr;
  41. };
  42. #endif //WEBVIEW_WINDOW_LINUX_WEBVIEW_WINDOW_H_