|
1 | 1 | import 'dart:collection'; |
2 | 2 | import 'dart:convert'; |
3 | 3 |
|
4 | | -import 'package:flutter/material.dart'; |
| 4 | +import 'package:fluent_ui/fluent_ui.dart'; |
5 | 5 | import 'package:flutter_inappwebview/flutter_inappwebview.dart'; |
6 | 6 | import 'package:squadron_en_route/assets.dart'; |
7 | 7 | import 'package:squadron_en_route/components/kancolle_model/kancolle_parse.dart'; |
8 | 8 | import 'package:squadron_en_route/constant.dart'; |
| 9 | +import 'package:squadron_en_route/helper/mod.dart'; |
9 | 10 | import 'package:uuid/uuid.dart'; |
10 | 11 | import '../main.dart'; |
11 | 12 |
|
@@ -51,9 +52,8 @@ class AppWebViewState extends State<AppWebView> { |
51 | 52 |
|
52 | 53 | @override |
53 | 54 | Widget build(BuildContext context) { |
54 | | - return Stack( |
55 | | - alignment: Alignment.center, |
56 | | - children: [ |
| 55 | + return ScaffoldPage( |
| 56 | + content: Stack(alignment: Alignment.center, children: [ |
57 | 57 | AspectRatio( |
58 | 58 | aspectRatio: 5 / 3, |
59 | 59 | child: InAppWebView( |
@@ -93,48 +93,62 @@ class AppWebViewState extends State<AppWebView> { |
93 | 93 | onConsoleMessage: (controller, consoleMessage) => |
94 | 94 | print(consoleMessage), |
95 | 95 | )), |
96 | | - |
97 | | - Positioned( |
98 | | - bottom: 16.0, |
99 | | - right: 16.0, |
100 | | - child: FloatingActionButton( |
101 | | - onPressed: () { |
102 | | - controller.reload(); |
103 | | - }, |
104 | | - child: Icon(Icons.refresh), |
| 96 | + ]), |
| 97 | + bottomBar: CommandBar( |
| 98 | + primaryItems: [ |
| 99 | + CommandBarBuilderItem( |
| 100 | + builder: (context, mode, w) => Tooltip( |
| 101 | + message: context.L.webviewCameraTakePic, |
| 102 | + child: w, |
| 103 | + ), |
| 104 | + wrappedItem: CommandBarButton( |
| 105 | + icon: const Icon(FluentIcons.camera), |
| 106 | + onPressed: () {}, |
| 107 | + ), |
105 | 108 | ), |
106 | | - ), |
107 | | - Positioned( |
108 | | - bottom: 16.0, |
109 | | - left: 16.0, |
110 | | - child: FloatingActionButton( |
111 | | - onPressed: () { |
112 | | - print("clear cache"); |
113 | | - InAppWebViewController.clearAllCache(); |
114 | | - controller.clearCache(); |
115 | | - }, |
116 | | - child: Icon(Icons.refresh), |
| 109 | + CommandBarBuilderItem( |
| 110 | + builder: (context, mode, w) => Tooltip( |
| 111 | + message: context.L.webviewScale, |
| 112 | + child: w, |
| 113 | + ), |
| 114 | + wrappedItem: CommandBarButton( |
| 115 | + icon: const Icon(FluentIcons.back_to_window), |
| 116 | + onPressed: () { |
| 117 | + controller.injectJavascriptFileFromAsset( |
| 118 | + assetFilePath: 'assets/js/autoScaleIOS.js'); |
| 119 | + }, |
| 120 | + ), |
| 121 | + ), |
| 122 | + CommandBarBuilderItem( |
| 123 | + builder: (context, mode, w) => Tooltip( |
| 124 | + message: context.L.webviewRefresh, |
| 125 | + child: w, |
| 126 | + ), |
| 127 | + wrappedItem: CommandBarButton( |
| 128 | + icon: const Icon(FluentIcons.refresh), |
| 129 | + onPressed: () { |
| 130 | + controller.reload(); |
| 131 | + }, |
| 132 | + ), |
117 | 133 | ), |
118 | | - ), |
119 | | - Positioned( |
120 | | - bottom: 80, |
121 | | - right: 16, |
122 | | - child: FloatingActionButton( |
123 | | - onPressed: () async { |
124 | | - controller.injectJavascriptFileFromAsset( |
125 | | - assetFilePath: 'assets/js/autoScaleIOS.js'); |
126 | | - }, |
127 | | - child: Icon(Icons.zoom_in), |
| 134 | + ], |
| 135 | + secondaryItems: [ |
| 136 | + CommandBarBuilderItem( |
| 137 | + builder: (context, mode, w) => Tooltip( |
| 138 | + message: context.L.webviewForceRefresh, |
| 139 | + child: w, |
| 140 | + ), |
| 141 | + wrappedItem: CommandBarButton( |
| 142 | + icon: const Icon(FluentIcons.refresh), |
| 143 | + onPressed: () { |
| 144 | + InAppWebViewController.clearAllCache(); |
| 145 | + controller.clearCache(); |
| 146 | + }, |
| 147 | + ), |
128 | 148 | ), |
129 | | - ), |
130 | | - progress < 1.0 |
131 | | - ? LinearProgressIndicator( |
132 | | - value: progress, |
133 | | - color: Colors.amber, |
134 | | - backgroundColor: Colors.transparent, |
135 | | - ) |
136 | | - : Container(), |
137 | | - ], |
| 149 | + ], |
| 150 | + isCompact: true, |
| 151 | + ), |
138 | 152 | ); |
139 | 153 | } |
140 | 154 | } |
0 commit comments