Skip to content

Commit

Permalink
Upgrade to Flutter v3.27 (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir-P authored Dec 28, 2024
1 parent c391628 commit 6abce16
Show file tree
Hide file tree
Showing 33 changed files with 122 additions and 82 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/fleather.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.24.0"
flutter-version: "3.27.1"
cache: true
# Manually Update this `key`
cache-key: "3.24.0"
cache-key: "3.27.1"
- run: dart pub global activate coverage

#
Expand Down
6 changes: 3 additions & 3 deletions packages/fleather/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d

PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

Expand Down
6 changes: 3 additions & 3 deletions packages/fleather/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos

SPEC CHECKSUMS:
file_selector_macos: 54fdab7caa3ac3fc43c9fac4d7d8d231277f8cf2
file_selector_macos: 6280b52b459ae6c590af5d78fc35c7267a3c4b31
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
6 changes: 5 additions & 1 deletion packages/fleather/example/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import Cocoa
import FlutterMacOS

@NSApplicationMain
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}

override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
}
6 changes: 3 additions & 3 deletions packages/fleather/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
url_launcher: ^6.1.5
image_picker: ^1.0.7
url_launcher: ^6.3.1
image_picker: ^1.1.2
fleather:
path: ../
parchment:
Expand All @@ -31,7 +31,7 @@ dev_dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ^5.0.0
flutter_test_robots: ^0.0.24

flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/fleather/lib/fleather.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Fleather widgets and document model.
///
/// To use, `import 'package:fleather/fleather.dart';`.
library fleather;
library;

export 'package:parchment/parchment.dart';

Expand Down
2 changes: 2 additions & 0 deletions packages/fleather/lib/l10n/fleather_localizations.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/fleather/lib/l10n/fleather_localizations_de.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/fleather/lib/l10n/fleather_localizations_en.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/fleather/lib/l10n/fleather_localizations_fa.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/fleather/lib/l10n/fleather_localizations_fr.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/fleather/lib/l10n/fleather_localizations_nl.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/fleather/lib/l10n/l10n.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library l10n;
library;

