From 81443ea3def49c5cee672a6de151dc34d4e20f61 Mon Sep 17 00:00:00 2001 From: Feras abdalrahman Date: Tue, 7 Jan 2025 00:57:11 +0300 Subject: [PATCH] upgrade to latest flutter --- lib/src/helper/filter_helper.dart | 2 +- lib/src/helper/pluto_aggregate_helper.dart | 6 +++--- lib/src/helper/pluto_move_direction.dart | 2 -- lib/src/helper/show_column_menu.dart | 4 ++-- .../manager/event/pluto_grid_cell_gesture_event.dart | 1 - lib/src/manager/pluto_grid_state_manager.dart | 2 +- lib/src/manager/state/row_state.dart | 2 +- lib/src/manager/state/selecting_state.dart | 1 - lib/src/widgets/pluto_scrollbar.dart | 12 +++++++----- lib/src/widgets/pluto_shadow_container.dart | 2 +- lib/src/widgets/pluto_shadow_line.dart | 2 +- pubspec.yaml | 2 +- 12 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/src/helper/filter_helper.dart b/lib/src/helper/filter_helper.dart index 672c5fcc4..15f4f2325 100644 --- a/lib/src/helper/filter_helper.dart +++ b/lib/src/helper/filter_helper.dart @@ -111,7 +111,7 @@ class FilterHelper { }; } - /// Converts List type with filtering information to Map type. + /// Converts List<PlutoRow> type with filtering information to Map type. /// /// [allField] determines the key value of the filter applied to the entire scope. /// Default is all. diff --git a/lib/src/helper/pluto_aggregate_helper.dart b/lib/src/helper/pluto_aggregate_helper.dart index 9ecdc3f78..2aa419435 100644 --- a/lib/src/helper/pluto_aggregate_helper.dart +++ b/lib/src/helper/pluto_aggregate_helper.dart @@ -1,5 +1,5 @@ import 'package:collection/collection.dart' - show IterableExtension, IterableNullableExtension, IterableNumberExtension; + show IterableExtension, IterableNumberExtension; import 'package:pluto_grid_plus/pluto_grid_plus.dart'; class PlutoAggregateHelper { @@ -23,7 +23,7 @@ class PlutoAggregateHelper { .map( (e) => e.cells[column.field]?.value as num?, ) - .whereNotNull(); + .nonNulls; return numbers.isNotEmpty ? numberColumn.toNumber(numberColumn.applyFormat(numbers.sum)) @@ -50,7 +50,7 @@ class PlutoAggregateHelper { .map( (e) => e.cells[column.field]?.value as num?, ) - .whereNotNull(); + .nonNulls; return numbers.isNotEmpty ? numberColumn.toNumber(numberColumn.applyFormat(numbers.average)) diff --git a/lib/src/helper/pluto_move_direction.dart b/lib/src/helper/pluto_move_direction.dart index b99c3f685..51b8a1ac2 100644 --- a/lib/src/helper/pluto_move_direction.dart +++ b/lib/src/helper/pluto_move_direction.dart @@ -32,8 +32,6 @@ enum PlutoMoveDirection { case PlutoMoveDirection.right: case PlutoMoveDirection.down: return 1; - default: - return 0; } } diff --git a/lib/src/helper/show_column_menu.dart b/lib/src/helper/show_column_menu.dart index 585a65f16..4f5138def 100644 --- a/lib/src/helper/show_column_menu.dart +++ b/lib/src/helper/show_column_menu.dart @@ -104,7 +104,7 @@ List> _getDefaultColumnMenuItems({ }) { final Color textColor = stateManager.style.cellTextStyle.color!; - final Color disableTextColor = textColor.withOpacity(0.5); + final Color disableTextColor = textColor.withAlpha((0.5 * 255).toInt()); final bool enoughFrozenColumnsWidth = stateManager.enoughFrozenColumnsWidth( stateManager.maxWidth! - column.width, @@ -182,7 +182,7 @@ PopupMenuItem _buildMenuItem({ child: Text( text, style: TextStyle( - color: enabled ? textColor : textColor!.withOpacity(0.5), + color: enabled ? textColor : textColor!.withAlpha((0.5 * 255).toInt()), fontSize: 13, ), ), diff --git a/lib/src/manager/event/pluto_grid_cell_gesture_event.dart b/lib/src/manager/event/pluto_grid_cell_gesture_event.dart index 10b23f1f1..38f0a1a48 100644 --- a/lib/src/manager/event/pluto_grid_cell_gesture_event.dart +++ b/lib/src/manager/event/pluto_grid_cell_gesture_event.dart @@ -38,7 +38,6 @@ class PlutoGridCellGestureEvent extends PlutoGridEvent { case PlutoGridGestureType.onSecondaryTap: _onSecondaryTap(stateManager); break; - default: } } diff --git a/lib/src/manager/pluto_grid_state_manager.dart b/lib/src/manager/pluto_grid_state_manager.dart index b977d151a..b060db3f8 100644 --- a/lib/src/manager/pluto_grid_state_manager.dart +++ b/lib/src/manager/pluto_grid_state_manager.dart @@ -332,7 +332,7 @@ class PlutoGridStateManager extends PlutoGridStateChangeNotifier { /// [PlutoGridStateManager.initializeRowsAsync] repeats [Timer] every [duration], /// Process the setting of [refRows] by the size of [chunkSize]. /// [Isolate] is a good way to handle CPU heavy work, but - /// The condition that List cannot be passed to Isolate + /// The condition that List<PlutoRow> cannot be passed to Isolate /// solves the problem of UI freezing by dividing the work with Timer. /// /// {@macro initialize_rows_params} diff --git a/lib/src/manager/state/row_state.dart b/lib/src/manager/state/row_state.dart index 8aeb7fa26..0d32c276e 100644 --- a/lib/src/manager/state/row_state.dart +++ b/lib/src/manager/state/row_state.dart @@ -5,7 +5,7 @@ import 'package:pluto_grid_plus/pluto_grid_plus.dart'; abstract class IRowState { List get rows; - /// [refRows] is a List type and holds the entire row data. + /// [refRows] is a List<PlutoRow> type and holds the entire row data. /// /// [refRows] returns a list of final results /// according to pagination and filtering status. diff --git a/lib/src/manager/state/selecting_state.dart b/lib/src/manager/state/selecting_state.dart index dfcd95971..89a59f827 100644 --- a/lib/src/manager/state/selecting_state.dart +++ b/lib/src/manager/state/selecting_state.dart @@ -235,7 +235,6 @@ mixin SelectingState implements IPlutoGridState { setCurrentSelectingRowsByRange(0, refRows.length - 1); break; case PlutoGridSelectingMode.none: - default: break; } } diff --git a/lib/src/widgets/pluto_scrollbar.dart b/lib/src/widgets/pluto_scrollbar.dart index 894468551..c430a9693 100644 --- a/lib/src/widgets/pluto_scrollbar.dart +++ b/lib/src/widgets/pluto_scrollbar.dart @@ -982,20 +982,20 @@ class _ScrollbarPainter extends ChangeNotifier implements CustomPainter { Paint get _paintThumb { return Paint() ..color = - color.withOpacity(color.opacity * fadeoutOpacityAnimation.value); + color.withAlpha((color.a * fadeoutOpacityAnimation.value).toInt()); } Paint _paintTrack({bool isBorder = false}) { if (isBorder) { return Paint() - ..color = trackBorderColor.withOpacity( - trackBorderColor.opacity * fadeoutOpacityAnimation.value) + ..color = trackBorderColor.withAlpha( + (trackBorderColor.a * fadeoutOpacityAnimation.value).toInt()) ..style = PaintingStyle.stroke ..strokeWidth = 1.0; } return Paint() ..color = trackColor - .withOpacity(trackColor.opacity * fadeoutOpacityAnimation.value); + .withAlpha((trackColor.a * fadeoutOpacityAnimation.value).toInt()); } void _paintScrollbar( @@ -1200,7 +1200,9 @@ class _ScrollbarPainter extends ChangeNotifier implements CustomPainter { void paint(Canvas canvas, Size size) { if (_lastAxisDirection == null || _lastMetrics == null || - _lastMetrics!.maxScrollExtent <= _lastMetrics!.minScrollExtent) return; + _lastMetrics!.maxScrollExtent <= _lastMetrics!.minScrollExtent) { + return; + } // Skip painting if there's not enough space. if (_lastMetrics!.viewportDimension <= _mainAxisPadding || diff --git a/lib/src/widgets/pluto_shadow_container.dart b/lib/src/widgets/pluto_shadow_container.dart index c68087ec5..de0bcc0af 100644 --- a/lib/src/widgets/pluto_shadow_container.dart +++ b/lib/src/widgets/pluto_shadow_container.dart @@ -41,7 +41,7 @@ class PlutoShadowContainer extends StatelessWidget { ), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.5), + color: Colors.grey.withAlpha((0.5 * 255).toInt()), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), // changes position of shadow diff --git a/lib/src/widgets/pluto_shadow_line.dart b/lib/src/widgets/pluto_shadow_line.dart index 0496cccbb..9f8dc5e5d 100644 --- a/lib/src/widgets/pluto_shadow_line.dart +++ b/lib/src/widgets/pluto_shadow_line.dart @@ -25,7 +25,7 @@ class PlutoShadowLine extends StatelessWidget { boxShadow: shadow == true ? [ BoxShadow( - color: Colors.grey.withOpacity(0.15), + color: Colors.grey.withAlpha((0.15 * 255).toInt()), spreadRadius: 1, blurRadius: 3, offset: reverse == true diff --git a/pubspec.yaml b/pubspec.yaml index 852b8286d..9ebb7694d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: sdk: flutter # Follows the intl version included in Flutter. # https://github.com/flutter/flutter/blob/84a1e904f44f9b0e9c4510138010edcc653163f8/packages/flutter_localizations/pubspec.yaml#L11 - intl: ^0.19.0 + intl: ^0.20.1 rxdart: ^0.28.0 collection: ^1.18.0