From d736ecdb10f1edbb5e0afed004c3583701c8ea3c Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 3 Jan 2024 14:32:57 +0000 Subject: [PATCH] Update to latest version of flu/tter and update InAppWebView --- .../Flutter/GeneratedPluginRegistrant.swift | 2 ++ .../flutter/generated_plugin_registrant.cc | 3 ++ .../windows/flutter/generated_plugins.cmake | 1 + lib/src/components/atoms/button.dart | 2 +- lib/src/components/atoms/expandable.dart | 2 +- .../components/atoms/unread_badge_widget.dart | 2 +- lib/src/components/molecules/block_table.dart | 8 +++-- .../molecules/date_range_picker.dart | 11 ++----- .../molecules/fields_list_tile.dart | 2 +- .../components/molecules/network_avatar.dart | 2 +- lib/src/components/molecules/search.dart | 3 +- .../molecules/selectable_list_tile.dart | 4 +-- .../components/molecules/sheet_header.dart | 2 +- .../molecules/slidable_list_tile.dart | 5 ++-- lib/src/components/molecules/stats_card.dart | 3 +- .../components/organisms/bottom_tab_bar.dart | 2 +- .../organisms/date_range_picker_tile.dart | 30 +++++++------------ lib/src/components/organisms/day_picker.dart | 2 +- .../organisms/file_picker/file_picker.dart | 6 ++-- .../organisms/fiscal_date_picker.dart | 5 +--- .../organisms/html_preview/nested_table.dart | 16 +++------- .../organisms/quill_editor/html_parser.dart | 2 -- lib/src/utils/tools/nested_flow.dart | 10 ++++--- pubspec.yaml | 4 +-- 24 files changed, 54 insertions(+), 75 deletions(-) diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index 3bd4a32..78434d1 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,6 +8,7 @@ import Foundation import device_info_plus import file_selector_macos import flutter_image_compress_macos +import flutter_inappwebview_macos import package_info_plus import pasteboard import path_provider_foundation @@ -22,6 +23,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin")) + InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc index 7d98a88..183168b 100644 --- a/example/windows/flutter/generated_plugin_registrant.cc +++ b/example/windows/flutter/generated_plugin_registrant.cc @@ -8,6 +8,7 @@ #include #include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { @@ -15,6 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FileSelectorWindows")); PasteboardPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PasteboardPlugin")); + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake index 722afbe..69289a8 100644 --- a/example/windows/flutter/generated_plugins.cmake +++ b/example/windows/flutter/generated_plugins.cmake @@ -5,6 +5,7 @@ list(APPEND FLUTTER_PLUGIN_LIST file_selector_windows pasteboard + permission_handler_windows url_launcher_windows ) diff --git a/lib/src/components/atoms/button.dart b/lib/src/components/atoms/button.dart index bc84499..c922017 100644 --- a/lib/src/components/atoms/button.dart +++ b/lib/src/components/atoms/button.dart @@ -136,7 +136,7 @@ class ZdsButton extends StatelessWidget { isOnDarkBackground = false, isDangerButton = false; - /// The Widget that will go inside the button, typically a [Text] with style [Theme.textTheme.titleMedium]. + /// The Widget that will go inside the button, typically a [Text] with style [TextTheme.titleMedium]. /// /// Must not be null. final Widget child; diff --git a/lib/src/components/atoms/expandable.dart b/lib/src/components/atoms/expandable.dart index a24afd3..a02146f 100644 --- a/lib/src/components/atoms/expandable.dart +++ b/lib/src/components/atoms/expandable.dart @@ -15,7 +15,7 @@ const Duration _kFadeDuration = Duration(milliseconds: 200); /// /// See also: /// -/// * [readMore], an alternative way of making a collapsible widget. +/// * [ExpandableTextExtension.readMore], an alternative way of making a collapsible widget. class ZdsExpandable extends StatelessWidget { /// A widget that can be collapsed and expanded. const ZdsExpandable({ diff --git a/lib/src/components/atoms/unread_badge_widget.dart b/lib/src/components/atoms/unread_badge_widget.dart index b1d0fc6..0e63a48 100644 --- a/lib/src/components/atoms/unread_badge_widget.dart +++ b/lib/src/components/atoms/unread_badge_widget.dart @@ -99,7 +99,7 @@ class UnreadBadge extends StatelessWidget { : Directionality.of(context) == TextDirection.ltr ? '$maximumNumber+' : '+$maximumNumber', - textScaleFactor: MediaQuery.of(context).textScaleFactor > 1.35 ? 1.35 : null, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 1.35), style: themeData.textTheme.bodySmall?.copyWith( color: foregroundColor ?? (backgroundColor ?? themeData.colorScheme.error).onColor, fontSize: max(themeData.textTheme.bodySmall?.fontSize ?? 0, minHeight * 0.65), diff --git a/lib/src/components/molecules/block_table.dart b/lib/src/components/molecules/block_table.dart index bb28775..d0dc355 100644 --- a/lib/src/components/molecules/block_table.dart +++ b/lib/src/components/molecules/block_table.dart @@ -139,7 +139,7 @@ class _BlockTable extends State with WidgetsBindingObserver { _tableBody = _controllers.addAndGet(); WidgetsBinding.instance.addPostFrameCallback((Duration timeStamp) { - headerHeight = widget.rowHeaderHeight * MediaQuery.of(context).textScaleFactor; + headerHeight = widget.rowHeaderHeight; buildTable(); }); @@ -230,7 +230,8 @@ class _BlockTable extends State with WidgetsBindingObserver { Container( alignment: Alignment.center, width: _getDayColumnWidth(), - height: 28 * MediaQuery.of(context).textScaleFactor, + height: 28, + // height: 28 * MediaQuery.of(context).textScaleFactor, color: themeData.colorScheme.surface, child: Text( items[index].text, @@ -416,7 +417,8 @@ class _BlockTable extends State with WidgetsBindingObserver { return Container( alignment: Alignment.center, width: _getAssocColumnWidth(), - height: 28 * MediaQuery.of(context).textScaleFactor, + height: 28, + // height: 28 * MediaQuery.of(context).textScaleFactor, color: Theme.of(context).colorScheme.surface, ).paddingOnly(right: 1); } diff --git a/lib/src/components/molecules/date_range_picker.dart b/lib/src/components/molecules/date_range_picker.dart index ce0db05..c98b452 100644 --- a/lib/src/components/molecules/date_range_picker.dart +++ b/lib/src/components/molecules/date_range_picker.dart @@ -257,10 +257,6 @@ class _DatePickerDialogState extends State with RestorationMix final MaterialLocalizations localizations = MaterialLocalizations.of(context); final Orientation orientation = MediaQuery.of(context).orientation; final TextTheme textTheme = theme.textTheme; - // Constrain the textScaleFactor to the largest supported value to prevent - // layout issues. - final double textScaleFactor = math.min(MediaQuery.of(context).textScaleFactor, 1.3); - final String dateText = localizations.formatMediumDate(_selectedDate.value); final Color onPrimarySurface = colorScheme.brightness == Brightness.light ? colorScheme.onPrimary : colorScheme.onSurface; @@ -371,7 +367,7 @@ class _DatePickerDialogState extends State with RestorationMix entryModeButton: entryModeButton, ); - final Size dialogSize = _dialogSize(context) * textScaleFactor; + final Size dialogSize = _dialogSize(context); return Dialog( insetPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24), clipBehavior: Clip.antiAlias, @@ -382,7 +378,7 @@ class _DatePickerDialogState extends State with RestorationMix curve: Curves.easeIn, child: MediaQuery( data: MediaQuery.of(context).copyWith( - textScaleFactor: textScaleFactor, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 1.3), ), child: Builder( builder: (BuildContext context) { @@ -1305,7 +1301,6 @@ class _ZdsDateRangePickerDialogState extends State wit Widget build(BuildContext context) { final MediaQueryData mediaQuery = MediaQuery.of(context); final Orientation orientation = mediaQuery.orientation; - final double textScaleFactor = math.min(mediaQuery.textScaleFactor, 1.3); final MaterialLocalizations localizations = MaterialLocalizations.of(context); final ColorScheme colorScheme = Theme.of(context).colorScheme; final Color onPrimarySurface = @@ -1427,7 +1422,7 @@ class _ZdsDateRangePickerDialogState extends State wit curve: Curves.easeIn, child: MediaQuery( data: MediaQuery.of(context).copyWith( - textScaleFactor: textScaleFactor, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 1.3), ), child: Builder( builder: (BuildContext context) { diff --git a/lib/src/components/molecules/fields_list_tile.dart b/lib/src/components/molecules/fields_list_tile.dart index 239b115..16a90f3 100644 --- a/lib/src/components/molecules/fields_list_tile.dart +++ b/lib/src/components/molecules/fields_list_tile.dart @@ -62,7 +62,7 @@ class ZdsFieldsListTile extends StatelessWidget { /// The textStyle used for the starting elements of each field. /// - /// Defaults to [TextTheme.titleSmall] with [$color.zeta.text.default] color. + /// Defaults to [TextTheme.titleSmall] with [ZetaColorSwatch.text] color. final TextStyle? fieldsStartTextStyle; /// The textStyle used for the end elements of each field. diff --git a/lib/src/components/molecules/network_avatar.dart b/lib/src/components/molecules/network_avatar.dart index ce39dad..5e61dda 100644 --- a/lib/src/components/molecules/network_avatar.dart +++ b/lib/src/components/molecules/network_avatar.dart @@ -74,7 +74,7 @@ class ZdsNetworkAvatar extends StatelessWidget implements PreferredSizeWidget { final Center initialsWidget = Center( child: Text( initials, - textScaleFactor: 1, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 1), style: textStyle ?? themeData.textTheme.displaySmall?.copyWith( color: (backgroundColor ?? themeData.colorScheme.secondary).onColor, diff --git a/lib/src/components/molecules/search.dart b/lib/src/components/molecules/search.dart index c34f82d..d2bc090 100644 --- a/lib/src/components/molecules/search.dart +++ b/lib/src/components/molecules/search.dart @@ -1,11 +1,10 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; - import '../../../../zds_flutter.dart'; /// Variants of [ZdsSearchField]. enum ZdsSearchFieldVariant { - /// Creates a Search field with a border on all edges of color [ZetaColors.warm.60]. + /// Creates a Search field with a border on all edges of color `ZetaColors.warm.60`. outlined, /// Creates a Search field with a box shadow around the edges with a radius of 4. diff --git a/lib/src/components/molecules/selectable_list_tile.dart b/lib/src/components/molecules/selectable_list_tile.dart index 6b0ec0c..51f7bd3 100644 --- a/lib/src/components/molecules/selectable_list_tile.dart +++ b/lib/src/components/molecules/selectable_list_tile.dart @@ -7,8 +7,8 @@ import '../../../../zds_flutter.dart'; /// /// There are two variants: /// * [ZdsSelectableListTile], which returns a list tile that changes its color when selected. -/// When a listTile is marked as selected, its background will be colored with the [Theme.colorScheme.secondary] at 10% -/// opacity. When it's unselected, the background will use [Theme.colorScheme.surface] +/// When a listTile is marked as selected, its background will be colored with the [ColorScheme.secondary] at 10% +/// opacity. When it's unselected, the background will use [ColorScheme.surface] /// * [ZdsSelectableListTile.checkable], which returns a list tile that adds a check at the end of the tile when selected. /// /// This widget does not manage its own state, but should rather be rebuilt by the parent widget's state through diff --git a/lib/src/components/molecules/sheet_header.dart b/lib/src/components/molecules/sheet_header.dart index da04808..3c7f422 100644 --- a/lib/src/components/molecules/sheet_header.dart +++ b/lib/src/components/molecules/sheet_header.dart @@ -56,7 +56,7 @@ class ZdsSheetHeader extends StatelessWidget implements PreferredSizeWidget { headerText, style: headerTextStyle ?? themeData.textTheme.headlineMedium, overflow: TextOverflow.ellipsis, - textScaleFactor: MediaQuery.of(context).textScaleFactor > 2 ? 2 : null, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 2), ), ).paddingOnly(bottom: 5), if (leading != null) diff --git a/lib/src/components/molecules/slidable_list_tile.dart b/lib/src/components/molecules/slidable_list_tile.dart index 227e09e..067a68b 100644 --- a/lib/src/components/molecules/slidable_list_tile.dart +++ b/lib/src/components/molecules/slidable_list_tile.dart @@ -307,9 +307,8 @@ class CustomSlidableAction extends StatelessWidget { /// {@template slidable.actions.foregroundColor} /// The foreground color of this action. /// - /// Defaults to [Colors.black] if [backgroundColor]'s brightness is - /// [Brightness.light], or to [Colors.white] if [backgroundColor]'s brightness is - /// [Brightness.dark]. + /// Defaults to [Colors.black] if the background brightness is [Brightness.light], + /// or to [Colors.white] if background brightness is [Brightness.dark]. /// {@endtemplate} final Color? foregroundColor; diff --git a/lib/src/components/molecules/stats_card.dart b/lib/src/components/molecules/stats_card.dart index a9cca4b..b138589 100644 --- a/lib/src/components/molecules/stats_card.dart +++ b/lib/src/components/molecules/stats_card.dart @@ -52,10 +52,9 @@ class ZdsStatCard extends StatelessWidget { final ZdsCardVariant? cardVariant; bool _isVertical(BuildContext context, BoxConstraints constraints) { - final double scale = MediaQuery.of(context).textScaleFactor; final double totalPadding = stats.length * 2 * _padding; final double totalDividers = _dividerWidth * 0.5 * (stats.length - 1); - final double width = ((totalDividers + totalPadding - constraints.maxWidth) / -stats.length) / scale; + final double width = (totalDividers + totalPadding - constraints.maxWidth) / -stats.length; for (int i = 0; i < stats.length; i++) { final bool description = hasTextOverflow(stats[i].description, Theme.of(context).textTheme.bodySmall!, width); final bool value = hasTextOverflow( diff --git a/lib/src/components/organisms/bottom_tab_bar.dart b/lib/src/components/organisms/bottom_tab_bar.dart index d392f97..629c2d2 100644 --- a/lib/src/components/organisms/bottom_tab_bar.dart +++ b/lib/src/components/organisms/bottom_tab_bar.dart @@ -190,7 +190,7 @@ class _ZdsBottomTabBarTile extends StatelessWidget { child: Text( label, style: labelStyle, - textScaleFactor: MediaQuery.of(context).textScaleFactor > 1.35 ? 1.35 : null, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 1.35), ), ), ], diff --git a/lib/src/components/organisms/date_range_picker_tile.dart b/lib/src/components/organisms/date_range_picker_tile.dart index b1b7d44..9a6329e 100644 --- a/lib/src/components/organisms/date_range_picker_tile.dart +++ b/lib/src/components/organisms/date_range_picker_tile.dart @@ -105,9 +105,8 @@ class ZdsDateRangePickerTileForm extends FormField { BuildContext context, BoxConstraints constraints, ) { - final double scale = MediaQuery.of(context).textScaleFactor; - final double width = _calculateWidth(constraints, scale); - final bool isColumn = constraints.maxWidth <= _screenColumnBreakpoint * scale; + final double width = _calculateWidth(constraints); + final bool isColumn = constraints.maxWidth <= _screenColumnBreakpoint; final List fields = [ _DateField( date: state.value?.start ?? initialValue.start, @@ -123,7 +122,6 @@ class ZdsDateRangePickerTileForm extends FormField { validator: (DateTime? value) => state.hasError ? '' : null, isInitialDate: true, width: width, - scale: scale, startDayOfWeek: startDayOfWeek, okClickText: okClickText, cancelClickText: cancelClickText, @@ -145,7 +143,6 @@ class ZdsDateRangePickerTileForm extends FormField { ); }, width: width, - scale: scale, startDayOfWeek: startDayOfWeek, okClickText: okClickText, cancelClickText: cancelClickText, @@ -335,13 +332,13 @@ class ZdsDateRangePickerTile extends StatefulWidget { } } -double _calculateWidth(BoxConstraints constraints, double scale) { - final double maxWidthScale = _screenColumnBreakpoint * scale; - final double maxScale = (_screenColumnBreakpoint / 2) * scale; +double _calculateWidth(BoxConstraints constraints) { + const double maxWidthScale = _screenColumnBreakpoint; + const double maxScale = _screenColumnBreakpoint / 2; if (constraints.maxWidth < maxWidthScale) { return maxWidthScale.clamp(0, maxScale); } else { - final double calculatedWidth = ((constraints.maxWidth - _padding) / 2) * scale; + final double calculatedWidth = (constraints.maxWidth - _padding) / 2; return calculatedWidth.clamp(0, maxScale); } } @@ -389,9 +386,8 @@ class _ZdsDateRangePickerTileState extends State { autovalidateMode: AutovalidateMode.onUserInteraction, child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { - final double scale = MediaQuery.of(context).textScaleFactor; - final double width = _calculateWidth(constraints, scale); - final bool isColumn = constraints.maxWidth <= _screenColumnBreakpoint * scale; + final double width = _calculateWidth(constraints); + final bool isColumn = constraints.maxWidth <= _screenColumnBreakpoint; final List fields = [ _DateField( date: initialDate, @@ -412,7 +408,6 @@ class _ZdsDateRangePickerTileState extends State { }, isInitialDate: true, width: width, - scale: scale, startDayOfWeek: widget.startDayOfWeek, okClickText: widget.okClickText, cancelClickText: widget.cancelClickText, @@ -439,7 +434,6 @@ class _ZdsDateRangePickerTileState extends State { return null; }, width: width, - scale: scale, startDayOfWeek: widget.startDayOfWeek, okClickText: widget.okClickText, cancelClickText: widget.cancelClickText, @@ -487,7 +481,6 @@ class _DateField extends StatelessWidget { required this.date, required this.format, required this.width, - required this.scale, this.validator, this.initialSelectableDate, this.finalSelectableDate, @@ -507,7 +500,6 @@ class _DateField extends StatelessWidget { final String format; final String? helpText; final double width; - final double scale; final String? Function(DateTime?)? validator; /// Starting day of week 1, 2, 3, Sunday, Monday, Tuesday respectively. @@ -586,13 +578,12 @@ class _DateField extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SizedBox( - height: _fontLineHeight * scale, + height: _fontLineHeight, child: date != null ? Text( date!.format(format), style: Theme.of(context).textTheme.bodyLarge?.copyWith( - height: - (_fontLineHeight / Theme.of(context).textTheme.bodyLarge!.fontSize!) / scale, + height: _fontLineHeight / Theme.of(context).textTheme.bodyLarge!.fontSize!, ), ) : null, @@ -646,7 +637,6 @@ class _DateField extends StatelessWidget { ..add(StringProperty('format', format)) ..add(StringProperty('helpText', helpText)) ..add(DoubleProperty('width', width)) - ..add(DoubleProperty('scale', scale)) ..add( ObjectFlagProperty.has( 'validator', diff --git a/lib/src/components/organisms/day_picker.dart b/lib/src/components/organisms/day_picker.dart index 8c5a78b..fdff9a1 100644 --- a/lib/src/components/organisms/day_picker.dart +++ b/lib/src/components/organisms/day_picker.dart @@ -234,7 +234,7 @@ class _ZdsDayPickerState extends State { Widget build(BuildContext context) { return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { - final double pillWidth = 68 * MediaQuery.of(context).textScaleFactor; + const double pillWidth = 68; const int pillSpacing = 4; const double horizontalPadding = 12; diff --git a/lib/src/components/organisms/file_picker/file_picker.dart b/lib/src/components/organisms/file_picker/file_picker.dart index f4e87a7..1c20737 100644 --- a/lib/src/components/organisms/file_picker/file_picker.dart +++ b/lib/src/components/organisms/file_picker/file_picker.dart @@ -248,7 +248,7 @@ class ZdsFilePicker extends StatefulWidget { /// List of processes a file should undergo post getting picked from file picker /// - /// Defaults to [zds DefaultPostProcessors] + /// Defaults to [zdsDefaultPostProcessors] final List? postProcessors; /// Validations that are needed to be performed on a file @@ -258,7 +258,7 @@ class ZdsFilePicker extends StatefulWidget { /// A function called whenever any exception is thrown in selection process /// - /// Defaults to [zds FileError] + /// Defaults to [zdsFileError] final void Function(BuildContext context, FilePickerConfig config, Exception exception)? onError; @override @@ -781,7 +781,7 @@ extension on ZdsFilePickerState { maxLines: 1, overflow: TextOverflow.ellipsis, style: style?.copyWith(color: zetaColors.textSubtle), - textScaleFactor: MediaQuery.of(context).textScaleFactor > 2.7 ? 2.7 : null, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 2.7), ), ], ], diff --git a/lib/src/components/organisms/fiscal_date_picker.dart b/lib/src/components/organisms/fiscal_date_picker.dart index 942f881..539443c 100644 --- a/lib/src/components/organisms/fiscal_date_picker.dart +++ b/lib/src/components/organisms/fiscal_date_picker.dart @@ -1,5 +1,3 @@ -import 'dart:math' as math; - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:table_calendar/table_calendar.dart'; @@ -129,7 +127,6 @@ class _ZdsDatePickerDialogState extends State { Widget build(BuildContext context) { final Orientation orientation = MediaQuery.of(context).orientation; final Size size = orientation == Orientation.portrait ? _inputPortraitDialogSize : _inputRangeLandscapeDialogSize; - final double textScaleFactor = math.min(MediaQuery.of(context).textScaleFactor, 1.3); final theme = Theme.of(context); final fixContent = [ @@ -220,7 +217,7 @@ class _ZdsDatePickerDialogState extends State { curve: Curves.easeIn, child: MediaQuery( data: MediaQuery.of(context).copyWith( - textScaleFactor: textScaleFactor, + textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 1.3), ), child: Builder( builder: (BuildContext context) { diff --git a/lib/src/components/organisms/html_preview/nested_table.dart b/lib/src/components/organisms/html_preview/nested_table.dart index d5d72b6..a8566cc 100644 --- a/lib/src/components/organisms/html_preview/nested_table.dart +++ b/lib/src/components/organisms/html_preview/nested_table.dart @@ -31,7 +31,7 @@ class ZdsNestedTableView extends StatelessWidget { String get _tablecss => 'table, th, td{border:1px solid gray;}table {border-collapse: collapse;}td, tr{padding:6px}th {text-align: left;}'; - ///Initial `data` as a content for an [WebView] instance. + ///Initial `data` as a content for an [InAppWebView] instance. InAppWebViewInitialData? get initialData => InAppWebViewInitialData( data: html, ); @@ -50,17 +50,9 @@ class ZdsNestedTableView extends StatelessWidget { Factory(VerticalDragGestureRecognizer.new), Factory(HorizontalDragGestureRecognizer.new), }, - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - useShouldOverrideUrlLoading: true, - mediaPlaybackRequiresUserGesture: false, - ), - android: AndroidInAppWebViewOptions( - useHybridComposition: true, - ), - ios: IOSInAppWebViewOptions( - allowsInlineMediaPlayback: true, - ), + initialSettings: InAppWebViewSettings( + useShouldOverrideUrlLoading: true, + allowsInlineMediaPlayback: true, ), onPageCommitVisible: (controller, url) { if (applyCss) { diff --git a/lib/src/components/organisms/quill_editor/html_parser.dart b/lib/src/components/organisms/quill_editor/html_parser.dart index 522bd01..e8600bc 100644 --- a/lib/src/components/organisms/quill_editor/html_parser.dart +++ b/lib/src/components/organisms/quill_editor/html_parser.dart @@ -51,7 +51,6 @@ extension DeltaToHtml on Delta { ''', ), - initialOptions: InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions()), onWebViewCreated: (InAppWebViewController controller) { // JavaScript handler to retrieve the converted HTML and complete the completer. controller.addJavaScriptHandler( @@ -119,7 +118,6 @@ extension HtmlToDelta on String { ''', ), - initialOptions: InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions()), onWebViewCreated: (InAppWebViewController controller) { // JavaScript handler to retrieve the converted Delta and complete the completer. controller.addJavaScriptHandler( diff --git a/lib/src/utils/tools/nested_flow.dart b/lib/src/utils/tools/nested_flow.dart index cc2c472..47277aa 100644 --- a/lib/src/utils/tools/nested_flow.dart +++ b/lib/src/utils/tools/nested_flow.dart @@ -70,13 +70,15 @@ class ZdsNestedFlowState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { + return PopScope( + canPop: false, + onPopInvoked: (_) async { if (_navigator.currentState?.canPop() ?? false) { await _navigator.currentState?.maybePop(); - return false; } - return widget.shouldClose; + if (widget.shouldClose && context.mounted) { + Navigator.of(context).pop(); + } }, child: Navigator( key: _navigator, diff --git a/pubspec.yaml b/pubspec.yaml index d273d00..25aeecc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,7 +26,7 @@ dependencies: dropdown_button2: ^2.1.4 expand_tap_area: ^1.1.0 extended_image: ^8.1.0 - file_picker: ^5.1.0 + file_picker: ^6.1.1 flutter: sdk: flutter flutter_html: ^3.0.0-beta.2 @@ -35,7 +35,7 @@ dependencies: flutter_html_table: ^3.0.0-beta.2 flutter_html_video: ^3.0.0-beta.2 flutter_image_compress: ^2.0.4 - flutter_inappwebview: ^5.7.2+3 + flutter_inappwebview: ^6.0.0 flutter_layout_grid: ^2.0.5 flutter_localizations: sdk: flutter