From 467086eb456aafb18a1ed515cbdf8a33f902c0d4 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Sun, 19 May 2024 14:10:09 +0530 Subject: [PATCH] Dart fixes (deprecated methods and classes). --- CHANGELOG.md | 3 + example/lib/custom/files_custom_example.dart | 4 +- example/lib/custom/full_custom_example.dart | 2 +- example/lib/main.dart | 5 +- example/pubspec.lock | 70 +++++++++++++------ lib/src/image_file_view/io_preview.dart | 3 +- lib/src/image_file_view/web_preview.dart | 3 +- .../default_draggable_item_widget.dart | 5 +- lib/src/widgets/default_initial_widget.dart | 4 +- lib/src/widgets/draggable_item_ink_well.dart | 2 +- pubspec.yaml | 2 +- 11 files changed, 64 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14f48c3..301b0cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.0.2 +- Fixed deprecated methods and classes. + ## 1.0.1 - Added support for network image at `ImageFile` class for initial selected images. - Fixed error icon for `DefaultDraggableItemWidget`, Added file type based icon. diff --git a/example/lib/custom/files_custom_example.dart b/example/lib/custom/files_custom_example.dart index d57d27a..9af24f4 100644 --- a/example/lib/custom/files_custom_example.dart +++ b/example/lib/custom/files_custom_example.dart @@ -36,7 +36,7 @@ class _FilesCustomExampleState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Color.lerp(fileColor(imageFile.extension), - Theme.of(context).colorScheme.background, 0.85), + Theme.of(context).colorScheme.surface, 0.85), ), alignment: Alignment.center, padding: const EdgeInsets.only(top: 16), @@ -83,7 +83,7 @@ class _FilesCustomExampleState extends State { child: Icon( Icons.close, size: 18, - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, )), )), ], diff --git a/example/lib/custom/full_custom_example.dart b/example/lib/custom/full_custom_example.dart index 480ef29..cbccbc8 100644 --- a/example/lib/custom/full_custom_example.dart +++ b/example/lib/custom/full_custom_example.dart @@ -68,7 +68,7 @@ class _FullCustomExampleState extends State { child: Icon( Icons.delete_forever_rounded, size: 18, - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, )), )), ], diff --git a/example/lib/main.dart b/example/lib/main.dart index 98b75f7..df4ed41 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -18,9 +18,8 @@ void main() { ), elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( - elevation: MaterialStateProperty.all(0), - backgroundColor: - MaterialStateProperty.all(Colors.purple.shade50)), + elevation: WidgetStateProperty.all(0), + backgroundColor: WidgetStateProperty.all(Colors.purple.shade50)), )), home: const DemoPage(), )); diff --git a/example/pubspec.lock b/example/pubspec.lock index d392619..708f13e 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" cross_file: dependency: transitive description: @@ -248,6 +248,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -260,26 +284,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.12.0" mime: dependency: transitive description: @@ -294,15 +318,15 @@ packages: path: ".." relative: true source: path - version: "1.0.0" + version: "1.0.2" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" plugin_platform_interface: dependency: transitive description: @@ -328,18 +352,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -360,10 +384,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.0" typed_data: dependency: transitive description: @@ -380,14 +404,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "14.2.1" win32: dependency: transitive description: @@ -397,5 +421,5 @@ packages: source: hosted version: "5.0.3" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/lib/src/image_file_view/io_preview.dart b/lib/src/image_file_view/io_preview.dart index 3478090..fb98c9b 100644 --- a/lib/src/image_file_view/io_preview.dart +++ b/lib/src/image_file_view/io_preview.dart @@ -25,7 +25,8 @@ class ImageFileView extends StatelessWidget { return Container( clipBehavior: Clip.antiAlias, decoration: BoxDecoration( - color: backgroundColor ?? Theme.of(context).colorScheme.surfaceVariant, + color: backgroundColor ?? + Theme.of(context).colorScheme.surfaceContainerHighest, borderRadius: borderRadius ?? BorderRadius.zero, ), child: Uri.tryParse(imageFile.path!)?.scheme.startsWith('http') == true diff --git a/lib/src/image_file_view/web_preview.dart b/lib/src/image_file_view/web_preview.dart index 549ab84..ee49f30 100644 --- a/lib/src/image_file_view/web_preview.dart +++ b/lib/src/image_file_view/web_preview.dart @@ -23,7 +23,8 @@ class ImageFileView extends StatelessWidget { return Container( clipBehavior: Clip.antiAlias, decoration: BoxDecoration( - color: backgroundColor ?? Theme.of(context).colorScheme.surfaceVariant, + color: backgroundColor ?? + Theme.of(context).colorScheme.surfaceContainerHighest, borderRadius: borderRadius ?? BorderRadius.zero, ), child: imageFile.path == null diff --git a/lib/src/widgets/default_draggable_item_widget.dart b/lib/src/widgets/default_draggable_item_widget.dart index 9516ba9..5a570d3 100644 --- a/lib/src/widgets/default_draggable_item_widget.dart +++ b/lib/src/widgets/default_draggable_item_widget.dart @@ -2,9 +2,6 @@ import 'package:flutter/material.dart'; import 'package:multi_image_picker_view/multi_image_picker_view.dart'; import 'package:multi_image_picker_view/src/multi_image_picker_controller_wrapper.dart'; -import '../image_file.dart'; -import '../image_file_view/image_file_view.dart'; - class DefaultDraggableItemWidget extends StatelessWidget { const DefaultDraggableItemWidget({ super.key, @@ -61,7 +58,7 @@ class DefaultDraggableItemWidget extends StatelessWidget { BoxDecoration( color: Theme.of(context) .colorScheme - .surfaceVariant + .surfaceContainerHighest .withOpacity(0.5), shape: BoxShape.circle, ), diff --git a/lib/src/widgets/default_initial_widget.dart b/lib/src/widgets/default_initial_widget.dart index 04589b4..8778390 100644 --- a/lib/src/widgets/default_initial_widget.dart +++ b/lib/src/widgets/default_initial_widget.dart @@ -27,8 +27,8 @@ class DefaultInitialWidget extends StatelessWidget { child: Material( color: Colors.transparent, child: InkWell( - overlayColor: MaterialStateProperty.resolveWith((states) { - if (states.contains(MaterialState.pressed)) { + overlayColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { return Theme.of(context).colorScheme.primary.withOpacity(0.15); } return Theme.of(context).colorScheme.primary.withOpacity(0.07); diff --git a/lib/src/widgets/draggable_item_ink_well.dart b/lib/src/widgets/draggable_item_ink_well.dart index 8a98639..6840657 100644 --- a/lib/src/widgets/draggable_item_ink_well.dart +++ b/lib/src/widgets/draggable_item_ink_well.dart @@ -8,7 +8,7 @@ class DraggableItemInkWell extends StatelessWidget { final Color? hoverColor; final Color? highlightColor; final Color? focusColor; - final MaterialStateProperty? overlayColor; + final WidgetStateProperty? overlayColor; final Color? splashColor; final InteractiveInkFeatureFactory? splashFactory; diff --git a/pubspec.yaml b/pubspec.yaml index d79a0b7..fc371dd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: multi_image_picker_view description: A complete widget which can easily pick multiple images from device and display them in UI. Also picked image can be re-ordered and removed easily. -version: 1.0.1 +version: 1.0.2 homepage: https://github.com/shubham-gupta-16/multi_image_picker_view repository: https://github.com/shubham-gupta-16/multi_image_picker_view issue_tracker: https://github.com/shubham-gupta-16/multi_image_picker_view/issues