feat: upgrade flutter pubs

This commit is contained in:
Kingtous 2023-05-11 14:26:59 +08:00
parent 003edd04bd
commit 5b3a8a2c3d
4 changed files with 19 additions and 16 deletions

View File

@ -46,13 +46,13 @@ class _ScanPageState extends State<ScanPage> {
await picker.pickImage(source: ImageSource.gallery); await picker.pickImage(source: ImageSource.gallery);
if (file != null) { if (file != null) {
var image = img.decodeNamedImage( var image = img.decodeNamedImage(
File(file.path).readAsBytesSync(), file.path)!; file.path, File(file.path).readAsBytesSync())!;
LuminanceSource source = RGBLuminanceSource( LuminanceSource source = RGBLuminanceSource(
image.width, image.width,
image.height, image.height,
image image
.getBytes(format: img.Format.abgr) .getBytes(order: img.ChannelOrder.abgr)
.buffer .buffer
.asInt32List()); .asInt32List());
var bitmap = BinaryBitmap(HybridBinarizer(source)); var bitmap = BinaryBitmap(HybridBinarizer(source));

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -1067,7 +1068,7 @@ class CursorData {
height: (height * scale).toInt(), height: (height * scale).toInt(),
interpolation: img2.Interpolation.average, interpolation: img2.Interpolation.average,
) )
.getBytes(format: img2.Format.bgra); .getBytes(order: img2.ChannelOrder.bgra);
} else { } else {
data = Uint8List.fromList( data = Uint8List.fromList(
img2.encodePng( img2.encodePng(
@ -1133,13 +1134,13 @@ class PredefinedCursor {
() async { () async {
final defaultImg = _image2!; final defaultImg = _image2!;
// This function is called only one time, no need to care about the performance. // This function is called only one time, no need to care about the performance.
Uint8List data = defaultImg.getBytes(format: img2.Format.rgba); Uint8List data = defaultImg.getBytes(order: img2.ChannelOrder.rgba);
_image = await img.decodeImageFromPixels( _image = await img.decodeImageFromPixels(
data, defaultImg.width, defaultImg.height, ui.PixelFormat.rgba8888); data, defaultImg.width, defaultImg.height, ui.PixelFormat.rgba8888);
double scale = 1.0; double scale = 1.0;
if (Platform.isWindows) { if (Platform.isWindows) {
data = _image2!.getBytes(format: img2.Format.bgra); data = _image2!.getBytes(order: img2.ChannelOrder.bgra);
} else { } else {
data = Uint8List.fromList(img2.encodePng(_image2!)); data = Uint8List.fromList(img2.encodePng(_image2!));
} }
@ -1358,9 +1359,9 @@ class CursorModel with ChangeNotifier {
Uint8List rgba, ui.Image image, int id, int w, int h) async { Uint8List rgba, ui.Image image, int id, int w, int h) async {
Uint8List? data; Uint8List? data;
img2.Image imgOrigin = img2.Image imgOrigin =
img2.Image.fromBytes(w, h, rgba, format: img2.Format.rgba); img2.Image.fromBytes(width: w, height:h, bytes: rgba.buffer, order: img2.ChannelOrder.rgba);
if (Platform.isWindows) { if (Platform.isWindows) {
data = imgOrigin.getBytes(format: img2.Format.bgra); data = imgOrigin.getBytes(order: img2.ChannelOrder.bgra);
} else { } else {
ByteData? imgBytes = ByteData? imgBytes =
await image.toByteData(format: ui.ImageByteFormat.png); await image.toByteData(format: ui.ImageByteFormat.png);

View File

@ -7,7 +7,7 @@ import desktop_multi_window
import desktop_drop import desktop_drop
import device_info_plus_macos import device_info_plus_macos
import flutter_custom_cursor import flutter_custom_cursor
import package_info_plus_macos import package_info_plus
import path_provider_foundation import path_provider_foundation
import screen_retriever import screen_retriever
import sqflite import sqflite

View File

@ -36,9 +36,10 @@ dependencies:
provider: ^6.0.3 provider: ^6.0.3
tuple: ^2.0.0 tuple: ^2.0.0
wakelock: ^0.6.2 wakelock: ^0.6.2
# Keep this version for the compatibility of some old systems like win7.
device_info_plus: ^4.1.2 device_info_plus: ^4.1.2
#firebase_analytics: ^9.1.5 #firebase_analytics: ^9.1.5
package_info_plus: ^1.4.2 package_info_plus: ^3.1.2
url_launcher: ^6.0.9 url_launcher: ^6.0.9
toggle_switch: ^1.4.0 toggle_switch: ^1.4.0
dash_chat_2: ^0.0.15 dash_chat_2: ^0.0.15
@ -47,9 +48,9 @@ dependencies:
flutter_breadcrumb: ^1.0.1 flutter_breadcrumb: ^1.0.1
http: ^0.13.4 http: ^0.13.4
qr_code_scanner: ^1.0.0 qr_code_scanner: ^1.0.0
zxing2: ^0.1.0 zxing2: ^0.2.0
image_picker: ^0.8.5 image_picker: ^0.8.5
image: ^3.1.3 image: ^4.0.17
back_button_interceptor: ^6.0.1 back_button_interceptor: ^6.0.1
flutter_rust_bridge: ^1.61.1 flutter_rust_bridge: ^1.61.1
window_manager: window_manager:
@ -68,13 +69,14 @@ dependencies:
path: plugins/window_size path: plugins/window_size
ref: a738913c8ce2c9f47515382d40827e794a334274 ref: a738913c8ce2c9f47515382d40827e794a334274
get: ^4.6.5 get: ^4.6.5
visibility_detector: ^0.3.3 visibility_detector: ^0.4.0+2
contextmenu: ^3.0.0 contextmenu: ^3.0.0
desktop_drop: ^0.3.3 # Disable desktop_drop for now, because it may cause crash on Win11 when destructing.
scroll_pos: ^0.3.0 # desktop_drop: ^0.4.1
scroll_pos: ^0.4.0
debounce_throttle: ^2.0.0 debounce_throttle: ^2.0.0
file_picker: ^5.1.0 file_picker: ^5.1.0
flutter_svg: ^1.1.5 flutter_svg: ^2.0.5
flutter_improved_scrolling: flutter_improved_scrolling:
# currently, we use flutter 3.7.0+. # currently, we use flutter 3.7.0+.
# #
@ -94,7 +96,7 @@ dependencies:
bot_toast: ^4.0.3 bot_toast: ^4.0.3
win32: any win32: any
password_strength: ^0.2.0 password_strength: ^0.2.0
flutter_launcher_icons: ^0.11.0 flutter_launcher_icons: ^0.13.1
flutter_keyboard_visibility: ^5.4.0 flutter_keyboard_visibility: ^5.4.0
texture_rgba_renderer: ^0.0.16 texture_rgba_renderer: ^0.0.16
percent_indicator: ^4.2.2 percent_indicator: ^4.2.2