Skip to content

Commit

Permalink
version 5.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
suragch committed May 15, 2023
1 parent 259e7e5 commit 20fe5de
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 47 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ packages:
path: ".."
relative: true
source: path
version: "4.0.0"
version: "5.0.0"
path:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/dialog/mongol_button_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Widget> children,
Axis direction = Axis.vertical,
MainAxisSize mainAxisSize = MainAxisSize.max,
Expand Down
21 changes: 1 addition & 20 deletions lib/src/editing/text_selection/mongol_text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -932,22 +932,13 @@ 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
// through a touch screen (via either a finger or a stylus). A mouse shouldn't
// 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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
37 changes: 22 additions & 15 deletions lib/src/text/mongol_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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;

Expand All @@ -144,17 +144,17 @@ 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
/// edge of the box.
///
/// 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;

Expand All @@ -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,
Expand Down Expand Up @@ -217,9 +218,15 @@ class MongolText extends StatelessWidget {
name: 'textSpan', style: DiagnosticsTreeStyle.transition));
}
style?.debugFillProperties(properties);
properties.add(EnumProperty<MongolTextAlign>('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<TextOverflow>('overflow', overflow, defaultValue: null));
properties.add(EnumProperty<MongolTextAlign>('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<TextOverflow>('overflow', overflow, defaultValue: null));
properties.add(
DoubleProperty('textScaleFactor', textScaleFactor, defaultValue: 1.0));
properties.add(IntProperty('maxLines', maxLines, defaultValue: null));
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 20fe5de

Please sign in to comment.