info_view.dart 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:get/get.dart';
  2. import '../../widget/app_net_image.dart';
  3. import 'in_game_controller.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:webview_flutter/webview_flutter.dart';
  6. class InfoView extends GetView<InGameController>{
  7. late final WebViewController wc;
  8. InfoView({super.key}){
  9. wc = WebViewController()
  10. ..setJavaScriptMode(JavaScriptMode.unrestricted)
  11. ..setBackgroundColor(const Color(0x00000000))
  12. ..setNavigationDelegate(
  13. NavigationDelegate(
  14. onProgress: (int progress) {
  15. // Update loading bar.
  16. },
  17. onPageStarted: (String url) {},
  18. onPageFinished: (String url) {},
  19. onWebResourceError: (WebResourceError error) {},
  20. // onNavigationRequest: (NavigationRequest request) {
  21. // if (request.url.startsWith('https://www.youtube.com/')) {
  22. // return NavigationDecision.prevent;
  23. // }
  24. // return NavigationDecision.navigate;
  25. // },
  26. ),
  27. )
  28. ..loadRequest(Uri.parse('https://www.beswell.com/info/info.html'));
  29. }
  30. @override
  31. Widget build(BuildContext context) {
  32. return DefaultTabController(
  33. initialIndex: 0,
  34. length: 2,
  35. child: Scaffold(
  36. appBar: AppBar(
  37. title: const Text(''),
  38. bottom:const TabBar(tabs: [
  39. Tab(text: '帮助'),
  40. Tab(text: '图例')
  41. ]),
  42. ),
  43. body: TabBarView(
  44. physics: const NeverScrollableScrollPhysics(),
  45. children: [
  46. WebViewWidget(controller: wc),
  47. AppNetImage(
  48. netImage: controller.legend,
  49. fit: BoxFit.contain,
  50. )
  51. ],
  52. ) ,
  53. )
  54. );
  55. }
  56. }