Skip to content

Commit

Permalink
Update to latest version of flu/tter and update InAppWebView
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jan 3, 2024
1 parent 23fd937 commit d736ecd
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 75 deletions.
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
Expand Down
3 changes: 3 additions & 0 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

#include <file_selector_windows/file_selector_windows.h>
#include <pasteboard/pasteboard_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
1 change: 1 addition & 0 deletions example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
pasteboard
permission_handler_windows
url_launcher_windows
)

Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/atoms/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/atoms/expandable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/atoms/unread_badge_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 5 additions & 3 deletions lib/src/components/molecules/block_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class _BlockTable extends State<ZdsBlockTable> with WidgetsBindingObserver {
_tableBody = _controllers.addAndGet();

WidgetsBinding.instance.addPostFrameCallback((Duration timeStamp) {
headerHeight = widget.rowHeaderHeight * MediaQuery.of(context).textScaleFactor;
headerHeight = widget.rowHeaderHeight;
buildTable();
});

Expand Down Expand Up @@ -230,7 +230,8 @@ class _BlockTable extends State<ZdsBlockTable> 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,
Expand Down Expand Up @@ -416,7 +417,8 @@ class _BlockTable extends State<ZdsBlockTable> 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);
}
Expand Down
11 changes: 3 additions & 8 deletions lib/src/components/molecules/date_range_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,6 @@ class _DatePickerDialogState extends State<DatePickerDialog> 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;
Expand Down Expand Up @@ -371,7 +367,7 @@ class _DatePickerDialogState extends State<DatePickerDialog> 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,
Expand All @@ -382,7 +378,7 @@ class _DatePickerDialogState extends State<DatePickerDialog> 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) {
Expand Down Expand Up @@ -1305,7 +1301,6 @@ class _ZdsDateRangePickerDialogState extends State<ZdsDateRangePickerDialog> 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 =
Expand Down Expand Up @@ -1427,7 +1422,7 @@ class _ZdsDateRangePickerDialogState extends State<ZdsDateRangePickerDialog> 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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/molecules/fields_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ZdsFieldsListTile<T> 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.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/molecules/network_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions lib/src/components/molecules/search.dart
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/components/molecules/selectable_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/molecules/sheet_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions lib/src/components/molecules/slidable_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions lib/src/components/molecules/stats_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/organisms/bottom_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
),
],
Expand Down
30 changes: 10 additions & 20 deletions lib/src/components/organisms/date_range_picker_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ class ZdsDateRangePickerTileForm extends FormField<ZdsDateTimeRange> {
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<Widget> fields = <Widget>[
_DateField(
date: state.value?.start ?? initialValue.start,
Expand All @@ -123,7 +122,6 @@ class ZdsDateRangePickerTileForm extends FormField<ZdsDateTimeRange> {
validator: (DateTime? value) => state.hasError ? '' : null,
isInitialDate: true,
width: width,
scale: scale,
startDayOfWeek: startDayOfWeek,
okClickText: okClickText,
cancelClickText: cancelClickText,
Expand All @@ -145,7 +143,6 @@ class ZdsDateRangePickerTileForm extends FormField<ZdsDateTimeRange> {
);
},
width: width,
scale: scale,
startDayOfWeek: startDayOfWeek,
okClickText: okClickText,
cancelClickText: cancelClickText,
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -389,9 +386,8 @@ class _ZdsDateRangePickerTileState extends State<ZdsDateRangePickerTile> {
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<Widget> fields = <Widget>[
_DateField(
date: initialDate,
Expand All @@ -412,7 +408,6 @@ class _ZdsDateRangePickerTileState extends State<ZdsDateRangePickerTile> {
},
isInitialDate: true,
width: width,
scale: scale,
startDayOfWeek: widget.startDayOfWeek,
okClickText: widget.okClickText,
cancelClickText: widget.cancelClickText,
Expand All @@ -439,7 +434,6 @@ class _ZdsDateRangePickerTileState extends State<ZdsDateRangePickerTile> {
return null;
},
width: width,
scale: scale,
startDayOfWeek: widget.startDayOfWeek,
okClickText: widget.okClickText,
cancelClickText: widget.cancelClickText,
Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -586,13 +578,12 @@ class _DateField extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
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,
Expand Down Expand Up @@ -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<String? Function(DateTime? p1)?>.has(
'validator',
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/organisms/day_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class _ZdsDayPickerState extends State<ZdsDayPicker> {
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;

Expand Down
6 changes: 3 additions & 3 deletions lib/src/components/organisms/file_picker/file_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<ZdsFilePostProcessor>? postProcessors;

/// Validations that are needed to be performed on a file
Expand All @@ -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
Expand Down Expand Up @@ -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),
),
],
],
Expand Down
Loading

0 comments on commit d736ecd

Please sign in to comment.