export 'fleather_localizations.g.dart';
export 'utils.dart';
2 changes: 1 addition & 1 deletion packages/fleather/lib/src/rendering/cursor_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class FloatingCursorPainter {

void paint(Canvas canvas) {
final Rect? floatingCursorRect = this.floatingCursorRect;
final floatingCursorColor = style.color.withOpacity(0.75);
final floatingCursorColor = style.color.withValues(alpha: 0.75);
if (floatingCursorRect == null) return;
canvas.drawRRect(
RRect.fromRectAndRadius(floatingCursorRect, _kFloatingCaretRadius),
Expand Down
10 changes: 5 additions & 5 deletions packages/fleather/lib/src/rendering/editable_text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -738,13 +738,13 @@ class RenderEditableTextLine extends RenderEditableBox {
final background = node.style.get(ParchmentAttribute.backgroundColor);
if (!isInlineCode && background == null) return;

final Color color;
Color? color;
if (isInlineCode) {
color = _inlineCodeTheme.backgroundColor ?? Colors.transparent;
} else {
color = Color(background?.value ?? Colors.transparent.value);
color = _inlineCodeTheme.backgroundColor;
} else if (background?.value case final int value) {
color = Color(value);
}
if (color == Colors.transparent) return;
if (color == null || color == Colors.transparent) return;

final textRange = TextSelection(
baseOffset: node.offset, extentOffset: node.offset + node.length);
Expand Down
20 changes: 10 additions & 10 deletions packages/fleather/lib/src/widgets/checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ class _CheckboxDefaultsM3 extends CheckboxThemeData {
WidgetStateProperty<Color> get fillColor {
return WidgetStateProperty.resolveWith((Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return _colors.onSurface.withOpacity(0.38);
return _colors.onSurface.withValues(alpha: 0.38);
}
if (states.contains(WidgetState.error)) {
return _colors.error;
Expand Down Expand Up @@ -546,35 +546,35 @@ class _CheckboxDefaultsM3 extends CheckboxThemeData {
return WidgetStateProperty.resolveWith((Set<WidgetState> states) {
if (states.contains(WidgetState.error)) {
if (states.contains(WidgetState.pressed)) {
return _colors.error.withOpacity(0.12);
return _colors.error.withValues(alpha: 0.12);
}
if (states.contains(WidgetState.hovered)) {
return _colors.error.withOpacity(0.08);
return _colors.error.withValues(alpha: 0.08);
}
if (states.contains(WidgetState.focused)) {
return _colors.error.withOpacity(0.12);
return _colors.error.withValues(alpha: 0.12);
}
}
if (states.contains(WidgetState.selected)) {
if (states.contains(WidgetState.pressed)) {
return _colors.onSurface.withOpacity(0.12);
return _colors.onSurface.withValues(alpha: 0.12);
}
if (states.contains(WidgetState.hovered)) {
return _colors.primary.withOpacity(0.08);
return _colors.primary.withValues(alpha: 0.08);
}
if (states.contains(WidgetState.focused)) {
return _colors.primary.withOpacity(0.12);
return _colors.primary.withValues(alpha: 0.12);
}
return Colors.transparent;
}
if (states.contains(WidgetState.pressed)) {
return _colors.primary.withOpacity(0.12);
return _colors.primary.withValues(alpha: 0.12);
}
if (states.contains(WidgetState.hovered)) {
return _colors.onSurface.withOpacity(0.08);
return _colors.onSurface.withValues(alpha: 0.08);
}
if (states.contains(WidgetState.focused)) {
return _colors.onSurface.withOpacity(0.12);
return _colors.onSurface.withValues(alpha: 0.12);
}
return Colors.transparent;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/fleather/lib/src/widgets/cursor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class CursorController extends ChangeNotifier {

void _onCursorColorTick() {
_cursorColor.value =
_style.color.withOpacity(_cursorBlinkOpacityController.value);
_style.color.withValues(alpha: _cursorBlinkOpacityController.value);
cursorBlink.value =
showCursor.value && _cursorBlinkOpacityController.value > 0;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fleather/lib/src/widgets/editable_text_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ class EditableTextBlock extends StatelessWidget {
children
.mapIndexed((i, _) => _NumberPoint(
number: i + 1,
style: theme.code.style
.copyWith(color: theme.code.style.color?.withOpacity(0.4)),
style: theme.code.style.copyWith(
color: theme.code.style.color?.withValues(alpha: 0.4)),
width: 32.0,
padding: 16.0,
withDot: false,
Expand Down
10 changes: 5 additions & 5 deletions packages/fleather/lib/src/widgets/editor.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:math' as math;
import 'dart:math';

Expand Down Expand Up @@ -63,7 +64,6 @@ Widget defaultSpellCheckMenuBuilder(
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.fuchsia:
default:
throw UnsupportedError('Only iOS and Android support spell check');
}
}
Expand Down Expand Up @@ -423,7 +423,7 @@ class _FleatherEditorState extends State<FleatherEditor>
cursorOpacityAnimates = true;
cursorColor = selectionTheme.cursorColor ?? cupertinoTheme.primaryColor;
selectionColor = selectionTheme.selectionColor ??
cupertinoTheme.primaryColor.withOpacity(0.40);
cupertinoTheme.primaryColor.withValues(alpha: 0.40);
cursorRadius = const Radius.circular(2.0);
cursorOffset = Offset(
iOSHorizontalOffset / MediaQuery.of(context).devicePixelRatio, 0);
Expand All @@ -437,7 +437,7 @@ class _FleatherEditorState extends State<FleatherEditor>
cursorOpacityAnimates = false;
cursorColor = selectionTheme.cursorColor ?? cupertinoTheme.primaryColor;
selectionColor = selectionTheme.selectionColor ??
cupertinoTheme.primaryColor.withOpacity(0.40);
cupertinoTheme.primaryColor.withValues(alpha: 0.40);
cursorRadius ??= const Radius.circular(2.0);
cursorOffset = Offset(
iOSHorizontalOffset / MediaQuery.of(context).devicePixelRatio, 0);
Expand All @@ -451,7 +451,7 @@ class _FleatherEditorState extends State<FleatherEditor>
cursorOpacityAnimates = false;
cursorColor = selectionTheme.cursorColor ?? theme.colorScheme.primary;
selectionColor = selectionTheme.selectionColor ??
theme.colorScheme.primary.withOpacity(0.40);
theme.colorScheme.primary.withValues(alpha: 0.40);
break;

case TargetPlatform.linux:
Expand All @@ -462,7 +462,7 @@ class _FleatherEditorState extends State<FleatherEditor>
cursorOpacityAnimates = false;
cursorColor = selectionTheme.cursorColor ?? theme.colorScheme.primary;
selectionColor = selectionTheme.selectionColor ??
theme.colorScheme.primary.withOpacity(0.40);
theme.colorScheme.primary.withValues(alpha: 0.40);
break;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/fleather/lib/src/widgets/editor_toolbar.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'package:fleather/util.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:parchment/parchment.dart';
Expand Down Expand Up @@ -473,7 +474,7 @@ class _ColorButtonState extends State<ColorButton> {
final selectedColor = await (widget.pickColor ?? _defaultPickColor)(
context, widget.nullColorLabel);
final attribute = selectedColor != null
? widget.attributeKey.withColor(selectedColor.value)
? widget.attributeKey.withColor(selectedColor.value32Bits)
: widget.attributeKey.unset;
widget.controller.formatSelection(attribute);
toolbar.requestKeyboard();
Expand Down
4 changes: 2 additions & 2 deletions packages/fleather/lib/src/widgets/link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class _CupertinoAction extends StatelessWidget {
Icon(
icon,
size: theme.iconTheme.size,
color: theme.colorScheme.onSurface.withOpacity(0.75),
color: theme.colorScheme.onSurface.withValues(alpha: 0.75),
)
],
),
Expand Down Expand Up @@ -165,7 +165,7 @@ class _MaterialAction extends StatelessWidget {
leading: Icon(
icon,
size: theme.iconTheme.size,
color: theme.colorScheme.onSurface.withOpacity(0.75),
color: theme.colorScheme.onSurface.withValues(alpha: 0.75),
),
title: Text(title),
onTap: onPressed,
Expand Down
Loading

0 comments on commit 6abce16

Please sign in to comment.