diff --git a/CHANGELOG.md b/CHANGELOG.md index 9604163..2e40823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [5.0.0] - 2023.05.15 + +- Update APIs to match the Flutter 3.10 and Dart 3.0 release. (#45) (@Satsrag) +- This is a major version bump because of the breaking changes in the Flutter update and the new requirement to use Dart 3.0. +- The known issues in the version 4.0.0 changelog notes still exist. + ## [4.0.0] - 2023.02.10 - Update APIs to match the Flutter 3.7 release. Theoretically this may have added some improvements, but the main reason was that Flutter 3.7 broke the old package. This is a major version bump because some of the API changes were potentially breaking for users of `mongol` 3.4.0. (#38) diff --git a/analysis_options.yaml b/analysis_options.yaml index e25ad55..a9a4340 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,9 +2,9 @@ include: package:flutter_lints/flutter.yaml analyzer: exclude: [build/**] - strong-mode: - implicit-casts: false - implicit-dynamic: false + language: + strict-casts: true + strict-raw-types: true linter: rules: diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 7835c04..1fa249f 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -2,9 +2,9 @@ include: package:flutter_lints/flutter.yaml analyzer: exclude: [build/**] - strong-mode: - implicit-casts: false - # implicit-dynamic: false + language: + strict-casts: true + strict-raw-types: true linter: rules: diff --git a/example/lib/main.dart b/example/lib/main.dart index 2de4ce0..6f03025 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -18,7 +18,7 @@ import 'demos/resizable_text_demo.dart'; import 'demos/text_demo.dart'; import 'demos/text_span_demo.dart'; -const versionTitle = 'Flutter mongol package 4.0.0'; +const versionTitle = 'Flutter mongol package 5.0.0'; void main() { runApp(const DemoApp()); diff --git a/example/pubspec.lock b/example/pubspec.lock index 5869fb1..1a7d18a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -113,7 +113,7 @@ packages: path: ".." relative: true source: path - version: "4.0.0" + version: "5.0.0" path: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index cb77c5b..6605c31 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: none version: 1.0.0+1 environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0-0 <4.0.0" dependencies: flutter: diff --git a/lib/src/dialog/mongol_button_bar.dart b/lib/src/dialog/mongol_button_bar.dart index 64d3cbe..9988569 100644 --- a/lib/src/dialog/mongol_button_bar.dart +++ b/lib/src/dialog/mongol_button_bar.dart @@ -109,7 +109,7 @@ class MongolButtonBar extends StatelessWidget { class _ButtonBarColumn extends Flex { /// Creates a button bar that attempts to display in a column, but displays in /// a row if there is insufficient vertical space. - _ButtonBarColumn({ + const _ButtonBarColumn({ required List children, Axis direction = Axis.vertical, MainAxisSize mainAxisSize = MainAxisSize.max, diff --git a/lib/src/editing/text_selection/mongol_text_selection.dart b/lib/src/editing/text_selection/mongol_text_selection.dart index 25a2455..9df1920 100644 --- a/lib/src/editing/text_selection/mongol_text_selection.dart +++ b/lib/src/editing/text_selection/mongol_text_selection.dart @@ -932,12 +932,6 @@ class MongolTextSelectionGestureDetectorBuilder { if (!delegate.selectionEnabled) { return; } - // TODO(Renzo-Olivares): Migrate text selection gestures away from saving state - // in renderEditable. The gesture callbacks can use the details objects directly - // in callbacks variants that provide them [TapGestureRecognizer.onSecondaryTap] - // vs [TapGestureRecognizer.onSecondaryTapUp] instead of having to track state in - // renderEditable. When this migration is complete we should remove this hack. - // See https://github.com/flutter/flutter/issues/115130. renderEditable .handleTapDown(TapDownDetails(globalPosition: details.globalPosition)); // The selection overlay should only be shown when the user is interacting @@ -945,9 +939,6 @@ class MongolTextSelectionGestureDetectorBuilder { // trigger the selection overlay. // For backwards-compatibility, we treat a null kind the same as touch. final PointerDeviceKind? kind = details.kind; - // TODO(justinmc): Should a desktop platform show its selection toolbar when - // receiving a tap event? Say a Windows device with a touchscreen. - // https://github.com/flutter/flutter/issues/106586 _shouldShowSelectionToolbar = kind == null || kind == PointerDeviceKind.touch || kind == PointerDeviceKind.stylus; @@ -1093,10 +1084,6 @@ class MongolTextSelectionGestureDetectorBuilder { case PointerDeviceKind.trackpad: case PointerDeviceKind.stylus: case PointerDeviceKind.invertedStylus: - // TODO(camsim99): Determine spell check toolbar behavior in these cases: - // https://github.com/flutter/flutter/issues/119573. - // Precise devices should place the cursor at a precise position if the - // word at the text position is not misspelled. renderEditable.selectPosition(cause: SelectionChangedCause.tap); case PointerDeviceKind.touch: case PointerDeviceKind.unknown: @@ -1334,12 +1321,6 @@ class MongolTextSelectionGestureDetectorBuilder { /// * [onSecondaryTap], which is typically called after this. @protected void onSecondaryTapDown(TapDownDetails details) { - // TODO(Renzo-Olivares): Migrate text selection gestures away from saving state - // in renderEditable. The gesture callbacks can use the details objects directly - // in callbacks variants that provide them [TapGestureRecognizer.onSecondaryTap] - // vs [TapGestureRecognizer.onSecondaryTapUp] instead of having to track state in - // renderEditable. When this migration is complete we should remove this hack. - // See https://github.com/flutter/flutter/issues/115130. renderEditable.handleSecondaryTapDown( TapDownDetails(globalPosition: details.globalPosition)); _shouldShowSelectionToolbar = true; @@ -1524,7 +1505,7 @@ class MongolTextSelectionGestureDetectorBuilder { ); case PointerDeviceKind.touch: case PointerDeviceKind.unknown: - // For Android, Fucshia, and iOS platforms, a touch drag + // For Android, Fuchsia, and iOS platforms, a touch drag // does not initiate unless the editable has focus. if (renderEditable.hasFocus) { renderEditable.selectPositionAt( diff --git a/lib/src/editing/text_selection/mongol_text_selection_toolbar.dart b/lib/src/editing/text_selection/mongol_text_selection_toolbar.dart index f86a37f..b647ff2 100644 --- a/lib/src/editing/text_selection/mongol_text_selection_toolbar.dart +++ b/lib/src/editing/text_selection/mongol_text_selection_toolbar.dart @@ -328,7 +328,7 @@ class _TextSelectionToolbarTrailingEdgeAlignRenderBox extends RenderProxyBox { // Renders the menu items in the correct positions in the menu and its overflow // submenu based on calculating which item would first overflow. class _TextSelectionToolbarItemsLayout extends MultiChildRenderObjectWidget { - _TextSelectionToolbarItemsLayout({ + const _TextSelectionToolbarItemsLayout({ Key? key, required this.isLeft, required this.overflowOpen, diff --git a/lib/src/text/mongol_text.dart b/lib/src/text/mongol_text.dart index 34637eb..fe23866 100644 --- a/lib/src/text/mongol_text.dart +++ b/lib/src/text/mongol_text.dart @@ -23,16 +23,16 @@ import '../base/mongol_text_align.dart'; /// be merged with the closest enclosing [DefaultTextStyle]. This merging /// behavior is useful, for example, to make the text bold while using the /// default font family and size. -/// +/// /// {@tool snippet} /// /// This example shows how to display text using the [MongolText] widget with the /// [overflow] set to [TextOverflow.ellipsis]. /// -/// If the text is shorter than the available space, it is displayed in full +/// If the text is shorter than the available space, it is displayed in full /// without an ellipsis. /// -/// If the text overflows, the Text widget displays an ellipsis to trim the +/// If the text overflows, the Text widget displays an ellipsis to trim the /// overflowing text. /// /// ```dart @@ -73,8 +73,8 @@ class MongolText extends StatelessWidget { /// closest enclosing [DefaultTextStyle]. /// /// The [overflow] property's behavior is affected by the [softWrap] argument. - /// If the [softWrap] is true or null, the glyph causing overflow, and those - /// that follow, will not be rendered. Otherwise, it will be shown with the + /// If the [softWrap] is true or null, the glyph causing overflow, and those + /// that follow, will not be rendered. Otherwise, it will be shown with the /// given overflow option. const MongolText( this.data, { @@ -132,7 +132,7 @@ class MongolText extends StatelessWidget { /// Whether the text should break at soft line breaks. /// - /// If false, the glyphs in the text will be positioned as if there were + /// If false, the glyphs in the text will be positioned as if there were /// unlimited vertical space. final bool? softWrap; @@ -144,8 +144,8 @@ class MongolText extends StatelessWidget { /// Font pixels per logical pixel final double? textScaleFactor; - /// An optional maximum number of lines for the text to span, wrapping if - /// necessary. If the text exceeds the given number of lines, it will be + /// An optional maximum number of lines for the text to span, wrapping if + /// necessary. If the text exceeds the given number of lines, it will be /// truncated according to [overflow]. /// /// If this is 1, text will not wrap. Otherwise, text will be wrapped at the @@ -153,8 +153,8 @@ class MongolText extends StatelessWidget { /// /// If this is null, but there is an ambient [DefaultTextStyle] that specifies /// an explicit number for its [DefaultTextStyle.maxLines], then the - /// [DefaultTextStyle] value will take precedence. You can use a - /// [MongolRichText] widget directly to entirely override the + /// [DefaultTextStyle] value will take precedence. You can use a + /// [MongolRichText] widget directly to entirely override the /// [DefaultTextStyle]. final int? maxLines; @@ -179,11 +179,12 @@ class MongolText extends StatelessWidget { if (style == null || style!.inherit) { effectiveTextStyle = defaultTextStyle.style.merge(effectiveTextStyle); } - if (MediaQuery.boldTextOverride(context)) { + if (MediaQuery.boldTextOf(context)) { effectiveTextStyle = effectiveTextStyle! .merge(const TextStyle(fontWeight: FontWeight.bold)); } - final defaultTextAlign = mapHorizontalToMongolTextAlign(defaultTextStyle.textAlign); + final defaultTextAlign = + mapHorizontalToMongolTextAlign(defaultTextStyle.textAlign); Widget result = MongolRichText( textAlign: textAlign ?? defaultTextAlign ?? MongolTextAlign.top, softWrap: softWrap ?? defaultTextStyle.softWrap, @@ -217,9 +218,15 @@ class MongolText extends StatelessWidget { name: 'textSpan', style: DiagnosticsTreeStyle.transition)); } style?.debugFillProperties(properties); - properties.add(EnumProperty('textAlign', textAlign, defaultValue: null)); - properties.add(FlagProperty('softWrap', value: softWrap, ifTrue: 'wrapping at box height', ifFalse: 'no wrapping except at line break characters', showName: true)); - properties.add(EnumProperty('overflow', overflow, defaultValue: null)); + properties.add(EnumProperty('textAlign', textAlign, + defaultValue: null)); + properties.add(FlagProperty('softWrap', + value: softWrap, + ifTrue: 'wrapping at box height', + ifFalse: 'no wrapping except at line break characters', + showName: true)); + properties.add( + EnumProperty('overflow', overflow, defaultValue: null)); properties.add( DoubleProperty('textScaleFactor', textScaleFactor, defaultValue: 1.0)); properties.add(IntProperty('maxLines', maxLines, defaultValue: null)); diff --git a/pubspec.yaml b/pubspec.yaml index b4291b5..46229b5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: mongol description: Flutter widget package for displaying and editing vertical Mongolian text. # When updating version, also update CHANGELOG.md and example/lib/main.dart -version: 4.0.0 +version: 5.0.0 homepage: https://github.com/suragch/mongol environment: