diff --git a/lib/src/components/molecules/date_range_picker.dart b/lib/src/components/molecules/date_range_picker.dart index 8b90346..825b77f 100644 --- a/lib/src/components/molecules/date_range_picker.dart +++ b/lib/src/components/molecules/date_range_picker.dart @@ -608,67 +608,6 @@ class _DatePickerHeader extends StatelessWidget { } } -/// Use [showZdsDateRangePicker] -@Deprecated('Use showZdsDateRangePicker') -Future showRflxDateRangePicker({ - required DateTime firstDate, - required DateTime lastDate, - required BuildContext context, - DateTimeRange? initialDateRange, - DateTime? currentDate, - DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar, - String? helpText, - String? cancelText, - String? confirmText, - String? saveText, - String? errorFormatText, - String? errorInvalidText, - String? errorInvalidRangeText, - String? fieldStartHintText, - String? fieldEndHintText, - String? fieldStartLabelText, - String? fieldEndLabelText, - String? clearButtonString, - String? applyButtonString, - Locale? locale, - bool useRootNavigator = true, - RouteSettings? routeSettings, - TextDirection? textDirection, - TransitionBuilder? builder, - List? actions, - bool isWeekMode = false, - int startingDayOfWeek = 0, -}) async => - showZdsDateRangePicker( - firstDate: firstDate, - lastDate: lastDate, - context: context, - initialDateRange: initialDateRange, - currentDate: currentDate, - initialEntryMode: initialEntryMode, - helpText: helpText, - cancelText: cancelText, - confirmText: confirmText, - saveText: saveText, - errorFormatText: errorFormatText, - errorInvalidText: errorInvalidText, - errorInvalidRangeText: errorInvalidRangeText, - fieldStartHintText: fieldStartHintText, - fieldEndHintText: fieldEndHintText, - fieldStartLabelText: fieldStartLabelText, - fieldEndLabelText: fieldEndLabelText, - clearButtonString: clearButtonString, - applyButtonString: applyButtonString, - locale: locale, - useRootNavigator: useRootNavigator, - routeSettings: routeSettings, - textDirection: textDirection, - builder: builder, - actions: actions, - isWeekMode: isWeekMode, - startingDayOfWeek: startingDayOfWeek, - ); - /// Shows a full screen modal dialog containing a Material Design date range /// picker. /// diff --git a/lib/src/components/molecules/date_time_picker.dart b/lib/src/components/molecules/date_time_picker.dart index c94cdba..f5688b2 100644 --- a/lib/src/components/molecules/date_time_picker.dart +++ b/lib/src/components/molecules/date_time_picker.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:interval_time_picker/interval_time_picker.dart' as interval_picker; +import 'package:interval_time_picker/models/visible_step.dart'; import 'package:intl/intl.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; @@ -87,6 +88,7 @@ class ZdsDateTimePicker extends StatefulWidget { this.okClickText, this.cancelClickText, this.startDayOfWeek, + this.visibleStep = VisibleStep.fifths, }) : format = (format?.isNotEmpty ?? false) ? format! : (mode == DateTimePickerMode.date @@ -177,6 +179,11 @@ class ZdsDateTimePicker extends StatefulWidget { /// Starting day of week 1, 2, 3, Sunday, Monday, Tuesday respectively. final int? startDayOfWeek; + /// Used when [interval] is set to determine the visible steps in the time picker. + /// + /// Defaults to [VisibleStep.fifths]. + final VisibleStep visibleStep; + @override ZdsDateTimePickerState createState() => ZdsDateTimePickerState(); @@ -205,7 +212,8 @@ class ZdsDateTimePicker extends StatefulWidget { ..add(EnumProperty('timePickerEntryMode', timePickerEntryMode)) ..add(StringProperty('okClickText', okClickText)) ..add(StringProperty('cancelClickText', cancelClickText)) - ..add(IntProperty('startDayOfWeek', startDayOfWeek)); + ..add(IntProperty('startDayOfWeek', startDayOfWeek)) + ..add(EnumProperty('visibleStep', visibleStep)); } } @@ -371,11 +379,12 @@ class ZdsDateTimePickerState extends State { helpText: widget.helpText, builder: timePickerBuilder, ) - : mounted + : context.mounted ? await interval_picker.showIntervalTimePicker( context: context, initialTime: initialValue, interval: widget.interval!, + visibleStep: widget.visibleStep, errorInvalidText: widget.timePickerErrorText, initialEntryMode: _getIntervalPickerMode(), builder: timePickerBuilder, @@ -383,8 +392,6 @@ class ZdsDateTimePickerState extends State { ) : null; - // final selectedTime = timePickerResult ?? (currentValue != null ? TimeOfDay.fromDateTime(currentValue) : null); - return timePickerResult; } @@ -410,13 +417,5 @@ class ZdsDateTimePickerState extends State { time?.minute ?? 0, ); - DateTime? _convert(TimeOfDay? time) => time == null - ? null - : DateTime( - 1, - 1, - 1, - time.hour, - time.minute, - ); + DateTime? _convert(TimeOfDay? time) => time == null ? null : DateTime(1, 1, 1, time.hour, time.minute); } diff --git a/lib/src/components/molecules/star_rating.dart b/lib/src/components/molecules/star_rating.dart index 6b8923f..df1ef85 100644 --- a/lib/src/components/molecules/star_rating.dart +++ b/lib/src/components/molecules/star_rating.dart @@ -47,6 +47,7 @@ class ZdsStarRating extends StatefulWidget { @override State createState() => _ZdsStarRatingState(); + @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); @@ -109,6 +110,7 @@ class _ZdsStarRatingState extends State { width: _boxSize * widget.size.toDouble(), child: LayoutBuilder( builder: (_, constraints) { + final borderRadius = widget.rounded ? Zeta.of(context).radius.rounded : Zeta.of(context).radius.none; return GestureDetector( onHorizontalDragStart: (details) => setState(() => _selected = true), onHorizontalDragEnd: (details) => setState(() => _selected = false), @@ -117,7 +119,7 @@ class _ZdsStarRatingState extends State { duration: const Duration(milliseconds: 250), decoration: BoxDecoration( color: colors.cool.shade30.withOpacity(_selected ? 1 : 0), - borderRadius: widget.rounded ? BorderRadius.circular(8) : BorderRadius.circular(0), + borderRadius: borderRadius, ), child: Row( mainAxisSize: MainAxisSize.min, @@ -126,7 +128,7 @@ class _ZdsStarRatingState extends State { (int index) => SizedBox.square( dimension: _boxSize, child: InkWell( - borderRadius: widget.rounded ? BorderRadius.circular(8) : BorderRadius.circular(0), + borderRadius: borderRadius, splashColor: colors.cool.shade30, onTap: () { if (widget.halfIncrements && index + 0.5 == _valueTapped) { @@ -162,11 +164,11 @@ extension on _StarValue { IconData icon({required bool rounded}) { switch (this) { case _StarValue.empty: - return rounded ? Icons.star_outline_rounded : Icons.star_outline_sharp; + return rounded ? ZetaIcons.star_outline_round : ZetaIcons.star_outline_sharp; case _StarValue.half: - return rounded ? Icons.star_half_rounded : Icons.star_half_sharp; + return rounded ? ZetaIcons.star_half_round : ZetaIcons.star_half_sharp; case _StarValue.full: - return rounded ? Icons.star_rounded : Icons.star_sharp; + return rounded ? ZetaIcons.star_round : ZetaIcons.star_sharp; } } } diff --git a/lib/src/components/molecules/toast.dart b/lib/src/components/molecules/toast.dart index afbf527..4cf7194 100644 --- a/lib/src/components/molecules/toast.dart +++ b/lib/src/components/molecules/toast.dart @@ -100,11 +100,11 @@ class ZdsToast extends StatelessWidget implements PreferredSizeWidget { Color _backgroundColor(ZetaColors colors, ZdsToastColors toastColor) { switch (toastColor) { case ZdsToastColors.success: - return colors.surfacePositive.shade10; + return colors.surfacePositiveSubtle; case ZdsToastColors.warning: - return colors.surfaceWarning.shade10; + return colors.surfaceWarningSubtle; case ZdsToastColors.info: - return colors.surfaceInfo.shade10; + return colors.surfaceInfoSubtle; case ZdsToastColors.error: return colors.error.shade10; case ZdsToastColors.primary: diff --git a/lib/src/components/organisms/calendar.dart b/lib/src/components/organisms/calendar.dart index 06dfb92..ad3e4a6 100644 --- a/lib/src/components/organisms/calendar.dart +++ b/lib/src/components/organisms/calendar.dart @@ -65,6 +65,8 @@ class ZdsCalendar extends StatefulWidget { this.previousTooltip, this.nextTooltip, this.selectedRange, + @Deprecated('This parameter is no longer used and will be removed in the next major version.') + bool showSelectedDateHeader = false, }) : _variant = _ZdsCalendarVariant.switchable, hasHeader = true; @@ -101,6 +103,8 @@ class ZdsCalendar extends StatefulWidget { this.previousTooltip, this.nextTooltip, this.selectedRange, + @Deprecated('This parameter is no longer used and will be removed in the next major version.') + bool showSelectedDateHeader = false, }) : _variant = _ZdsCalendarVariant.monthly; /// Shows a calendar in a fixed weekly format. @@ -135,6 +139,8 @@ class ZdsCalendar extends StatefulWidget { this.previousTooltip, this.nextTooltip, this.selectedRange, + @Deprecated('This parameter is no longer used and will be removed in the next major version.') + bool showSelectedDateHeader = false, }) : _variant = _ZdsCalendarVariant.weekly, hasHeader = false; diff --git a/lib/src/components/organisms/chat/message_body/attachment.dart b/lib/src/components/organisms/chat/message_body/attachment.dart index 504bad9..ffbf100 100644 --- a/lib/src/components/organisms/chat/message_body/attachment.dart +++ b/lib/src/components/organisms/chat/message_body/attachment.dart @@ -35,7 +35,8 @@ class ZdsChatAttachmentWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final colors = Zeta.of(context).colors; + final zeta = Zeta.of(context); + final colors = zeta.colors; final foregroundColor = iconColor(_fileType, context: context); final layoutBuilder = LayoutBuilder( builder: (context, constraints) { @@ -48,7 +49,7 @@ class ZdsChatAttachmentWidget extends StatelessWidget { margin: const EdgeInsets.all(12), decoration: BoxDecoration( color: colors.surfacePrimary, - borderRadius: const BorderRadius.all(Radius.circular(8)), + borderRadius: zeta.radius.rounded, border: Border.all(color: colors.borderSubtle), ), child: Column( diff --git a/lib/src/components/organisms/file_picker/file_picker.dart b/lib/src/components/organisms/file_picker/file_picker.dart index 3e2b98a..e685473 100644 --- a/lib/src/components/organisms/file_picker/file_picker.dart +++ b/lib/src/components/organisms/file_picker/file_picker.dart @@ -627,7 +627,7 @@ extension _Methods on ZdsFilePickerState { final List list = []; - if (mounted) { + if (context.mounted) { for (final GiphyGif gif in result) { final itemsLength = controller.items.where((ZdsFileWrapper element) => !element.isLink).toList().length + controller.remoteItems.length; @@ -646,7 +646,7 @@ extension _Methods on ZdsFilePickerState { if (list.isNotEmpty) widget.onPicked?.call(list); } on Exception catch (e) { - if (mounted) widget.onError?.call(context, config, e); + if (context.mounted) widget.onError?.call(context, config, e); } finally { _busy = false; } @@ -654,13 +654,13 @@ extension _Methods on ZdsFilePickerState { Future _handleCameraAction(BuildContext context) async { try { - if (!mounted) return; + if (!context.mounted) return; final photo = await ZdsCamera.takePhoto( context, showPreview: config.showCapturePreview, useSystemCamera: config.useSystemCamera, ); - if (photo != null && mounted) { + if (photo != null && context.mounted) { final file = await onPicked( context, ZdsFileWrapper(ZdsFilePickerOptions.CAMERA, photo), @@ -670,7 +670,7 @@ extension _Methods on ZdsFilePickerState { if (file != null) widget.onPicked?.call([file]); } } on Exception catch (e) { - if (mounted) widget.onError?.call(context, config, e); + if (context.mounted) widget.onError?.call(context, config, e); } finally { _busy = false; } @@ -678,7 +678,7 @@ extension _Methods on ZdsFilePickerState { Future _handleVideoAction(BuildContext context) async { try { - if (!mounted) return; + if (!context.mounted) return; final maxVideoTimeInSeconds = config.maxVideoTimeInSeconds; final video = await ZdsCamera.recordVideo( context, @@ -686,7 +686,7 @@ extension _Methods on ZdsFilePickerState { maxVideoDuration: maxVideoTimeInSeconds != null ? Duration(seconds: maxVideoTimeInSeconds) : null, ); - if (video != null && mounted) { + if (video != null && context.mounted) { final file = await onPicked( context, ZdsFileWrapper(ZdsFilePickerOptions.VIDEO, video), @@ -696,7 +696,7 @@ extension _Methods on ZdsFilePickerState { if (file != null) widget.onPicked?.call([file]); } } on Exception catch (e) { - if (mounted) widget.onError?.call(context, config, e); + if (context.mounted) widget.onError?.call(context, config, e); } finally { _busy = false; } @@ -758,7 +758,7 @@ extension _Methods on ZdsFilePickerState { allowMultiple: allowMultiple, ); - if (result != null && mounted) { + if (result != null && context.mounted) { final List processedFiles = []; for (final PlatformFile file in result.files) { final itemsLength = controller.items.where((ZdsFileWrapper element) => !element.isLink).toList().length + @@ -789,7 +789,7 @@ extension _Methods on ZdsFilePickerState { } } } on Exception catch (e) { - if (mounted) widget.onError?.call(context, config, e); + if (context.mounted) widget.onError?.call(context, config, e); } finally { _busy = false; } @@ -832,7 +832,7 @@ extension _Methods on ZdsFilePickerState { } if (exception != null) { - if (mounted) widget.onError?.call(context, config, exception); + if (context.mounted) widget.onError?.call(context, config, exception); } else { if (input.content != null) { controller.addFiles([input]); @@ -842,7 +842,7 @@ extension _Methods on ZdsFilePickerState { return null; } on Exception catch (e) { - if (mounted) widget.onError?.call(context, config, e); + if (context.mounted) widget.onError?.call(context, config, e); return null; } finally { _busy = false; diff --git a/lib/src/components/organisms/quill_editor/color_button.dart b/lib/src/components/organisms/quill_editor/color_button.dart index 79a46dc..4b04ee7 100644 --- a/lib/src/components/organisms/quill_editor/color_button.dart +++ b/lib/src/components/organisms/quill_editor/color_button.dart @@ -45,7 +45,9 @@ class ZdsQuillToolbarColorButton extends StatefulWidget { } } -// ignore: public_member_api_docs +/// Options for the color button. +/// See [QuillToolbarColorButtonOptions]. +/// See [QuillToolbarBaseButtonOptions]. class ZdsQuillToolbarColorButtonState extends State { late bool _isToggledColor; late bool _isToggledBackground; diff --git a/lib/src/utils/tools/nested_flow.dart b/lib/src/utils/tools/nested_flow.dart index 961f2cf..830ba0e 100644 --- a/lib/src/utils/tools/nested_flow.dart +++ b/lib/src/utils/tools/nested_flow.dart @@ -33,7 +33,7 @@ class ZdsNestedFlow extends StatefulWidget { ); /// Root page for the navigator. - @Deprecated('message') + @Deprecated('Use child or builder property instead') final Page? rootPage; /// Should page be closed when just root page remains on the stack, useful when added as root widget in TabBar. diff --git a/pubspec.yaml b/pubspec.yaml index 3355d35..a64df08 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: zds_flutter description: Zebra Design System components for Flutter. A selection of UI components from Zebra Technologies. -version: 2.0.0 +version: 1.3.1 homepage: https://github.com/zebradevs/zds_flutter repository: https://github.com/zebradevs/zds_flutter issue_tracker: https://github.com/zebradevs/zds_flutter/issues