From 4b6e62863b743a52a8997a9f0a2a85a7c05e7a2d Mon Sep 17 00:00:00 2001 From: thelukewalton Date: Thu, 5 Jun 2025 15:34:16 +0100 Subject: [PATCH 1/4] deps: Update to flutter 3.32.x --- .fvmrc | 3 + .github/workflows/on-main.yml | 2 +- .github/workflows/on-release.yml | 4 +- .github/workflows/pull-request.yml | 4 +- .gitignore | 6 +- analysis_options.yaml | 3 + example/.gitignore | 2 + example/lib/pages/components/comment.dart | 5 ++ .../lib/pages/components/expansion_tile.dart | 2 +- .../Flutter/GeneratedPluginRegistrant.swift | 4 +- example/macos/Podfile.lock | 10 +-- .../xcshareddata/xcschemes/Runner.xcscheme | 1 + example/macos/Runner/AppDelegate.swift | 4 ++ example/pubspec.yaml | 20 +++--- lib/src/components/atoms/button.dart | 2 +- lib/src/components/atoms/expandable.dart | 4 +- .../components/atoms/icon_text_button.dart | 2 +- lib/src/components/atoms/selection_pills.dart | 4 +- lib/src/components/atoms/speed_slider.dart | 4 +- .../components/molecules/bottom_sheet.dart | 3 +- .../molecules/date_range_picker.dart | 10 +-- lib/src/components/molecules/dropdown.dart | 2 +- .../components/molecules/input_dialog.dart | 2 +- .../molecules/interval_time_picker.dart | 25 ++++--- lib/src/components/molecules/list.dart | 2 +- .../components/molecules/slidable_button.dart | 2 +- .../molecules/speed_scrollable_list.dart | 2 +- lib/src/components/molecules/star_rating.dart | 2 +- lib/src/components/molecules/tab_bar.dart | 6 +- lib/src/components/molecules/toolbar.dart | 2 +- .../components/molecules/vertical_nav.dart | 4 +- lib/src/components/organisms/app_bar.dart | 2 +- .../organisms/camera/camera_page.dart | 12 ++-- .../organisms/chat/audio_player.dart | 8 +-- .../organisms/chat/audio_recorder.dart | 2 +- .../chat/message_body/attachment.dart | 2 +- .../chat/message_body/file_preview.dart | 12 ++-- .../chat/message_body/link_preview.dart | 2 +- .../chat/message_body/reacts_tags.dart | 4 +- .../organisms/chat/message_input.dart | 4 +- lib/src/components/organisms/date_range.dart | 2 +- .../organisms/file_picker/file_picker.dart | 10 +-- .../organisms/file_picker/file_wrapper.dart | 1 - .../organisms/file_picker/giphy_picker.dart | 2 +- .../components/organisms/file_preview.dart | 1 - .../html_preview/html_container.dart | 14 ++-- .../html_preview/video_html_extension.dart | 2 +- .../image_editor/image_editor_home.dart | 2 +- .../image_editor/utils/shape_painter.dart | 2 +- .../organisms/quill_editor/color_button.dart | 12 ++-- .../organisms/quill_editor/html_parser.dart | 4 +- .../quill_editor/material_picker.dart | 2 +- .../quill_editor/quill_editor_page.dart | 14 ++-- .../organisms/quill_editor/quill_toolbar.dart | 1 - lib/src/utils/assets/icons.dart | 9 +-- lib/src/utils/theme/theme.dart | 18 ++--- .../theme_builders/bottom_app_bar_theme.dart | 2 +- .../theme/theme_builders/card_theme.dart | 4 +- .../theme/theme_builders/dialog_theme.dart | 4 +- .../theme/theme_builders/switch_theme.dart | 2 +- .../theme/theme_builders/tab_bar_theme.dart | 4 +- .../theme_builders/text_selection_theme.dart | 2 +- .../theme/theme_builders/zeta_theme.dart | 3 +- lib/src/utils/theme/theme_data.dart | 8 +-- lib/src/utils/tools/nested_flow.dart | 5 ++ lib/src/utils/tools/tab_navigator.dart | 9 ++- lib/src/utils/tools/utils.dart | 28 ++++---- lib/zds_flutter.dart | 2 +- pubspec.yaml | 71 ++++++++++--------- 69 files changed, 234 insertions(+), 202 deletions(-) create mode 100644 .fvmrc diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 00000000..3135e2b9 --- /dev/null +++ b/.fvmrc @@ -0,0 +1,3 @@ +{ + "flutter": "3.32.2" +} \ No newline at end of file diff --git a/.github/workflows/on-main.yml b/.github/workflows/on-main.yml index c0a51861..fe4eac6e 100644 --- a/.github/workflows/on-main.yml +++ b/.github/workflows/on-main.yml @@ -27,7 +27,7 @@ jobs: with: cache: true channel: stable - flutter-version: 3.24.x # TODO UX-1347 + flutter-version: 3.32.x - name: Setup flutter run: flutter pub get - name: Lint and format diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 4e0999bd..56dfa449 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -18,7 +18,7 @@ jobs: with: cache: true channel: stable - flutter-version: 3.24.x # TODO UX-1347 + flutter-version: 3.32.x - name: Install dependencies run: flutter pub get - name: Format code @@ -38,7 +38,7 @@ jobs: with: cache: true channel: stable - flutter-version: 3.24.x # TODO UX-1347 + flutter-version: 3.32.x - name: Setup flutter run: flutter pub get - name: Build example app diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6bab9c85..a9bf324d 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,7 +20,7 @@ jobs: with: cache: true channel: stable - flutter-version: 3.32.x # TODO UX-1347 + flutter-version: 3.32.x - uses: ZebraDevs/flutter-code-quality@main with: token: ${{secrets.GITHUB_TOKEN}} @@ -54,7 +54,7 @@ jobs: with: cache: true channel: stable - flutter-version: 3.32.x # TODO UX-1347 + flutter-version: 3.32.x - name: Setup flutter run: flutter pub get - name: Build example app diff --git a/.gitignore b/.gitignore index 83d63d64..8f55bd14 100644 --- a/.gitignore +++ b/.gitignore @@ -77,4 +77,8 @@ pubspec.lock **/node_modules .master/ **/.fvm/ -.fvmrc +example/ios/Flutter/ephemeral/flutter_lldb_helper.py +example/ios/Flutter/ephemeral/flutter_lldbinit + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml index bb2016f4..bf9fbd59 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,3 +1,6 @@ +analyzer: + errors: + unsafe_variance: ignore include: package:zds_analysis/analysis_options_lib.yaml linter: rules: diff --git a/example/.gitignore b/example/.gitignore index 1eab1a22..13f41015 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -5,9 +5,11 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ migrate_working_dir/ # IntelliJ related diff --git a/example/lib/pages/components/comment.dart b/example/lib/pages/components/comment.dart index 54bcc553..ea358b08 100644 --- a/example/lib/pages/components/comment.dart +++ b/example/lib/pages/components/comment.dart @@ -76,6 +76,11 @@ class _CommentDemoState extends State { author: 'John Doe', comment: 'This is a comment', timeStamp: '09:30 AM', + attachment: ZdsChatAttachment( + name: 'Blueprints', + size: '1234kb', + extension: 'ici', + ), ), ZdsComment( avatar: ZetaAvatar.initials( diff --git a/example/lib/pages/components/expansion_tile.dart b/example/lib/pages/components/expansion_tile.dart index c8bf695c..ebbbf683 100644 --- a/example/lib/pages/components/expansion_tile.dart +++ b/example/lib/pages/components/expansion_tile.dart @@ -88,7 +88,7 @@ class _ExpansionTileDemoState extends State { ZdsExpansionTile( title: const Text('Collect feedback from customers who was'), initiallyExpanded: true, - titleColor: const Color(0xff007ABA).withOpacity(0.1), + titleColor: const Color(0xff007ABA).withValues(alpha: 0.1), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index cc8208c6..bba4b0a3 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -18,7 +18,7 @@ import open_file_mac import package_info_plus import path_provider_foundation import quill_native_bridge_macos -import record_darwin +import record_macos import share_plus import shared_preferences_foundation import sqflite_darwin @@ -42,7 +42,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) QuillNativeBridgePlugin.register(with: registry.registrar(forPlugin: "QuillNativeBridgePlugin")) - RecordPlugin.register(with: registry.registrar(forPlugin: "RecordPlugin")) + RecordMacOsPlugin.register(with: registry.registrar(forPlugin: "RecordMacOsPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 291111a6..b0064b42 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -31,7 +31,7 @@ PODS: - FlutterMacOS - quill_native_bridge_macos (0.0.1): - FlutterMacOS - - record_darwin (1.0.0): + - record_macos (1.0.0): - FlutterMacOS - share_plus (0.0.1): - FlutterMacOS @@ -68,7 +68,7 @@ DEPENDENCIES: - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - quill_native_bridge_macos (from `Flutter/ephemeral/.symlinks/plugins/quill_native_bridge_macos/macos`) - - record_darwin (from `Flutter/ephemeral/.symlinks/plugins/record_darwin/macos`) + - record_macos (from `Flutter/ephemeral/.symlinks/plugins/record_macos/macos`) - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`) @@ -111,8 +111,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin quill_native_bridge_macos: :path: Flutter/ephemeral/.symlinks/plugins/quill_native_bridge_macos/macos - record_darwin: - :path: Flutter/ephemeral/.symlinks/plugins/record_darwin/macos + record_macos: + :path: Flutter/ephemeral/.symlinks/plugins/record_macos/macos share_plus: :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos shared_preferences_foundation: @@ -146,7 +146,7 @@ SPEC CHECKSUMS: package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 quill_native_bridge_macos: 3a5f378bc757eb92825193853020b759b56cbb2c - record_darwin: a0d515a0ef78c440c123ea3ac76184c9927a94d6 + record_macos: 3ead198d39fad25d10163780132a96b6fd162a1c share_plus: 1fa619de8392a4398bfaf176d441853922614e89 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 15368ecc..ac78810c 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -59,6 +59,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift index 8e02df28..b3c17614 100644 --- a/example/macos/Runner/AppDelegate.swift +++ b/example/macos/Runner/AppDelegate.swift @@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } } diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 42b4c839..2dfcb4c9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -12,21 +12,25 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - intl: ^0.19.0 - lottie: ^3.1.2 - path_provider: ^2.1.2 + intl: any + lottie: ^3.3.1 + path_provider: ^2.1.5 scrollable_positioned_list: ^0.3.8 - shared_preferences: ^2.2.2 - table_calendar: ^3.0.9 - zds_flutter: - path: ../ - + shared_preferences: ^2.5.3 + table_calendar: ^3.2.0 url_launcher: any cross_file: any zeta_flutter: any flutter_quill: any flutter_quill_extensions: any image_picker: any + +dependency_overrides: + flutter_slidable: ^4.0.0 + intl: ^0.19.0 + zds_flutter: + path: ../ + flutter: uses-material-design: true assets: diff --git a/lib/src/components/atoms/button.dart b/lib/src/components/atoms/button.dart index 6bff3888..0aa19273 100644 --- a/lib/src/components/atoms/button.dart +++ b/lib/src/components/atoms/button.dart @@ -255,7 +255,7 @@ class ZdsButton extends StatelessWidget { // Helper function to calculate the overlay color. Color calculateOverlay({double opacity = 0.1, Color? background}) { - return customColor?.withOpacity(opacity) ?? (background ?? defaultBackground).withOpacity(opacity); + return customColor?.withValues(alpha: opacity) ?? (background ?? defaultBackground).withValues(alpha: opacity); } switch (variant) { diff --git a/lib/src/components/atoms/expandable.dart b/lib/src/components/atoms/expandable.dart index 20451781..aa28b1b7 100644 --- a/lib/src/components/atoms/expandable.dart +++ b/lib/src/components/atoms/expandable.dart @@ -119,7 +119,7 @@ class _ExpandableContainerState extends State<_ExpandableContainer> with SingleT super.dispose(); } - void _afterLayout(_) { + void _afterLayout(dynamic _) { final RenderBox renderBox = _keyText.currentContext!.findRenderObject()! as RenderBox; _textHeight = renderBox.size.height; _sizeAnimation = Tween(begin: widget.minHeight, end: _textHeight).animate(_controller); @@ -262,7 +262,7 @@ class _FadeOpacity extends StatelessWidget { stops: const [0, 1], colors: [ color, - color.withOpacity(0.1), + color.withValues(alpha: 0.1), ], ), ), diff --git a/lib/src/components/atoms/icon_text_button.dart b/lib/src/components/atoms/icon_text_button.dart index a471463f..5b715dca 100644 --- a/lib/src/components/atoms/icon_text_button.dart +++ b/lib/src/components/atoms/icon_text_button.dart @@ -64,7 +64,7 @@ class ZdsIconTextButton extends StatelessWidget with Diagnosticable { borderRadius: borderRadius, color: backgroundColor ?? zetaColors.primary, boxShadow: [ - BoxShadow(blurRadius: 4, color: zetaColors.textDefault.withOpacity(0.2)), + BoxShadow(blurRadius: 4, color: zetaColors.textDefault.withValues(alpha: 0.2)), ], ), child: Material( diff --git a/lib/src/components/atoms/selection_pills.dart b/lib/src/components/atoms/selection_pills.dart index 6fb30259..6f849eaf 100644 --- a/lib/src/components/atoms/selection_pills.dart +++ b/lib/src/components/atoms/selection_pills.dart @@ -70,7 +70,7 @@ class ZdsSelectionPill extends StatelessWidget { /// /// Custom color to override pill background color. /// - ///Defaults to `colorScheme.secondary.withOpacity(0.1)` + ///Defaults to `colorScheme.secondary.withValues(alpha:0.1)` final Color? selectedColor; ///Use [color] instead. Will be deprecated in future release. @@ -89,7 +89,7 @@ class ZdsSelectionPill extends StatelessWidget { final Color background = disabled ? zetaColors.surfaceDisabled : selected - ? color?.surface ?? selectedColor?.withOpacity(0.2) ?? zetaColors.secondary.surface + ? color?.surface ?? selectedColor?.withValues(alpha: 0.2) ?? zetaColors.secondary.surface : themeData.colorScheme.surface; final Color foreground = disabled diff --git a/lib/src/components/atoms/speed_slider.dart b/lib/src/components/atoms/speed_slider.dart index 465e7691..b78c341f 100644 --- a/lib/src/components/atoms/speed_slider.dart +++ b/lib/src/components/atoms/speed_slider.dart @@ -39,7 +39,7 @@ class ZdsSpeedSlider extends StatefulWidget { final ScrollController? controller; /// The default items for the slider. - static const defaultItems = _defaultAlphabet; + static const List defaultItems = _defaultAlphabet; @override State createState() => ZdsSpeedSliderState(); @@ -59,7 +59,7 @@ class ZdsSpeedSlider extends StatefulWidget { /// The state of the [ZdsSpeedSlider] class ZdsSpeedSliderState extends State with FrameCallbackMixin { late final ScrollController _scrollController; - final _scrollableKey = GlobalKey(); + final GlobalKey _scrollableKey = GlobalKey(); late List _itemKeys; int _selectedIndex = 0; diff --git a/lib/src/components/molecules/bottom_sheet.dart b/lib/src/components/molecules/bottom_sheet.dart index eba91996..dcf3e2ba 100644 --- a/lib/src/components/molecules/bottom_sheet.dart +++ b/lib/src/components/molecules/bottom_sheet.dart @@ -345,7 +345,8 @@ class _BottomSheetHeader extends StatelessWidget implements PreferredSizeWidget final zetaColors = Zeta.of(context).colors; return DecoratedBox( decoration: BoxDecoration( - border: header != null ? Border(bottom: BorderSide(color: zetaColors.textDefault.withOpacity(0.1))) : null, + border: + header != null ? Border(bottom: BorderSide(color: zetaColors.textDefault.withValues(alpha: 0.1))) : null, ), child: Column( children: [ diff --git a/lib/src/components/molecules/date_range_picker.dart b/lib/src/components/molecules/date_range_picker.dart index 5017e8d6..20d0cb27 100644 --- a/lib/src/components/molecules/date_range_picker.dart +++ b/lib/src/components/molecules/date_range_picker.dart @@ -804,7 +804,7 @@ Future showZdsDateRangePicker({ int startingDayOfWeek = 0, String? shortMonthDayFormat, String? shortDateFormat, -}) async { +}) { assert( initialDateRange == null || !initialDateRange.start.isAfter(initialDateRange.end), "initialDateRange's start date must not be after it's end date.", @@ -1354,7 +1354,7 @@ class _ZdsDateRangePickerDialogState extends State wit shortMonthDayFormat: widget.shortMonthDayFormat, shortDateFormat: widget.shortDateFormat, ); - final DialogTheme dialogTheme = Theme.of(context).dialogTheme; + final DialogThemeData dialogTheme = Theme.of(context).dialogTheme; size = orientation == Orientation.portrait ? _inputPortraitDialogSize : _inputRangeLandscapeDialogSize; insetPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 24); shape = dialogTheme.shape; @@ -2378,7 +2378,7 @@ class MonthItemState extends State { } Color _highlightColor(BuildContext context) { - return Theme.of(context).colorScheme.secondary.withOpacity(0.12); + return Theme.of(context).colorScheme.secondary.withValues(alpha: 0.12); } void _dayFocusChanged(bool focused) { @@ -2456,7 +2456,7 @@ class MonthItemState extends State { textDirection: textDirection, ); } else if (isDisabled) { - itemStyle = textTheme.bodyMedium?.apply(color: colorScheme.onSurface.withOpacity(0.38)); + itemStyle = textTheme.bodyMedium?.apply(color: colorScheme.onSurface.withValues(alpha: 0.38)); } else if (DateUtils.isSameDay(widget.currentDate, dayToBuild)) { // The current day gets a different text color and a circle stroke // border. @@ -2505,7 +2505,7 @@ class MonthItemState extends State { focusNode: _dayFocusNodes[day - 1], onTap: () => widget.onChanged(dayToBuild), radius: _monthItemRowHeight / 2 + 4, - splashColor: colorScheme.primary.withOpacity(0.38), + splashColor: colorScheme.primary.withValues(alpha: 0.38), onFocusChange: _dayFocusChanged, child: dayWidget, ); diff --git a/lib/src/components/molecules/dropdown.dart b/lib/src/components/molecules/dropdown.dart index a834aa15..3243d671 100644 --- a/lib/src/components/molecules/dropdown.dart +++ b/lib/src/components/molecules/dropdown.dart @@ -210,7 +210,7 @@ class ZdsDropdownListState extends State> { menuItemStyleData: MenuItemStyleData( selectedMenuItemBuilder: (BuildContext context, Widget child) { return ColoredBox( - color: themeData.colorScheme.secondary.withOpacity(0.1), + color: themeData.colorScheme.secondary.withValues(alpha: 0.1), child: child, ); }, diff --git a/lib/src/components/molecules/input_dialog.dart b/lib/src/components/molecules/input_dialog.dart index a0f172d2..768c019c 100644 --- a/lib/src/components/molecules/input_dialog.dart +++ b/lib/src/components/molecules/input_dialog.dart @@ -223,7 +223,7 @@ class ZdsInputDialogState extends State { ZdsButton.muted( semanticLabel: widget.secondaryAction, key: const Key('secondary_button'), - onTap: () async => Navigator.maybePop(context), + onTap: () => Navigator.maybePop(context), child: Text(widget.secondaryAction!), ), if (widget.secondaryAction != null) const SizedBox(width: 8), diff --git a/lib/src/components/molecules/interval_time_picker.dart b/lib/src/components/molecules/interval_time_picker.dart index fbbd0696..502ce76e 100644 --- a/lib/src/components/molecules/interval_time_picker.dart +++ b/lib/src/components/molecules/interval_time_picker.dart @@ -280,8 +280,8 @@ class _HourMinuteControl extends StatelessWidget { final Color backgroundColor = timePickerTheme.hourMinuteColor ?? WidgetStateColor.resolveWith((Set states) { return states.contains(WidgetState.selected) - ? themeData.colorScheme.primary.withOpacity(isDark ? 0.24 : 0.12) - : themeData.colorScheme.onSurface.withOpacity(0.12); + ? themeData.colorScheme.primary.withValues(alpha: isDark ? 0.24 : 0.12) + : themeData.colorScheme.onSurface.withValues(alpha: 0.12); }); final TextStyle style = timePickerTheme.hourMinuteTextStyle ?? themeData.textTheme.displayMedium!; final ShapeBorder shape = timePickerTheme.hourMinuteShape ?? _kDefaultShape; @@ -554,7 +554,9 @@ class _DayPeriodControl extends StatelessWidget { final bool isDark = colorScheme.brightness == Brightness.dark; final Color textColor = timePickerTheme.dayPeriodTextColor ?? WidgetStateColor.resolveWith((Set states) { - return states.contains(WidgetState.selected) ? colorScheme.primary : colorScheme.onSurface.withOpacity(0.60); + return states.contains(WidgetState.selected) + ? colorScheme.primary + : colorScheme.onSurface.withValues(alpha: 0.60); }); final Color backgroundColor = timePickerTheme.dayPeriodColor ?? WidgetStateColor.resolveWith((Set states) { @@ -563,7 +565,7 @@ class _DayPeriodControl extends StatelessWidget { // and allows the optional elevation overlay for dark mode to be // visible. return states.contains(WidgetState.selected) - ? colorScheme.primary.withOpacity(isDark ? 0.24 : 0.12) + ? colorScheme.primary.withValues(alpha: isDark ? 0.24 : 0.12) : Colors.transparent; }); final bool amSelected = selectedTime.period == DayPeriod.am; @@ -581,7 +583,7 @@ class _DayPeriodControl extends StatelessWidget { timePickerTheme.dayPeriodShape ?? const RoundedRectangleBorder(borderRadius: _kDefaultBorderRadius); final BorderSide borderSide = timePickerTheme.dayPeriodBorderSide ?? BorderSide( - color: Color.alphaBlend(colorScheme.onSurface.withOpacity(0.38), colorScheme.surface), + color: Color.alphaBlend(colorScheme.onSurface.withValues(alpha: 0.38), colorScheme.surface), ); // Apply the custom borderSide. shape = shape.copyWith( @@ -1289,7 +1291,8 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); final TimePickerThemeData pickerTheme = TimePickerTheme.of(context); - final Color backgroundColor = pickerTheme.dialBackgroundColor ?? themeData.colorScheme.onSurface.withOpacity(0.12); + final Color backgroundColor = + pickerTheme.dialBackgroundColor ?? themeData.colorScheme.onSurface.withValues(alpha: 0.12); final Color accentColor = pickerTheme.dialHandColor ?? themeData.colorScheme.primary; final Color primaryLabelColor = WidgetStateProperty.resolveAs(pickerTheme.dialTextColor, {}) ?? themeData.colorScheme.onSurface; @@ -1865,12 +1868,12 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora focusedErrorBorder: OutlineInputBorder( borderSide: BorderSide(color: colorScheme.error, width: 2), ), - hintStyle: widget.style.copyWith(color: colorScheme.onSurface.withOpacity(0.36)), + hintStyle: widget.style.copyWith(color: colorScheme.onSurface.withValues(alpha: 0.36)), // TODO(rami-a): Remove this logic once https://github.com/flutter/flutter/issues/54104 is fixed. errorStyle: const TextStyle(fontSize: 0, height: 0), // Prevent the error text from appearing. ); } - final Color unfocusedFillColor = timePickerTheme.hourMinuteColor ?? colorScheme.onSurface.withOpacity(0.12); + final Color unfocusedFillColor = timePickerTheme.hourMinuteColor ?? colorScheme.onSurface.withValues(alpha: 0.12); // If screen reader is in use, make the hint text say hours/minutes. // Otherwise, remove the hint text when focused because the centered cursor // appears odd above the hint text. @@ -2381,8 +2384,8 @@ class _IntervalTimePickerDialogState extends State wit if (_entryMode.value == TimePickerEntryMode.dial || _entryMode.value == TimePickerEntryMode.input) IconButton( color: TimePickerTheme.of(context).entryModeIconColor ?? - theme.colorScheme.onSurface.withOpacity( - theme.colorScheme.brightness == Brightness.dark ? 1.0 : 0.6, + theme.colorScheme.onSurface.withValues( + alpha: theme.colorScheme.brightness == Brightness.dark ? 1.0 : 0.6, ), onPressed: _handleEntryModeToggle, icon: Icon(_entryMode.value == TimePickerEntryMode.dial ? Icons.keyboard : Icons.access_time), @@ -2651,7 +2654,7 @@ Future showIntervalTimePicker({ RouteSettings? routeSettings, EntryModeChangeCallback? onEntryModeChanged, Offset? anchorPoint, -}) async { +}) { assert(interval >= 1 && interval <= 60, 'Asserts that the interval is inclusive to the range 0 to 60'); assert( debugCheckHasMaterialLocalizations(context), diff --git a/lib/src/components/molecules/list.dart b/lib/src/components/molecules/list.dart index e83f596a..ea90c104 100644 --- a/lib/src/components/molecules/list.dart +++ b/lib/src/components/molecules/list.dart @@ -11,7 +11,7 @@ final List _emptyChildren = const Widget _emptyChild = SizedBox(height: 60, width: double.infinity); -Widget _emptyBuilder(_, __) => _emptyChild; +Widget _emptyBuilder(dynamic _, dynamic __) => _emptyChild; /// Creates a [ListView] with predefined parameters that match Zds styling and behavior. /// diff --git a/lib/src/components/molecules/slidable_button.dart b/lib/src/components/molecules/slidable_button.dart index a5a3ea0c..559e3eb0 100644 --- a/lib/src/components/molecules/slidable_button.dart +++ b/lib/src/components/molecules/slidable_button.dart @@ -162,7 +162,7 @@ class ZdsSlidableButtonState extends State { ? widget.buttonColorEnd! : widget.onSlideComplete != null ? widget.buttonColor - : widget.buttonColor.withOpacity(0.5); + : widget.buttonColor.withValues(alpha: 0.5); return Semantics( slider: true, diff --git a/lib/src/components/molecules/speed_scrollable_list.dart b/lib/src/components/molecules/speed_scrollable_list.dart index 2b2c6b78..53af2c98 100644 --- a/lib/src/components/molecules/speed_scrollable_list.dart +++ b/lib/src/components/molecules/speed_scrollable_list.dart @@ -60,7 +60,7 @@ class ZdsSpeedScrollableList extends StatefulWidget { class _ZdsSpeedScrollableListState extends State { // Maps an item group to its corresponding key final Map _keyMap = {}; - final _scrollContentKey = GlobalKey(); + final GlobalKey> _scrollContentKey = GlobalKey(); final _scrollController = ScrollController(); final _sliderKey = GlobalKey(); diff --git a/lib/src/components/molecules/star_rating.dart b/lib/src/components/molecules/star_rating.dart index df1ef855..bf7c062b 100644 --- a/lib/src/components/molecules/star_rating.dart +++ b/lib/src/components/molecules/star_rating.dart @@ -118,7 +118,7 @@ class _ZdsStarRatingState extends State { child: AnimatedContainer( duration: const Duration(milliseconds: 250), decoration: BoxDecoration( - color: colors.cool.shade30.withOpacity(_selected ? 1 : 0), + color: colors.cool.shade30.withValues(alpha: _selected ? 1 : 0), borderRadius: borderRadius, ), child: Row( diff --git a/lib/src/components/molecules/tab_bar.dart b/lib/src/components/molecules/tab_bar.dart index b1df65f5..4be88343 100644 --- a/lib/src/components/molecules/tab_bar.dart +++ b/lib/src/components/molecules/tab_bar.dart @@ -149,7 +149,7 @@ class ZdsTabBar extends StatelessWidget implements PreferredSizeWidget { background: zetaColors.primary, indicator: zetaColors.primary.onColor, selectedText: zetaColors.primary.onColor, - unselectedText: zetaColors.primary.onColor.withOpacity(0.7), + unselectedText: zetaColors.primary.onColor.withValues(alpha: 0.7), ); case ZdsTabBarColor.basic: return _tabBarStyle( @@ -177,7 +177,7 @@ class ZdsTabBar extends StatelessWidget implements PreferredSizeWidget { background: appBarTheme.backgroundColor ?? zetaColors.surfacePrimary, indicator: appBarTheme.foregroundColor ?? zetaColors.primary, selectedText: appBarTheme.foregroundColor ?? zetaColors.textDefault, - unselectedText: appBarTheme.foregroundColor?.withOpacity(0.7) ?? zetaColors.textSubtle, + unselectedText: appBarTheme.foregroundColor?.withValues(alpha: 0.7) ?? zetaColors.textSubtle, ); } } @@ -194,7 +194,7 @@ class ZdsTabBar extends StatelessWidget implements PreferredSizeWidget { final double height = hasIcons ? 56.0 : 48.0; final ThemeData theme = Theme.of(context); - final TabBarTheme tabBarTheme = theme.tabBarTheme.copyWith(indicatorSize: TabBarIndicatorSize.tab); + final TabBarThemeData tabBarTheme = theme.tabBarTheme.copyWith(indicatorSize: TabBarIndicatorSize.tab); final TextStyle? labelStyle = hasIcons ? theme.textTheme.bodySmall : theme.textTheme.bodyLarge; return ZdsTabBarStyleContainer( diff --git a/lib/src/components/molecules/toolbar.dart b/lib/src/components/molecules/toolbar.dart index 634db23d..883ec3ab 100644 --- a/lib/src/components/molecules/toolbar.dart +++ b/lib/src/components/molecules/toolbar.dart @@ -101,7 +101,7 @@ class ZdsToolbar extends StatelessWidget { maxLines: 1, overflow: TextOverflow.ellipsis, style: safeTextStyle(theme.primaryTextTheme.titleSmall).copyWith( - color: effectiveForeground.withOpacity(0.8), + color: effectiveForeground.withValues(alpha: 0.8), ), child: subtitle!, ), diff --git a/lib/src/components/molecules/vertical_nav.dart b/lib/src/components/molecules/vertical_nav.dart index af365ea1..1f164811 100644 --- a/lib/src/components/molecules/vertical_nav.dart +++ b/lib/src/components/molecules/vertical_nav.dart @@ -173,7 +173,7 @@ class _ZdsVerticalNavState extends State { color: themeData.colorScheme.surface, boxShadow: [ BoxShadow( - color: themeData.colorScheme.onSurface.withOpacity(0.25), + color: themeData.colorScheme.onSurface.withValues(alpha: 0.25), blurRadius: 1, offset: const Offset(1, 0), ), @@ -249,7 +249,7 @@ class _SelectedBackground extends StatelessWidget { ), boxShadow: [ BoxShadow( - color: themeData.cardTheme.shadowColor ?? Colors.black.withOpacity(0.25), + color: themeData.cardTheme.shadowColor ?? Colors.black.withValues(alpha: 0.25), blurRadius: 1, spreadRadius: 1, offset: const Offset(-1, 1), diff --git a/lib/src/components/organisms/app_bar.dart b/lib/src/components/organisms/app_bar.dart index 1aed65a5..f7dbd079 100644 --- a/lib/src/components/organisms/app_bar.dart +++ b/lib/src/components/organisms/app_bar.dart @@ -140,7 +140,7 @@ class ZdsAppBar extends StatelessWidget implements PreferredSizeWidget { DefaultTextStyle.merge( child: subtitle!, style: theme.primaryTextTheme.titleSmall - ?.copyWith(color: appBarTheme.foregroundColor?.withOpacity(0.8)), + ?.copyWith(color: appBarTheme.foregroundColor?.withValues(alpha: 0.8)), ), ], ), diff --git a/lib/src/components/organisms/camera/camera_page.dart b/lib/src/components/organisms/camera/camera_page.dart index 56aa3bfe..08c598fa 100644 --- a/lib/src/components/organisms/camera/camera_page.dart +++ b/lib/src/components/organisms/camera/camera_page.dart @@ -96,7 +96,7 @@ class ZdsCamera extends StatelessWidget { CaptureRequestBuilder? photoPathBuilder, CaptureRequestBuilder? videoPathBuilder, List? filters, - }) async { + }) { if (useSystemCamera || kIsWeb) { return image_picker.ImagePicker().pickImage(source: image_picker.ImageSource.camera); } else { @@ -127,7 +127,7 @@ class ZdsCamera extends StatelessWidget { CaptureRequestBuilder? photoPathBuilder, CaptureRequestBuilder? videoPathBuilder, Duration? maxVideoDuration, - }) async { + }) { if (kIsWeb) { return image_picker.ImagePicker().pickVideo(source: image_picker.ImageSource.camera); } else { @@ -664,7 +664,7 @@ class _CameraButtonPainter extends CustomPainter { ..isAntiAlias = true; final radius = size.width / 2; final center = Offset(size.width / 2, size.height / 2); - bgPainter.color = ZetaColorBase.white.withOpacity(.5); + bgPainter.color = ZetaColorBase.white.withValues(alpha: .5); canvas.drawCircle(center, radius, bgPainter); bgPainter.color = ZetaColorBase.white; @@ -687,7 +687,7 @@ class _VideoButtonPainter extends CustomPainter { ..isAntiAlias = true; final radius = size.width / 2; final center = Offset(size.width / 2, size.height / 2); - bgPainter.color = ZetaColorBase.white.withOpacity(.5); + bgPainter.color = ZetaColorBase.white.withValues(alpha: .5); canvas.drawCircle(center, radius, bgPainter); if (isRecording) { @@ -793,14 +793,14 @@ class _PreviewActions extends StatelessWidget { elevation: 0, shape: const CircleBorder(), backgroundColor: Colors.black38, - onPressed: () async => _onPop(context, false), + onPressed: () => _onPop(context, false), child: const Icon(Icons.close, color: ZetaColorBase.white), ), FloatingActionButton( elevation: 0, shape: const CircleBorder(), backgroundColor: Colors.black38, - onPressed: () async => _onPop(context, true), + onPressed: () => _onPop(context, true), child: const Icon(Icons.done, color: ZetaColorBase.white), ), ], diff --git a/lib/src/components/organisms/chat/audio_player.dart b/lib/src/components/organisms/chat/audio_player.dart index e3c7d51c..936a2cfd 100644 --- a/lib/src/components/organisms/chat/audio_player.dart +++ b/lib/src/components/organisms/chat/audio_player.dart @@ -239,7 +239,7 @@ class ZdsAudioPlayerState extends State { final backgroundColor = widget.decoration.resolveBackgroundColor(context); final thumbColor = widget.decoration.resolveThumbColor(context); final waveColor = widget.decoration.resolveWaveColor(context); - final inactiveTrackColor = backgroundColor.withOpacity(0.5); + final inactiveTrackColor = backgroundColor.withValues(alpha: 0.5); return Material( color: backgroundColor, @@ -253,7 +253,7 @@ class ZdsAudioPlayerState extends State { IconButton( icon: Icon( playing ? Icons.pause_circle_outline : Icons.play_circle_outline, - color: !_disabled ? foregroundColor : foregroundColor.withOpacity(0.5), + color: !_disabled ? foregroundColor : foregroundColor.withValues(alpha: 0.5), ), onPressed: !_disabled ? playing @@ -353,14 +353,14 @@ class _PlaybackProgress extends StatelessWidget { child: SliderTheme( data: SliderTheme.of(context).copyWith( activeTrackColor: Colors.transparent, - inactiveTrackColor: backgroundColor.withOpacity(0.4), + inactiveTrackColor: backgroundColor.withValues(alpha: 0.4), trackShape: const RectangularSliderTrackShape(), thumbShape: enabled ? const RoundSliderThumbShape() : SliderComponentShape.noThumb, trackHeight: box.maxHeight, thumbColor: thumbColor, disabledThumbColor: thumbColor, disabledActiveTrackColor: Colors.transparent, - disabledInactiveTrackColor: backgroundColor.withOpacity(0.4), + disabledInactiveTrackColor: backgroundColor.withValues(alpha: 0.4), ), child: Slider( value: min(value, maxValue), diff --git a/lib/src/components/organisms/chat/audio_recorder.dart b/lib/src/components/organisms/chat/audio_recorder.dart index 847c79e6..701ca1a8 100644 --- a/lib/src/components/organisms/chat/audio_recorder.dart +++ b/lib/src/components/organisms/chat/audio_recorder.dart @@ -125,7 +125,7 @@ class ZdsVoiceNoteRecorderState extends State { _waveform.add(0); }); if (_duration >= widget.maxDuration.inMilliseconds) { - stop(); + unawaited(stop()); } }); } else { diff --git a/lib/src/components/organisms/chat/message_body/attachment.dart b/lib/src/components/organisms/chat/message_body/attachment.dart index ffbf1003..1e674ca9 100644 --- a/lib/src/components/organisms/chat/message_body/attachment.dart +++ b/lib/src/components/organisms/chat/message_body/attachment.dart @@ -37,7 +37,7 @@ class ZdsChatAttachmentWidget extends StatelessWidget { Widget build(BuildContext context) { final zeta = Zeta.of(context); final colors = zeta.colors; - final foregroundColor = iconColor(_fileType, context: context); + final foregroundColor = iconColor(_fileType, context); final layoutBuilder = LayoutBuilder( builder: (context, constraints) { return Row( diff --git a/lib/src/components/organisms/chat/message_body/file_preview.dart b/lib/src/components/organisms/chat/message_body/file_preview.dart index 0786412b..679f9dec 100644 --- a/lib/src/components/organisms/chat/message_body/file_preview.dart +++ b/lib/src/components/organisms/chat/message_body/file_preview.dart @@ -234,8 +234,8 @@ class __VideoState extends State<_Video> { : await _videoController!.play(); setState(() {}); }, - backgroundColor: Zeta.of(context).colors.cool.shade30.withOpacity(0.7), - hoverColor: Zeta.of(context).colors.cool.shade30.withOpacity(0.5), + backgroundColor: Zeta.of(context).colors.cool.shade30.withValues(alpha: 0.7), + hoverColor: Zeta.of(context).colors.cool.shade30.withValues(alpha: 0.5), hoverElevation: 0, child: Icon( _videoController!.value.isPlaying ? Icons.pause : Icons.play_arrow, @@ -275,7 +275,7 @@ class _FullScreenViewer extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.black.withOpacity(0.8), + backgroundColor: Colors.black.withValues(alpha: 0.8), extendBodyBehindAppBar: true, appBar: AppBar( backgroundColor: Colors.black, @@ -293,13 +293,13 @@ class _FullScreenViewer extends StatelessWidget { const Base64Decoder().convert(imageBytes!.base64!), mimeType: imageBytes!.base64Extension, ); - await Share.shareXFiles([image]); + await SharePlus.instance.share(ShareParams(files: [image])); } if (imagePath != null) { - await Share.shareXFiles([XFile(imagePath!)]); + await SharePlus.instance.share(ShareParams(files: [XFile(imagePath!)])); } if (imageUrl != null) { - await Share.shareUri(Uri.parse(imageUrl!)); + await SharePlus.instance.share(ShareParams(uri: Uri.parse(imageUrl!))); } } : null, diff --git a/lib/src/components/organisms/chat/message_body/link_preview.dart b/lib/src/components/organisms/chat/message_body/link_preview.dart index 79b3e010..27d5feb3 100644 --- a/lib/src/components/organisms/chat/message_body/link_preview.dart +++ b/lib/src/components/organisms/chat/message_body/link_preview.dart @@ -132,7 +132,7 @@ class _ZdsChatLinkPreviewState extends State { borderRadius: const BorderRadius.all(Radius.circular(6)), child: Container( decoration: BoxDecoration( - color: Zeta.of(context).colors.warm.shade30.withOpacity(0.2), + color: Zeta.of(context).colors.warm.shade30.withValues(alpha: 0.2), borderRadius: const BorderRadius.all(Radius.circular(6)), ), padding: const EdgeInsets.all(14), diff --git a/lib/src/components/organisms/chat/message_body/reacts_tags.dart b/lib/src/components/organisms/chat/message_body/reacts_tags.dart index 2a78a29e..202703c1 100644 --- a/lib/src/components/organisms/chat/message_body/reacts_tags.dart +++ b/lib/src/components/organisms/chat/message_body/reacts_tags.dart @@ -109,7 +109,7 @@ class _ChatReactionsPill extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(10)), boxShadow: [ BoxShadow( - color: Theme.of(context).colorScheme.shadow.withOpacity(0.1), + color: Theme.of(context).colorScheme.shadow.withValues(alpha: 0.1), blurRadius: 1, offset: const Offset(0, 1), ), @@ -217,7 +217,7 @@ class _ChatTagsPill extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(10)), boxShadow: [ BoxShadow( - color: Theme.of(context).colorScheme.shadow.withOpacity(0.1), + color: Theme.of(context).colorScheme.shadow.withValues(alpha: 0.1), blurRadius: 1, offset: const Offset(0, 1), ), diff --git a/lib/src/components/organisms/chat/message_input.dart b/lib/src/components/organisms/chat/message_input.dart index 04c2e55c..42afdf58 100644 --- a/lib/src/components/organisms/chat/message_input.dart +++ b/lib/src/components/organisms/chat/message_input.dart @@ -284,7 +284,7 @@ class ZdsMessageInputState extends State with SingleTickerProvi final recordingPath = recorderKey.currentState?.recordingDestination; if (recordingPath != null) { final recording = File(recordingPath); - if (recording.existsSync()) recording.delete(); + if (recording.existsSync()) unawaited(recording.delete()); } } return value; @@ -305,7 +305,7 @@ class ZdsMessageInputState extends State with SingleTickerProvi boxShadow: [ BoxShadow( offset: const Offset(0, -1), - color: Theme.of(context).colorScheme.shadow.withOpacity(0.1), + color: Theme.of(context).colorScheme.shadow.withValues(alpha: 0.1), blurRadius: 2, ), BoxShadow(offset: const Offset(0, 1), color: zetaColors.surfacePrimary, blurRadius: 2), diff --git a/lib/src/components/organisms/date_range.dart b/lib/src/components/organisms/date_range.dart index 2db3c223..d4cad24e 100644 --- a/lib/src/components/organisms/date_range.dart +++ b/lib/src/components/organisms/date_range.dart @@ -339,7 +339,7 @@ class ZdsDateRangeState extends State { if (widget.isSelectable) InkWell( borderRadius: const BorderRadius.all(Radius.circular(71)), - onTap: () async => _showDateSelector(context), + onTap: () => _showDateSelector(context), child: text.paddingInsets(const EdgeInsets.symmetric(vertical: 8)), ), Semantics( diff --git a/lib/src/components/organisms/file_picker/file_picker.dart b/lib/src/components/organisms/file_picker/file_picker.dart index 99a8d9d6..f027374a 100644 --- a/lib/src/components/organisms/file_picker/file_picker.dart +++ b/lib/src/components/organisms/file_picker/file_picker.dart @@ -474,7 +474,7 @@ class ZdsFilePickerState extends State with AutomaticKeepAliveCli button: true, enabled: true, child: InkWell( - onTap: () async => handleOptionAction(context, option), + onTap: () => handleOptionAction(context, option), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: Row( @@ -523,7 +523,7 @@ class ZdsFilePickerState extends State with AutomaticKeepAliveCli trailingActions: [ SwipeAction( color: Theme.of(context).colorScheme.error, - onTap: (_) async => controller.openFile(context, config, wrapper), + onTap: (_) => controller.openFile(context, config, wrapper), content: Semantics( focused: true, label: ComponentStrings.of(context).get('DELETE', 'Delete'), @@ -538,7 +538,7 @@ class ZdsFilePickerState extends State with AutomaticKeepAliveCli hint: ComponentStrings.of(context).get('SWIPE_TO_REVEAL_SEMANTIC', 'Swipe left to reveal actions'), child: ZdsListTile( leading: ZdsFilePreview(file: wrapper, size: 50, useCard: false), - onTap: () async => controller.openFile(context, config, wrapper), + onTap: () => controller.openFile(context, config, wrapper), title: Text( wrapper.name ?? ComponentStrings.of(context).get('UNKNOWN', 'Unknown'), maxLines: 1, @@ -945,7 +945,7 @@ extension on ZdsFilePickerState { : isStandard ? 40 : 30, - onTap: () async => handleOptionAction(context, option), + onTap: () => handleOptionAction(context, option), child: Column( children: [ Icon( @@ -1145,7 +1145,7 @@ class _MultiInputDialogState extends State<_MultiInputDialog> { if (widget.secondaryAction != null) ZdsButton.muted( child: Text(widget.secondaryAction!), - onTap: () async => Navigator.maybePop(context), + onTap: () => Navigator.maybePop(context), ), if (widget.secondaryAction == null) const Spacer(), const SizedBox(width: 16), diff --git a/lib/src/components/organisms/file_picker/file_wrapper.dart b/lib/src/components/organisms/file_picker/file_wrapper.dart index d32dd396..4a4d81a5 100644 --- a/lib/src/components/organisms/file_picker/file_wrapper.dart +++ b/lib/src/components/organisms/file_picker/file_wrapper.dart @@ -135,7 +135,6 @@ class ZdsFileWrapper { // The use of dynamic calls is unavoidable in this case due to the heterogeneous nature // of the `content` property, which can be of different types (e.g., `XFile` or `XUri`). // Refactoring to a more strongly-typed structure would require changes to the design. - // ignore: avoid_dynamic_calls if (other.content.runtimeType != content.runtimeType) return false; if (content is XFile && other.content is XFile) { final XFile f1 = content as XFile; diff --git a/lib/src/components/organisms/file_picker/giphy_picker.dart b/lib/src/components/organisms/file_picker/giphy_picker.dart index 57395263..cb87ab88 100644 --- a/lib/src/components/organisms/file_picker/giphy_picker.dart +++ b/lib/src/components/organisms/file_picker/giphy_picker.dart @@ -157,7 +157,7 @@ class _ZdsGiphyPickerState extends State { controller: _searchController, onChange: (String value) { if (_debounce?.isActive ?? false) _debounce?.cancel(); - _debounce = Timer(const Duration(milliseconds: 500), () async { + _debounce = Timer(const Duration(milliseconds: 500), () { setState(() { _queryText = value; _listenerQuery(); diff --git a/lib/src/components/organisms/file_preview.dart b/lib/src/components/organisms/file_preview.dart index 3e2a09dc..5439f210 100644 --- a/lib/src/components/organisms/file_preview.dart +++ b/lib/src/components/organisms/file_preview.dart @@ -192,7 +192,6 @@ class ZdsFileSize extends StatelessWidget { // handled directly by the FutureBuilder. Although the lint rule warns about discarded // futures, in this case, the Future is not discarded but used appropriately in the // FutureBuilder's builder function. No additional handling is required here. - // ignore: discarded_futures future: file!.length(), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.data != null) { diff --git a/lib/src/components/organisms/html_preview/html_container.dart b/lib/src/components/organisms/html_preview/html_container.dart index 0af8768c..e28de0eb 100644 --- a/lib/src/components/organisms/html_preview/html_container.dart +++ b/lib/src/components/organisms/html_preview/html_container.dart @@ -323,13 +323,13 @@ class _ZdsHtmlContainerState extends State with FrameCallbackM begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - surfaceColor.surface.withOpacity(0.3), - surfaceColor.surface.withOpacity(0.4), - surfaceColor.surface.withOpacity(0.5), - surfaceColor.surface.withOpacity(0.6), - surfaceColor.surface.withOpacity(0.7), - surfaceColor.surface.withOpacity(0.8), - surfaceColor.surface.withOpacity(0.9), + surfaceColor.surface.withValues(alpha: 0.3), + surfaceColor.surface.withValues(alpha: 0.4), + surfaceColor.surface.withValues(alpha: 0.5), + surfaceColor.surface.withValues(alpha: 0.6), + surfaceColor.surface.withValues(alpha: 0.7), + surfaceColor.surface.withValues(alpha: 0.8), + surfaceColor.surface.withValues(alpha: 0.9), surfaceColor.surface, ], ), diff --git a/lib/src/components/organisms/html_preview/video_html_extension.dart b/lib/src/components/organisms/html_preview/video_html_extension.dart index 91c5c9f5..33ab902c 100644 --- a/lib/src/components/organisms/html_preview/video_html_extension.dart +++ b/lib/src/components/organisms/html_preview/video_html_extension.dart @@ -38,7 +38,7 @@ class ZdsVideoHtmlExtension extends HtmlExtension { builder: (BuildContext ctx, BoxConstraints box) { return DecoratedBox( decoration: BoxDecoration( - border: Border.all(color: Theme.of(ctx).colorScheme.onSurface.withOpacity(0.4), width: 0.5), + border: Border.all(color: Theme.of(ctx).colorScheme.onSurface.withValues(alpha: 0.4), width: 0.5), ), child: ZdsVideoWidget( context: context, diff --git a/lib/src/components/organisms/image_editor/image_editor_home.dart b/lib/src/components/organisms/image_editor/image_editor_home.dart index 75ea9ac6..b4cdfa17 100644 --- a/lib/src/components/organisms/image_editor/image_editor_home.dart +++ b/lib/src/components/organisms/image_editor/image_editor_home.dart @@ -145,7 +145,7 @@ class _ImageEditorState extends State { const SizedBox(width: 8), ZdsButton( child: Text(strings.get('SAVE', 'Save')), - onTap: () async { + onTap: () { unawaited( imageToUint8List(image).then( (imageBytes) { diff --git a/lib/src/components/organisms/image_editor/utils/shape_painter.dart b/lib/src/components/organisms/image_editor/utils/shape_painter.dart index 320fa029..78531411 100644 --- a/lib/src/components/organisms/image_editor/utils/shape_painter.dart +++ b/lib/src/components/organisms/image_editor/utils/shape_painter.dart @@ -51,7 +51,7 @@ class ShapePainter extends CustomPainter { // Draw the preview shape if it exists if (previewShape != null) { - paint.color = previewShape!.color.withOpacity(0.5); // Semi-transparent preview + paint.color = previewShape!.color.withValues(alpha: 0.5); // Semi-transparent preview _drawShape(canvas, paint, previewShape!); } } diff --git a/lib/src/components/organisms/quill_editor/color_button.dart b/lib/src/components/organisms/quill_editor/color_button.dart index a4746ce6..545f7c24 100644 --- a/lib/src/components/organisms/quill_editor/color_button.dart +++ b/lib/src/components/organisms/quill_editor/color_button.dart @@ -209,8 +209,8 @@ class ZdsQuillToolbarColorButtonState extends State ); return; } - var hex = _colorToHex(color); - hex = '#$hex'; + final hex = color.toHex(); + widget.controller.formatSelection( widget.isBackground ? BackgroundAttribute(hex) : ColorAttribute(hex), ); @@ -293,7 +293,7 @@ class _ColorPickerDialogState extends State<_ColorPickerDialog> { @override void initState() { super.initState(); - hexController = TextEditingController(text: _colorToHex(selectedColor)); + hexController = TextEditingController(text: selectedColor.toHex(leadingHashSign: false)); if (widget.isToggledColor) { selectedColor = widget.isBackground ? _hexToColor(widget.selectionStyle.attributes['background']?.value as String?) @@ -396,7 +396,7 @@ class _ColorPickerDialogState extends State<_ColorPickerDialog> { labelTypes: List.empty(), colorPickerWidth: context.isPhone() ? box.maxWidth : 300, onColorChanged: (color) { - hexController.text = _colorToHex(color); + hexController.text = color.toHex(leadingHashSign: false); selectedColor = color; colorBoxSetState(() {}); }, @@ -466,10 +466,6 @@ Color _hexToColor(String? hexString) { return Color(int.tryParse(buffer.toString(), radix: 16) ?? 0xFF000000); } -String _colorToHex(Color color) { - return color.value.toRadixString(16).padLeft(8, '0').toUpperCase(); -} - Color _stringToColor(String? colorString, [Color? originalColor]) { if (colorString == null) return originalColor ?? Colors.black; diff --git a/lib/src/components/organisms/quill_editor/html_parser.dart b/lib/src/components/organisms/quill_editor/html_parser.dart index 29cd3680..05454243 100644 --- a/lib/src/components/organisms/quill_editor/html_parser.dart +++ b/lib/src/components/organisms/quill_editor/html_parser.dart @@ -64,7 +64,7 @@ extension DeltaToHtml on Delta { completer.complete(''); } // Dispose the WebView after getting the HTML. - webView.dispose(); + unawaited(webView.dispose()); }, ); }, @@ -127,7 +127,7 @@ extension HtmlToDelta on String { callback: (List args) { try { // Dispose the WebView after getting the Delta. - webView.dispose(); + unawaited(webView.dispose()); // Parse the Delta from the callback arguments. final dynamic resp = jsonDecode(args.first as String); // This ignore is used because the `resp['ops']` value is accessed dynamically. diff --git a/lib/src/components/organisms/quill_editor/material_picker.dart b/lib/src/components/organisms/quill_editor/material_picker.dart index e3342489..f496838b 100644 --- a/lib/src/components/organisms/quill_editor/material_picker.dart +++ b/lib/src/components/organisms/quill_editor/material_picker.dart @@ -125,7 +125,7 @@ class _ZdsMaterialPickerState extends State { void initState() { for (final List colors in _colorTypes) { _shadingTypes(colors).forEach((Map color) { - if (widget.pickerColor.value == color.keys.first.value) { + if (widget.pickerColor.toARGB32() == color.keys.first.toARGB32()) { return setState(() { _currentColorType = colors; _currentShading = color.keys.first; diff --git a/lib/src/components/organisms/quill_editor/quill_editor_page.dart b/lib/src/components/organisms/quill_editor/quill_editor_page.dart index 2740fe14..52d224aa 100644 --- a/lib/src/components/organisms/quill_editor/quill_editor_page.dart +++ b/lib/src/components/organisms/quill_editor/quill_editor_page.dart @@ -10,7 +10,7 @@ import '../../../../zds_flutter.dart'; import 'quill_toolbar.dart'; /// Default options for ZDS Quill Toolbar -final zdsQuillToolbarOptions = QuillToolbarOption.values.toSet(); +final Set zdsQuillToolbarOptions = QuillToolbarOption.values.toSet(); /// Represents a Quill editor page. class ZdsQuillEditorPage extends StatefulWidget { @@ -228,7 +228,7 @@ class _ZdsQuillEditorPageState extends State with FrameCallb /// Used to monitor the character count. bool _onReplaceText(int index, int length, Object? data) { if (widget.charLimit != 0 && widget.charLimit != 10000) { - WidgetsBinding.instance.addPostFrameCallback((_) async { + WidgetsBinding.instance.addPostFrameCallback((_) { _characters = _quillController.document.length - 1; }); } @@ -256,7 +256,7 @@ class _ZdsQuillEditorPageState extends State with FrameCallb return Center(child: ZdsImages.sadZebra); }; - WidgetsBinding.instance.addPostFrameCallback((_) async { + WidgetsBinding.instance.addPostFrameCallback((_) { _quillController.moveCursorToEnd(); _onReplaceText(0, 0, null); }); @@ -425,7 +425,7 @@ class _ZdsQuillEditorPageState extends State with FrameCallb iconSize: 24, controller: _quillController, enabledColor: appBarFg, - disabledColor: appBarFg.withOpacity(0.3), + disabledColor: appBarFg.withValues(alpha: 0.3), afterPressed: _afterUndoRedo, undo: true, ), @@ -435,7 +435,7 @@ class _ZdsQuillEditorPageState extends State with FrameCallb iconSize: 24, controller: _quillController, enabledColor: appBarFg, - disabledColor: appBarFg.withOpacity(0.3), + disabledColor: appBarFg.withValues(alpha: 0.3), afterPressed: _afterUndoRedo, undo: false, ), @@ -477,7 +477,7 @@ class _ZdsQuillEditorPageState extends State with FrameCallb return IconButton( icon: const Icon(ZdsIcons.check), tooltip: ComponentStrings.of(context).get('DONE', 'Done'), - onPressed: () async { + onPressed: () { if (_withinLimit) { _fetchingText = true; Navigator.of(context).pop(ZdsQuillDelta(document: _quillController.document)); @@ -574,7 +574,7 @@ class _HistoryButtonState extends State<_HistoryButton> { Widget build(BuildContext context) { _setIconColor(); - widget.controller.changes.listen((quill.DocChange event) async { + widget.controller.changes.listen((quill.DocChange event) { _setIconColor(); }); diff --git a/lib/src/components/organisms/quill_editor/quill_toolbar.dart b/lib/src/components/organisms/quill_editor/quill_toolbar.dart index e107f256..2e6b523f 100644 --- a/lib/src/components/organisms/quill_editor/quill_toolbar.dart +++ b/lib/src/components/organisms/quill_editor/quill_toolbar.dart @@ -5,7 +5,6 @@ // and aligned with the current architecture. Future refactoring may explore // alternative ways to organize and expose these dependencies, but for now, // they are required for the file's functionality. -// ignore_for_file: implementation_imports import 'package:flutter/material.dart'; import 'package:flutter_quill/flutter_quill.dart'; diff --git a/lib/src/utils/assets/icons.dart b/lib/src/utils/assets/icons.dart index 02d13faf..106a372d 100644 --- a/lib/src/utils/assets/icons.dart +++ b/lib/src/utils/assets/icons.dart @@ -407,7 +407,6 @@ Color iconColor(String ext, {BuildContext? context}) { case '.ttf': case '.txt': return colors?.blue ?? const Color(0xFF376FC9); - case '.pdf': case '.ppt': case '.ppr': @@ -423,7 +422,6 @@ Color iconColor(String ext, {BuildContext? context}) { case '.tiff': case '.bmp': return colors?.orange ?? const Color(0xFFF56200); - case '.flv': case '.m4v': case '.mov': @@ -482,13 +480,8 @@ extension IconDataFromExt on String { return _extensions[_safeExt] ?? ZdsIcons.file_present; } - @Deprecated('Use fileIconColor instead.') - Icon coloredFileIcon() { - return Icon(fileIcon(), color: iconColor(_safeExt)); - } - Color fileIconColor(BuildContext context) { - return iconColor(_safeExt, context: context); + return iconColor(_safeExt, context); } String get _safeExt { diff --git a/lib/src/utils/theme/theme.dart b/lib/src/utils/theme/theme.dart index c89a1831..db737448 100644 --- a/lib/src/utils/theme/theme.dart +++ b/lib/src/utils/theme/theme.dart @@ -12,7 +12,7 @@ ZdsBottomBarThemeData buildZdsBottomBarThemeData(BuildContext context) { shadows: [ BoxShadow( offset: const Offset(0, -1), - color: Zeta.of(context).colors.textDefault.withOpacity(0.1), + color: Zeta.of(context).colors.textDefault.withValues(alpha: 0.1), blurRadius: 2, ), ], @@ -326,7 +326,7 @@ extension ThemeExtension on ThemeData { ); } - final CardTheme cardTheme = this.cardTheme.copyWith( + final CardThemeData cardTheme = this.cardTheme.copyWith( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(kSearchBorderRadius), ), @@ -341,7 +341,7 @@ extension ThemeExtension on ThemeData { ), ), textSelectionTheme: TextSelectionThemeData(cursorColor: colorScheme.onSurface), - hintColor: colorScheme.onSurface.withOpacity(0.5), + hintColor: colorScheme.onSurface.withValues(alpha: 0.5), cardTheme: cardTheme.copyWith(shadowColor: Colors.transparent), ); case ZdsSearchFieldVariant.elevated: @@ -351,7 +351,7 @@ extension ThemeExtension on ThemeData { cursorColor: colorScheme.onSurface, ), cardTheme: cardTheme, - hintColor: colorScheme.onSurface.withOpacity(0.5), + hintColor: colorScheme.onSurface.withValues(alpha: 0.5), ); } } @@ -359,7 +359,9 @@ extension ThemeExtension on ThemeData { /// Custom theme for [ZdsDateTimePicker]. ThemeData get zdsDateTimePickerTheme { return copyWith( - dialogBackgroundColor: colorScheme.brightness == Brightness.dark ? colorScheme.surface : null, + dialogTheme: dialogTheme.copyWith( + backgroundColor: colorScheme.brightness == Brightness.dark ? colorScheme.surface : null, + ), colorScheme: colorScheme.copyWith( primary: colorScheme.secondary.withLight(colorScheme.brightness == Brightness.dark ? 0.75 : 1), onPrimary: colorScheme.onSecondary, @@ -387,7 +389,7 @@ extension ThemeExtension on ThemeData { final double height = hasIcons ? 56.0 : 48.0; final ThemeData theme = Theme.of(context); - final TabBarTheme tabBarTheme = theme.tabBarTheme.copyWith(indicatorSize: TabBarIndicatorSize.tab); + final TabBarThemeData tabBarTheme = theme.tabBarTheme.copyWith(indicatorSize: TabBarIndicatorSize.tab); final TextStyle? labelStyle = hasIcons ? theme.textTheme.bodySmall : theme.textTheme.bodyLarge; return ZdsTabBarStyleContainer( @@ -421,7 +423,7 @@ extension ThemeExtension on ThemeData { background: zetaColors.primary, indicator: zetaColors.primary.onColor, selectedText: zetaColors.primary.onColor, - unselectedText: zetaColors.primary.onColor.withOpacity(0.5), + unselectedText: zetaColors.primary.onColor.withValues(alpha: 0.5), ); case ZdsTabBarColor.basic: return tabBarStyle( @@ -449,7 +451,7 @@ extension ThemeExtension on ThemeData { background: appBarTheme.backgroundColor ?? zetaColors.surfacePrimary, indicator: appBarTheme.foregroundColor ?? zetaColors.primary, selectedText: appBarTheme.foregroundColor ?? zetaColors.textDefault, - unselectedText: appBarTheme.foregroundColor?.withOpacity(0.5) ?? zetaColors.textSubtle, + unselectedText: appBarTheme.foregroundColor?.withValues(alpha: 0.5) ?? zetaColors.textSubtle, ); } } diff --git a/lib/src/utils/theme/theme_builders/bottom_app_bar_theme.dart b/lib/src/utils/theme/theme_builders/bottom_app_bar_theme.dart index 91c76458..ed7452e9 100644 --- a/lib/src/utils/theme/theme_builders/bottom_app_bar_theme.dart +++ b/lib/src/utils/theme/theme_builders/bottom_app_bar_theme.dart @@ -20,7 +20,7 @@ extension ZetaBottomAppBartTheme on ZetaColorScheme { /// The shadow color of the `BottomAppBar` is set to the `onBackground` color of the `ZetaColorScheme`, /// but with an opacity of 0.1. - shadowColor: onSurface.withOpacity(0.1), + shadowColor: onSurface.withValues(alpha: 0.1), /// Padding inside the `BottomAppBar`. This is constant and set to be symmetric both horizontally /// and vertically. When running on the web, vertical padding is 8, otherwise it's 4. diff --git a/lib/src/utils/theme/theme_builders/card_theme.dart b/lib/src/utils/theme/theme_builders/card_theme.dart index c02f9d2c..30899f2f 100644 --- a/lib/src/utils/theme/theme_builders/card_theme.dart +++ b/lib/src/utils/theme/theme_builders/card_theme.dart @@ -9,10 +9,10 @@ extension ZetaCardTheme on ZetaColorScheme { /// /// Returns: /// A CardTheme with the applied properties. - CardTheme cardTheme() { + CardThemeData cardTheme() { /// Returns CardTheme after customizing properties like color, /// elevation, margin, shadowColor and shape. - return CardTheme( + return CardThemeData( /// Assigning color to surface color: surface, diff --git a/lib/src/utils/theme/theme_builders/dialog_theme.dart b/lib/src/utils/theme/theme_builders/dialog_theme.dart index cd6431e8..4f327638 100644 --- a/lib/src/utils/theme/theme_builders/dialog_theme.dart +++ b/lib/src/utils/theme/theme_builders/dialog_theme.dart @@ -11,9 +11,9 @@ extension ZetaDialogTheme on ZetaColorScheme { /// of the current color scheme. /// /// The shape of the dialog is set to a [RoundedRectangleBorder] with a border radius of 8. - DialogTheme dialogTheme() { + DialogThemeData dialogTheme() { // Return a DialogTheme with custom properties - return DialogTheme( + return DialogThemeData( // Set the background color to the tertiary color of this ZetaColorScheme backgroundColor: zetaColors.surfaceTertiary, diff --git a/lib/src/utils/theme/theme_builders/switch_theme.dart b/lib/src/utils/theme/theme_builders/switch_theme.dart index 765b2c99..eae61374 100644 --- a/lib/src/utils/theme/theme_builders/switch_theme.dart +++ b/lib/src/utils/theme/theme_builders/switch_theme.dart @@ -33,7 +33,7 @@ extension SwitchExtension on ZetaColorScheme { /// Defines the overlay [Color] for the [Switch] when it's hovered. overlayColor: widgetStatePropertyResolver( - hoveredValue: zetaColors.black.withOpacity(0.1), + hoveredValue: zetaColors.black.withValues(alpha: 0.1), ), /// The smallest detectable part of [Switch] that can lead to a tap event. diff --git a/lib/src/utils/theme/theme_builders/tab_bar_theme.dart b/lib/src/utils/theme/theme_builders/tab_bar_theme.dart index 1139215f..ba282eec 100644 --- a/lib/src/utils/theme/theme_builders/tab_bar_theme.dart +++ b/lib/src/utils/theme/theme_builders/tab_bar_theme.dart @@ -17,8 +17,8 @@ extension TabBarExtension on ZetaColorScheme { /// [textTheme] is used to style the labels of the selected and unselected tabs. /// /// Returns a [TabBarTheme] that matches the [ZetaColorScheme]. - TabBarTheme tabBarTheme(TextTheme textTheme) { - return TabBarTheme( + TabBarThemeData tabBarTheme(TextTheme textTheme) { + return TabBarThemeData( /// The color of the line that appears below the selected tab. indicatorColor: zetaColors.secondary, diff --git a/lib/src/utils/theme/theme_builders/text_selection_theme.dart b/lib/src/utils/theme/theme_builders/text_selection_theme.dart index 7aa15cb3..9cb6fa44 100644 --- a/lib/src/utils/theme/theme_builders/text_selection_theme.dart +++ b/lib/src/utils/theme/theme_builders/text_selection_theme.dart @@ -22,7 +22,7 @@ extension TextSelectionExtension on ZetaColorScheme { cursorColor: zetaColors.secondary, /// Indicates the color of the text selection toolbar. - selectionColor: zetaColors.secondary.subtle.withOpacity(0.5), + selectionColor: zetaColors.secondary.subtle.withValues(alpha: 0.5), /// Color of the text selection handle. selectionHandleColor: zetaColors.secondary.selected, diff --git a/lib/src/utils/theme/theme_builders/zeta_theme.dart b/lib/src/utils/theme/theme_builders/zeta_theme.dart index 3168ef8d..908ef774 100644 --- a/lib/src/utils/theme/theme_builders/zeta_theme.dart +++ b/lib/src/utils/theme/theme_builders/zeta_theme.dart @@ -137,7 +137,6 @@ extension ZetaThemeBuilder on ZetaColorScheme { elevatedButtonTheme: elevatedButtonTheme(primaryTextTheme), fontFamily: fontFamily, iconTheme: iconTheme(color: zetaColors.iconDefault), - indicatorColor: secondary, inputDecorationTheme: inputDecorationTheme(textTheme), listTileTheme: listTileTheme(textTheme), outlinedButtonTheme: outlinedButtonTheme(primaryTextTheme), @@ -149,7 +148,7 @@ extension ZetaThemeBuilder on ZetaColorScheme { radioTheme: radioThemeData(), scaffoldBackgroundColor: zetaColors.surfaceTertiary, searchBarTheme: searchBarTheme(textTheme), - shadowColor: zetaColors.borderDisabled.withOpacity(0.7), + shadowColor: zetaColors.borderDisabled.withValues(alpha: 0.7), sliderTheme: sliderTheme(), splashColor: zetaColors.surfaceSelected, switchTheme: switchTheme(), diff --git a/lib/src/utils/theme/theme_data.dart b/lib/src/utils/theme/theme_data.dart index ea9bf0b8..632efd72 100644 --- a/lib/src/utils/theme/theme_data.dart +++ b/lib/src/utils/theme/theme_data.dart @@ -31,9 +31,9 @@ class _ZdsBaseColors { static bool isShadeOfRed(Color color) { // Get the red, green, and blue components of the color - final red = color.red; - final green = color.green; - final blue = color.blue; + final red = (color.r * 255).round() & 0xFF; + final green = (color.g * 255).round() & 0xFF; + final blue = (color.b * 255).round() & 0xFF; // Check if the red component is dominant return red > green && red > blue; @@ -486,7 +486,7 @@ class ZetaSwatchGenerator { return ZetaColorSwatch( contrast: contrast, brightness: brightness, - primary: primary.value, + primary: primary.toARGB32(), swatch: primary.generateSwatch(background: background, adjustPrimary: adjustAccessibility), ).apply(brightness: brightness); } diff --git a/lib/src/utils/tools/nested_flow.dart b/lib/src/utils/tools/nested_flow.dart index 6fadb69e..a3c52635 100644 --- a/lib/src/utils/tools/nested_flow.dart +++ b/lib/src/utils/tools/nested_flow.dart @@ -173,4 +173,9 @@ class ZdsNestedFlowState extends State implements NavigatorObserv Navigator.of(context).pop(await route.popped); } } + + @override + void didChangeTop(Route topRoute, Route? previousTopRoute) { + // TODO(routing): implement didChangeTop + } } diff --git a/lib/src/utils/tools/tab_navigator.dart b/lib/src/utils/tools/tab_navigator.dart index 39d76aee..7c60c2bd 100644 --- a/lib/src/utils/tools/tab_navigator.dart +++ b/lib/src/utils/tools/tab_navigator.dart @@ -137,7 +137,7 @@ class ZdsSplitNavigator extends StatefulWidget { BuildContext context, Route route, { bool rootNavigator = false, - }) async { + }) { return _handleNavigation( context: context, rootNavigator: rootNavigator, @@ -356,6 +356,11 @@ class ZdsSplitNavigatorState extends State with FrameCallback ..add(DiagnosticsProperty>('navigatorKey', navigatorKey)) ..add(DiagnosticsProperty>('currentRoute', currentRoute)); } + + @override + void didChangeTop(Route topRoute, Route? previousTopRoute) { + // TODO(routing): implement didChangeTop + } } class _SplitContent extends StatelessWidget { @@ -395,7 +400,7 @@ class _SplitContent extends StatelessWidget { final List? boxShadow = boxShadowDivider ? [ BoxShadow( - color: themeData.colorScheme.onSurface.withOpacity(0.1), + color: themeData.colorScheme.onSurface.withValues(alpha: 0.1), blurRadius: 2, offset: const Offset(-1, 0), ), diff --git a/lib/src/utils/tools/utils.dart b/lib/src/utils/tools/utils.dart index 5e1960a4..1afa17bd 100644 --- a/lib/src/utils/tools/utils.dart +++ b/lib/src/utils/tools/utils.dart @@ -261,9 +261,9 @@ extension LightHexColor on Color { /// Lightens this [Color]. Color withLight(double opacity, {Color? background}) { return Color.fromRGBO( - _transform(opacity, red, (background ?? Colors.white).red), - _transform(opacity, green, (background ?? Colors.white).green), - _transform(opacity, blue, (background ?? Colors.white).blue), + _transform(opacity, (r * 255).round() & 0xFF, ((background ?? Colors.white).r * 255).round() & 0xFF), + _transform(opacity, (g * 255).round() & 0xFF, ((background ?? Colors.white).g * 255).round() & 0xFF), + _transform(opacity, (b * 255).round() & 0xFF, ((background ?? Colors.white).b * 255).round() & 0xFF), 1, ); } @@ -290,18 +290,18 @@ extension LightHexColor on Color { /// /// Prefixes a hash sign if [leadingHashSign] is set to true (defaults to true). String toHex({bool leadingHashSign = true}) => '${leadingHashSign ? '#' : ''}' - '${alpha.toRadixString(16).padLeft(2, '0')}' - '${red.toRadixString(16).padLeft(2, '0')}' - '${green.toRadixString(16).padLeft(2, '0')}' - '${blue.toRadixString(16).padLeft(2, '0')}'; + '${((a * 255).round() & 0xFF).toRadixString(16).padLeft(2, '0')}' + '${((r * 255).round() & 0xFF).toRadixString(16).padLeft(2, '0')}' + '${((g * 255).round() & 0xFF).toRadixString(16).padLeft(2, '0')}' + '${((b * 255).round() & 0xFF).toRadixString(16).padLeft(2, '0')}'; /// Returns this Color's hexcode without the alpha channel. /// /// Prefixes a hash sign if [leadingHashSign] is set to true (defaults to true). String toHexNoAlpha({bool leadingHashSign = true}) => '${leadingHashSign ? '#' : ''}' - '${red.toRadixString(16).padLeft(2, '0')}' - '${green.toRadixString(16).padLeft(2, '0')}' - '${blue.toRadixString(16).padLeft(2, '0')}'; + '${((r * 255).round() & 0xFF).toRadixString(16).padLeft(2, '0')}' + '${((g * 255).round() & 0xFF).toRadixString(16).padLeft(2, '0')}' + '${((b * 255).round() & 0xFF).toRadixString(16).padLeft(2, '0')}'; } int _transform(double p, int t, int b) { @@ -381,10 +381,10 @@ extension LaunchUrlInWebView on Uri { /// [shade] Shade from 0-1 Color getShadedColor(Color input, double shade) { return Color.fromARGB( - input.alpha, - changeShade(input.red, 1 - shade), - changeShade(input.green, 1 - shade), - changeShade(input.blue, 1 - shade), + (input.a * 255).round() & 0xFF, + changeShade((input.r * 255).round() & 0xFF, 1 - shade), + changeShade((input.g * 255).round() & 0xFF, 1 - shade), + changeShade((input.b * 255).round() & 0xFFF, 1 - shade), ); } diff --git a/lib/zds_flutter.dart b/lib/zds_flutter.dart index 132b6329..764bcc0b 100644 --- a/lib/zds_flutter.dart +++ b/lib/zds_flutter.dart @@ -6,7 +6,7 @@ // its usage, and is particularly useful when exporting several components or utilities // as part of the public API. The use of a library name at the top aids in identifying // the package's purpose, especially for consumers of the package. -//ignore: unnecessary_library_name + library; export 'package:zeta_flutter/zeta_flutter.dart' hide DeviceType, ListDivider; diff --git a/pubspec.yaml b/pubspec.yaml index 11920c65..36276d67 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,73 +18,78 @@ environment: flutter: ">=3.16.0" dependencies: - any_link_preview: ^3.0.2 + any_link_preview: ^3.0.3 cached_network_image: ^3.4.1 - camerawesome: 2.1.0 # TODO: Update this once repo is on 3.27.x - chewie: ^1.8.5 - collection: ^1.18.0 - crop_image: ^1.0.15 + camerawesome: ^2.4.0 + chewie: ^1.11.3 + collection: ^1.19.1 + crop_image: ^1.0.16 cross_file: ^0.3.4+2 - csslib: ^0.17.3 + csslib: ^1.0.2 dart_emoji: ^0.2.0+2 dropdown_button2: ^2.3.9 expand_tap_area: ^1.1.1 - extended_image: ^8.3.1 - file_picker: ^8.1.4 + extended_image: ^8.1.0 + file_picker: ^10.1.9 flutter: sdk: flutter flutter_colorpicker: ^1.1.0 - flutter_html: ^3.0.0-beta.2 - flutter_html_audio: ^3.0.0-beta.2 - flutter_html_svg: ^3.0.0-beta.2 - flutter_html_table: ^3.0.0-beta.2 - flutter_html_video: ^3.0.0-beta.2 - flutter_image_compress: ^2.3.0 + flutter_html: ^3.0.0 + flutter_html_audio: ^3.0.0 + flutter_html_svg: ^3.0.0 + flutter_html_table: ^3.0.0 + flutter_html_video: ^3.0.0 + flutter_image_compress: ^2.4.0 flutter_inappwebview: ^6.1.5 - flutter_layout_grid: ^2.0.7 + flutter_layout_grid: ^2.0.8 flutter_localizations: sdk: flutter flutter_quill: ^10.8.2 flutter_quill_extensions: ^10.8.2 - flutter_slidable: ^3.1.1 - flutter_svg: ^2.0.10+1 + flutter_slidable: ^4.0.0 + flutter_svg: ^2.1.0 flutter_swipe_action_cell: ^3.1.5 giphy_get: ^3.5.6 - html: ^0.15.4 + html: ^0.15.6 http_client_helper: ^3.0.0 image_editor_plus: ^1.0.6 image_picker: ^1.1.2 interval_time_picker: ^3.0.3+9 - intl: ^0.19.0 - just_audio: ^0.9.38 + intl: ^0.20.2 + just_audio: ^0.10.3 linked_scroll_controller: ^0.2.0 mime: ^2.0.0 - modal_bottom_sheet: ^3.0.0-pre + modal_bottom_sheet: ^3.0.0 open_file: ^3.5.10 painter: ^2.0.0 - path: ^1.9.0 - path_provider: ^2.1.3 - popover: ^0.3.0+1 - record: ^5.1.1 + path: ^1.9.1 + path_provider: ^2.1.5 + popover: ^0.3.1 + record: ^6.0.0 screenshot: ^3.0.0 - share_plus: ^10.0.3 - shared_preferences: ^2.2.3 + share_plus: ^11.0.0 + shared_preferences: ^2.5.3 shimmer: ^3.0.0 - table_calendar: ^3.1.2 + table_calendar: ^3.2.0 text_editor: ^0.7.0 universal_platform: ^1.1.0 - url_launcher: ^6.3.0 + url_launcher: ^6.3.1 validators: ^3.0.0 - video_compress: ^3.1.3 - video_player: ^2.8.6 + video_compress: ^3.1.4 + video_player: ^2.10.0 vsc_quill_delta_to_html: ^1.0.5 zeta_flutter: ^0.20.2 +dependency_overrides: + flutter_slidable: ^4.0.0 + intl: ^0.20.2 + zeta_flutter: ^0.20.2 + dev_dependencies: flutter_test: sdk: flutter - lottie: ^3.1.2 - zds_analysis: ^1.1.1 + lottie: ^3.3.1 + zds_analysis: ^1.2.0 flutter: uses-material-design: true From 5a668d674cd79005a698b71d5192878c772de709 Mon Sep 17 00:00:00 2001 From: thelukewalton Date: Thu, 5 Jun 2025 16:03:44 +0100 Subject: [PATCH 2/4] fix failing test due to error in code --- example/lib/pages/components/comment.dart | 5 ----- .../components/organisms/chat/message_body/attachment.dart | 2 +- lib/src/utils/assets/icons.dart | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/example/lib/pages/components/comment.dart b/example/lib/pages/components/comment.dart index ea358b08..54bcc553 100644 --- a/example/lib/pages/components/comment.dart +++ b/example/lib/pages/components/comment.dart @@ -76,11 +76,6 @@ class _CommentDemoState extends State { author: 'John Doe', comment: 'This is a comment', timeStamp: '09:30 AM', - attachment: ZdsChatAttachment( - name: 'Blueprints', - size: '1234kb', - extension: 'ici', - ), ), ZdsComment( avatar: ZetaAvatar.initials( diff --git a/lib/src/components/organisms/chat/message_body/attachment.dart b/lib/src/components/organisms/chat/message_body/attachment.dart index 1e674ca9..ffbf1003 100644 --- a/lib/src/components/organisms/chat/message_body/attachment.dart +++ b/lib/src/components/organisms/chat/message_body/attachment.dart @@ -37,7 +37,7 @@ class ZdsChatAttachmentWidget extends StatelessWidget { Widget build(BuildContext context) { final zeta = Zeta.of(context); final colors = zeta.colors; - final foregroundColor = iconColor(_fileType, context); + final foregroundColor = iconColor(_fileType, context: context); final layoutBuilder = LayoutBuilder( builder: (context, constraints) { return Row( diff --git a/lib/src/utils/assets/icons.dart b/lib/src/utils/assets/icons.dart index 106a372d..e2820345 100644 --- a/lib/src/utils/assets/icons.dart +++ b/lib/src/utils/assets/icons.dart @@ -481,7 +481,7 @@ extension IconDataFromExt on String { } Color fileIconColor(BuildContext context) { - return iconColor(_safeExt, context); + return iconColor(_safeExt, context: context); } String get _safeExt { From 6c13cdc8fcd7e7586e067009bb8752856238f7db Mon Sep 17 00:00:00 2001 From: Luke Walton Date: Mon, 9 Jun 2025 14:01:04 +0100 Subject: [PATCH 3/4] Update lib/src/components/atoms/speed_slider.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- lib/src/components/atoms/speed_slider.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/components/atoms/speed_slider.dart b/lib/src/components/atoms/speed_slider.dart index b78c341f..ce60c39b 100644 --- a/lib/src/components/atoms/speed_slider.dart +++ b/lib/src/components/atoms/speed_slider.dart @@ -59,7 +59,7 @@ class ZdsSpeedSlider extends StatefulWidget { /// The state of the [ZdsSpeedSlider] class ZdsSpeedSliderState extends State with FrameCallbackMixin { late final ScrollController _scrollController; - final GlobalKey _scrollableKey = GlobalKey(); + final GlobalKey _scrollableKey = GlobalKey(); late List _itemKeys; int _selectedIndex = 0; From 53d3c8db463d7c79e5ddbf809103ce0d493d200c Mon Sep 17 00:00:00 2001 From: thelukewalton Date: Mon, 9 Jun 2025 14:16:02 +0100 Subject: [PATCH 4/4] remove unneeded dependencies in example app --- example/pubspec.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2dfcb4c9..4db4c228 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -12,18 +12,11 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - intl: any lottie: ^3.3.1 path_provider: ^2.1.5 scrollable_positioned_list: ^0.3.8 shared_preferences: ^2.5.3 table_calendar: ^3.2.0 - url_launcher: any - cross_file: any - zeta_flutter: any - flutter_quill: any - flutter_quill_extensions: any - image_picker: any dependency_overrides: flutter_slidable: ^4.0.0