view.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_inappwebview/flutter_inappwebview.dart';
  3. import 'package:vitalapp/store/store.dart';
  4. // ignore: must_be_immutable
  5. class DashboardPage extends StatefulWidget {
  6. const DashboardPage({super.key});
  7. @override
  8. State<DashboardPage> createState() => _DashboardPageState();
  9. }
  10. class _DashboardPageState extends State<DashboardPage> {
  11. late InAppWebViewController inAppWebViewController;
  12. InAppWebView webView = InAppWebView(
  13. initialUrlRequest: URLRequest(
  14. url: Uri.parse(
  15. "${Store.app.homePageUrl}&token=${Store.user.token}",
  16. ),
  17. ),
  18. initialOptions: InAppWebViewGroupOptions(
  19. crossPlatform: InAppWebViewOptions(
  20. javaScriptEnabled: true,
  21. useShouldOverrideUrlLoading: true,
  22. mediaPlaybackRequiresUserGesture: true,
  23. applicationNameForUserAgent: "dface-yjxdh-webview",
  24. ),
  25. android: AndroidInAppWebViewOptions(
  26. mixedContentMode: AndroidMixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW,
  27. ),
  28. ios: IOSInAppWebViewOptions(
  29. allowsInlineMediaPlayback: true,
  30. ),
  31. ),
  32. );
  33. @override
  34. Widget build(BuildContext context) {
  35. return webView;
  36. // return const DashboardDemoView();
  37. }
  38. }