chore: upgrade Flutter to 3.22.0 (#797)

This commit is contained in:
Lucas.Xu 2024-05-14 14:05:38 +08:00 • committed by GitHub
commit 796d1249fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 122 additions and 100 deletions

View file

@ -33,7 +33,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.19.0"
flutter-version: "3.22.0"
cache: true
- name: Run tests

View file

@ -217,8 +217,8 @@ class _UploadImageMenuState extends State<UploadImageMenu> {
height: 36,
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(const Color(0xFF00BCF0)),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
backgroundColor: WidgetStateProperty.all(const Color(0xFF00BCF0)),
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),

View file

@ -44,14 +44,14 @@ class _SelectionMenuItemWidgetState extends State<SelectionMenuItemWidget> {
),
style: ButtonStyle(
alignment: Alignment.centerLeft,
overlayColor: MaterialStateProperty.all(
overlayColor: WidgetStateProperty.all(
style.selectionMenuItemSelectedColor,
),
backgroundColor: widget.isSelected
? MaterialStateProperty.all(
? WidgetStateProperty.all(
style.selectionMenuItemSelectedColor,
)
: MaterialStateProperty.all(Colors.transparent),
: WidgetStateProperty.all(Colors.transparent),
),
label: Text(
widget.item.name,

View file

@ -169,9 +169,9 @@ class ResetColorButton extends StatelessWidget {
textAlign: TextAlign.left,
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) {
backgroundColor: WidgetStateProperty.resolveWith<Color>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.hovered)) {
return Theme.of(context).hoverColor;
}
return Colors.transparent;

View file

@ -3,9 +3,9 @@ import 'package:flutter/material.dart';
ButtonStyle buildOverlayButtonStyle(BuildContext context) {
return ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) {
backgroundColor: WidgetStateProperty.resolveWith<Color>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.hovered)) {
return Theme.of(context).hoverColor;
}
return Colors.transparent;

View file

@ -123,20 +123,20 @@ class _MobileLinkMenuState extends State<MobileLinkMenu> {
widget.onCancel.call();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
backgroundColor: WidgetStateProperty.all(
style.backgroundColor,
),
foregroundColor: MaterialStateProperty.all(
foregroundColor: WidgetStateProperty.all(
style.primaryColor,
),
elevation: MaterialStateProperty.all(0),
shape: MaterialStateProperty.all(
elevation: WidgetStateProperty.all(0),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(style.borderRadius),
),
),
side: MaterialStateBorderSide.resolveWith(
side: WidgetStateBorderSide.resolveWith(
(states) => BorderSide(color: style.outlineColor),
),
),
@ -154,14 +154,14 @@ class _MobileLinkMenuState extends State<MobileLinkMenu> {
?.closeKeyboard();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
backgroundColor: WidgetStateProperty.all(
style.primaryColor,
),
foregroundColor: MaterialStateProperty.all(
foregroundColor: WidgetStateProperty.all(
style.onPrimaryColor,
),
elevation: MaterialStateProperty.all(0),
shape: MaterialStateProperty.all(
elevation: WidgetStateProperty.all(0),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(style.borderRadius),

View file

@ -22,9 +22,9 @@ class MobileToolbarItemMenuBtn extends StatelessWidget {
onPressed: onPressed,
style: ButtonStyle(
alignment: label == null ? Alignment.center : Alignment.centerLeft,
foregroundColor: MaterialStateProperty.all(style.foregroundColor),
foregroundColor: WidgetStateProperty.all(style.foregroundColor),
splashFactory: NoSplash.splashFactory,
side: MaterialStateProperty.resolveWith<BorderSide>(
side: WidgetStateProperty.resolveWith<BorderSide>(
(states) {
if (isSelected == true) {
return BorderSide(
@ -35,12 +35,12 @@ class MobileToolbarItemMenuBtn extends StatelessWidget {
return BorderSide(color: style.itemOutlineColor);
},
),
shape: MaterialStateProperty.all(
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(style.borderRadius),
),
),
padding: MaterialStateProperty.all(
padding: WidgetStateProperty.all(
EdgeInsets.zero,
),
),

View file

@ -19,7 +19,7 @@ platforms:
environment:
sdk: ">=3.1.5 <4.0.0"
flutter: ">=3.13.0"
flutter: ">=3.19.0"
dependencies:
flutter:
@ -33,7 +33,7 @@ dependencies:
sdk: flutter
flutter_svg: ^2.0.6
html: ^0.15.0
intl: ^0.18.0
intl: ^0.19.0
intl_utils: ^2.8.2
keyboard_height_plugin: ^0.0.4
logging: ^1.2.0
@ -52,7 +52,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.1
flutter_lints: ^4.0.0
network_image_mock: ^2.1.1
mockito: ^5.4.1
leak_tracker: ^10.0.0

View file

@ -30,7 +30,7 @@ void main() async {
startOffset: 0,
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.enter);
await editor.pressKey(key: LogicalKeyboardKey.enter);
var selection = editor.selection!;
var cell01 = getCellNode(tableNode.node, 0, 1)!;
@ -59,7 +59,7 @@ void main() async {
startOffset: 0,
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.enter);
await editor.pressKey(key: LogicalKeyboardKey.enter);
var selection = editor.selection!;
@ -88,7 +88,8 @@ void main() async {
startOffset: 0,
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
var selection = editor.selection!;
@ -123,7 +124,7 @@ void main() async {
// ),
// ),
// );
// await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
// await editor.pressKey(key: LogicalKeyboardKey.backspace);
// var selection = editor.selection!;
@ -165,7 +166,7 @@ void main() async {
),
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
var selection = editor.selection!;
@ -204,7 +205,7 @@ void main() async {
),
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
var selection = editor.selection!;
@ -237,7 +238,7 @@ void main() async {
startOffset: 1,
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowUp);
await editor.pressKey(key: LogicalKeyboardKey.arrowUp);
var selection = editor.selection!;
@ -251,7 +252,7 @@ void main() async {
startOffset: 3,
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowUp);
await editor.pressKey(key: LogicalKeyboardKey.arrowUp);
selection = editor.selection!;
@ -281,7 +282,7 @@ void main() async {
startOffset: 1,
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowDown);
await editor.pressKey(key: LogicalKeyboardKey.arrowDown);
var selection = editor.selection!;
@ -295,7 +296,7 @@ void main() async {
startOffset: 3,
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowDown);
await editor.pressKey(key: LogicalKeyboardKey.arrowDown);
selection = editor.selection!;
@ -325,7 +326,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
var selection = editor.selection!;
@ -340,7 +341,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
selection = editor.selection!;
@ -370,7 +371,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
var selection = editor.selection!;
@ -400,7 +401,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowRight);
await editor.pressKey(key: LogicalKeyboardKey.arrowRight);
var selection = editor.selection!;
@ -432,7 +433,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowRight);
await editor.pressKey(key: LogicalKeyboardKey.arrowRight);
var selection = editor.selection!;
@ -448,7 +449,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.arrowRight);
await editor.pressKey(key: LogicalKeyboardKey.arrowRight);
selection = editor.selection!;
@ -480,7 +481,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
var selection = editor.selection!;
@ -495,7 +496,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
selection = editor.selection!;
@ -511,7 +512,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
selection = editor.selection!;
@ -543,8 +544,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab, isShiftPressed: true);
var selection = editor.selection!;
@ -559,8 +559,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab, isShiftPressed: true);
selection = editor.selection!;
@ -576,8 +575,7 @@ void main() async {
),
);
await simulateKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab, isShiftPressed: true);
selection = editor.selection!;

View file

@ -466,7 +466,7 @@ void main() {
.indentPadding(node, TextDirection.ltr),
);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
nestedBlock =

View file

@ -234,6 +234,7 @@ class TestableEditor {
LogicalKeyboardKey.asterisk: '*',
LogicalKeyboardKey.underscore: '_',
};
Future<void> pressKey({
String? character,
LogicalKeyboardKey? key,

View file

@ -71,13 +71,13 @@ void main() async {
// move the cursor to the beginning of node 1
for (var i = 1; i < text.length; i++) {
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
await tester.pumpAndSettle();
}
expect(editor.selection, Selection.collapsed(Position(path: [1])));
// move the cursor to the ending of node 0
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
expect(
editor.selection,
Selection.collapsed(Position(path: [0], offset: text.length)),
@ -85,7 +85,7 @@ void main() async {
// move the cursor to the beginning of node 0
for (var i = 1; i < text.length; i++) {
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
await tester.pumpAndSettle();
}
expect(editor.selection, Selection.collapsed(Position(path: [0])));

View file

@ -73,7 +73,7 @@ void main() async {
// move the cursor to the ending of node 0
for (var i = 1; i < text.length; i++) {
await simulateKeyDownEvent(LogicalKeyboardKey.arrowRight);
await editor.pressKey(key: LogicalKeyboardKey.arrowRight);
await tester.pumpAndSettle();
}
expect(
@ -82,12 +82,12 @@ void main() async {
);
// move the cursor to the beginning of node 1
await simulateKeyDownEvent(LogicalKeyboardKey.arrowRight);
await editor.pressKey(key: LogicalKeyboardKey.arrowRight);
expect(editor.selection, Selection.collapsed(Position(path: [1])));
// move the cursor to the ending of node 1
for (var i = 1; i < text.length; i++) {
await simulateKeyDownEvent(LogicalKeyboardKey.arrowRight);
await editor.pressKey(key: LogicalKeyboardKey.arrowRight);
await tester.pumpAndSettle();
}
expect(

View file

@ -319,7 +319,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
// the first node should be deleted.
@ -366,7 +366,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
expect(
@ -416,7 +416,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
expect(
@ -453,7 +453,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
expect(
@ -495,7 +495,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.backspace);
await editor.pressKey(key: LogicalKeyboardKey.backspace);
await tester.pumpAndSettle();
node = editor.nodeAtPath([1])!;

View file

@ -289,7 +289,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.delete);
await editor.pressKey(key: LogicalKeyboardKey.delete);
await tester.pumpAndSettle();
// the first node should be deleted.
@ -336,7 +336,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.delete);
await editor.pressKey(key: LogicalKeyboardKey.delete);
await tester.pumpAndSettle();
expect(
@ -386,7 +386,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.delete);
await editor.pressKey(key: LogicalKeyboardKey.delete);
await tester.pumpAndSettle();
expect(
@ -424,7 +424,7 @@ void main() async {
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.delete);
await editor.pressKey(key: LogicalKeyboardKey.delete);
await tester.pumpAndSettle();
expect(

View file

@ -35,7 +35,7 @@ void main() async {
await editor.updateSelection(selection);
for (final LogicalKeyboardKey key in keys) {
await simulateKeyDownEvent(key);
await editor.pressKey(key: key);
await tester.pumpAndSettle();
}
@ -84,7 +84,7 @@ void main() async {
await editor.updateSelection(selection);
for (final LogicalKeyboardKey key in keys) {
await simulateKeyDownEvent(key);
await editor.pressKey(key: key);
await tester.pumpAndSettle();
}
@ -136,7 +136,7 @@ void main() async {
await editor.updateSelection(selection);
for (final LogicalKeyboardKey key in keys) {
await simulateKeyDownEvent(key);
await editor.pressKey(key: key);
await tester.pumpAndSettle();
}
@ -175,7 +175,7 @@ void main() async {
await editor.updateSelection(selection);
for (final LogicalKeyboardKey key in keys) {
await simulateKeyDownEvent(key);
await editor.pressKey(key: key);
await tester.pumpAndSettle();
}
@ -219,7 +219,7 @@ void main() async {
await editor.updateSelection(selection);
for (final LogicalKeyboardKey key in keys) {
await simulateKeyDownEvent(key);
await editor.pressKey(key: key);
await tester.pumpAndSettle();
}

View file

@ -1,4 +1,5 @@
import 'dart:io' show Platform;
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
@ -25,7 +26,7 @@ void main() async {
final selection = Selection.collapsed(Position(path: [0]));
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.end);
await editor.pressKey(key: LogicalKeyboardKey.end);
if (Platform.isWindows || Platform.isLinux) {
expect(
@ -50,7 +51,7 @@ void main() async {
final selection = Selection.collapsed(Position(path: [5]));
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.end);
await editor.pressKey(key: LogicalKeyboardKey.end);
if (Platform.isWindows || Platform.isLinux) {
expect(

View file

@ -1,4 +1,5 @@
import 'dart:io' show Platform;
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
@ -27,7 +28,7 @@ void main() async {
Selection.collapsed(Position(path: [0], offset: text.length));
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.home);
await editor.pressKey(key: LogicalKeyboardKey.home);
if (Platform.isWindows || Platform.isLinux) {
expect(
@ -53,7 +54,7 @@ void main() async {
Selection.collapsed(Position(path: [5], offset: text.length));
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.home);
await editor.pressKey(key: LogicalKeyboardKey.home);
if (Platform.isWindows || Platform.isLinux) {
expect(

View file

@ -1,8 +1,6 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../infra/testable_editor.dart';
@ -51,7 +49,7 @@ void main() async {
('خط دوم', blockComponentTextDirectionRTL),
);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
await tester.pumpAndSettle();
final node = editor.nodeAtPath([0])!;
@ -71,7 +69,7 @@ void main() async {
('خط دوم', blockComponentTextDirectionRTL),
);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
await tester.pumpAndSettle();
final node = editor.nodeAtPath([0])!;
@ -91,7 +89,7 @@ void main() async {
('خط دوم', blockComponentTextDirectionAuto),
);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
await tester.pumpAndSettle();
final node = editor.nodeAtPath([0])!;
@ -116,7 +114,7 @@ void main() async {
('س', blockComponentTextDirectionAuto),
);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
await tester.pumpAndSettle();
Node node = editor.nodeAtPath([0])!;
@ -163,7 +161,7 @@ Future<TestableEditor> indentTestHelper(
);
await editor.updateSelection(selection);
await simulateKeyDownEvent(LogicalKeyboardKey.tab);
await editor.pressKey(key: LogicalKeyboardKey.tab);
await tester.pumpAndSettle();
final node = editor.nodeAtPath([0])!;

View file

@ -1,7 +1,8 @@
import 'dart:io';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'dart:io';
import '../../../infra/testable_editor.dart';
@ -98,13 +99,13 @@ void main() async {
// move the cursor to the beginning of node 1
for (var i = 1; i < text.length; i++) {
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
await tester.pumpAndSettle();
}
expect(editor.selection, Selection.collapsed(Position(path: [1])));
// move the cursor to the ending of node 0
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
expect(
editor.selection,
Selection.collapsed(Position(path: [0], offset: text.length)),
@ -112,7 +113,7 @@ void main() async {
// move the cursor to the beginning of node 0
for (var i = 1; i < text.length; i++) {
await simulateKeyDownEvent(LogicalKeyboardKey.arrowLeft);
await editor.pressKey(key: LogicalKeyboardKey.arrowLeft);
await tester.pumpAndSettle();
}
expect(editor.selection, Selection.collapsed(Position(path: [0])));

Some files were not shown because too many files have changed in this diff Show more