info_view.dart 1.7 KB

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