Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update lints #233

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @benken @mikecoomber @thelukewalton
* @ZebraDevs/front-end-devs
4 changes: 0 additions & 4 deletions lib/src/components/badges/label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import 'package:flutter/material.dart';

import '../../../zeta_flutter.dart';

///Zeta Badge.
@Deprecated('Use ZetaLabel instead. ' 'This widget has been renamed as of 0.11.0')
typedef ZetaBadge = ZetaLabel;

/// Text badges notify users of line items that need attention.
/// {@category Components}
///
Expand Down
10 changes: 1 addition & 9 deletions lib/src/components/badges/priority_pill.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: deprecated_member_use_from_same_package

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -71,7 +69,6 @@ class ZetaPriorityPill extends ZetaStatelessWidget {
super.rounded,
super.key,
this.index,
@Deprecated('Use label instead. ' 'This variable has been renamed as of 0.11.0') this.priority,
this.label,
this.isBadge = false,
this.type = ZetaPriorityPillType.urgent,
Expand All @@ -89,10 +86,6 @@ class ZetaPriorityPill extends ZetaStatelessWidget {
/// * Low = 3
final String? index;

/// Text in main part of component.
@Deprecated('Use label instead. ' 'This variable has been renamed as of 0.11.0')
final String? priority;

/// Text in main part of component.
final String? label;

Expand Down Expand Up @@ -127,7 +120,7 @@ class ZetaPriorityPill extends ZetaStatelessWidget {
final Color lozengeColor = customColor?.shade10 ?? type.lozengeColor(context);

final size = this.size == ZetaPriorityPillSize.small ? Zeta.of(context).spacing.xl : Zeta.of(context).spacing.xl_3;
final label = (this.label ?? priority) ?? type.name.capitalize();
final label = this.label ?? type.name.capitalize();
final rounded = context.rounded;

return Semantics(
Expand Down Expand Up @@ -197,7 +190,6 @@ class ZetaPriorityPill extends ZetaStatelessWidget {
..add(EnumProperty<ZetaPriorityPillSize>('size', size))
..add(StringProperty('label', label))
..add(ColorProperty('customColor', customColor))
..add(StringProperty('priority', priority))
..add(StringProperty('semanticLabel', semanticLabel));
}
}
35 changes: 14 additions & 21 deletions lib/src/components/banner/banner.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../zeta_flutter.dart';
Expand Down Expand Up @@ -43,9 +42,6 @@ class ZetaBanner extends MaterialBanner {
/// Whether the title should be centered.
bool titleCenter = false,

/// Whether the title should be centered.
@Deprecated('Use titleCenter instead. ' 'This attribute has been renamed as of 0.18.0') bool? titleStart,

/// The trailing widget for the banner.
Widget? trailing,

Expand All @@ -58,25 +54,22 @@ class ZetaBanner extends MaterialBanner {
String? semanticLabel,
}) : super(
dividerColor: Colors.transparent,
onVisible: () {
if (PlatformIs.android) {
final backgroundColor = _backgroundColorFromType(context, type);

SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: backgroundColor,
systemNavigationBarIconBrightness: backgroundColor.isDark ? Brightness.light : Brightness.dark,
),
);
}
},
content: Builder(
builder: (context) {
final backgroundColor = _backgroundColorFromType(context, type);
final foregroundColor = Zeta.of(context).colors.mainInverse;
if (!kIsWeb && PlatformIs.android && context.mounted) {
// ignore: invalid_use_of_visible_for_testing_member
final statusBarColor = SystemChrome.latestStyle?.statusBarColor;
if (statusBarColor != backgroundColor) {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: backgroundColor,
systemNavigationBarIconBrightness: backgroundColor.isDark ? Brightness.light : Brightness.dark,
),
);
}
}

// ignore: no_leading_underscores_for_local_identifiers
final _titleCenter = titleStart ?? titleCenter;
return ZetaRoundedScope(
rounded: rounded ?? context.rounded,
child: Semantics(
Expand All @@ -87,7 +80,7 @@ class ZetaBanner extends MaterialBanner {
overflow: TextOverflow.ellipsis,
),
child: Stack(
alignment: _titleCenter ? Alignment.center : Alignment.centerLeft,
alignment: titleCenter ? Alignment.center : Alignment.centerLeft,
children: [
if (leadingIcon != null)
Positioned(
Expand All @@ -103,7 +96,7 @@ class ZetaBanner extends MaterialBanner {
),
Padding(
padding:
!_titleCenter && leadingIcon != null ? const EdgeInsets.only(left: 40) : EdgeInsets.zero,
!titleCenter && leadingIcon != null ? const EdgeInsets.only(left: 40) : EdgeInsets.zero,
child: Text(
title,
style: ZetaTextStyles.labelLarge.copyWith(
Expand Down
21 changes: 10 additions & 11 deletions lib/src/components/breadcrumb/breadcrumb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ZetaBreadcrumb extends ZetaStatefulWidget {
/// Breadcrumb children
final List<ZetaBreadcrumbItem> children;

/// Semantic label passed to [_TruncatedItem].
/// Semantic label passed to [TruncatedItem].
/// {@macro zeta-widget-semantic-label}
final String? moreSemanticLabel;

Expand Down Expand Up @@ -121,7 +121,7 @@ class _ZetaBreadcrumbsState extends State<ZetaBreadcrumb> {
truncatedChildren.add(createBreadCrumb(element, index + 1));
}
returnList
.add(_TruncatedItem(semanticLabel: widget.moreSemanticLabel ?? 'View More', children: truncatedChildren));
.add(TruncatedItem(semanticLabel: widget.moreSemanticLabel ?? 'View More', children: truncatedChildren));

for (final (index, element) in children.sublist(children.length - (widget.maxItemsShown - 1)).indexed) {
returnList.add(createBreadCrumb(element, index + children.length - (widget.maxItemsShown) + 1));
Expand Down Expand Up @@ -246,13 +246,12 @@ class ZetaBreadcrumbItem extends ZetaStatelessWidget {
}
}

/// Class for [_TruncatedItem]
@Deprecated('This functionality is not needed anymore. Use [ZetaBreadcrumb] instead. ' 'Deprecated since 0.14.1')
typedef TruncatedItem = _TruncatedItem;

class _TruncatedItem extends StatefulWidget {
///Constructor for [_TruncatedItem]
const _TruncatedItem({
/// Class for truncated [ZetaBreadcrumbItem].
@visibleForTesting
class TruncatedItem extends StatefulWidget {
///Constructor for [TruncatedItem]
const TruncatedItem({
super.key,
required this.children,
required this.semanticLabel,
});
Expand All @@ -266,15 +265,15 @@ class _TruncatedItem extends StatefulWidget {
final String semanticLabel;

@override
State<_TruncatedItem> createState() => _TruncatedItemState();
State<TruncatedItem> createState() => _TruncatedItemState();
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(StringProperty('semanticLabel', semanticLabel));
}
}

class _TruncatedItemState extends State<_TruncatedItem> {
class _TruncatedItemState extends State<TruncatedItem> {
bool _expanded = false;

@override
Expand Down
40 changes: 0 additions & 40 deletions lib/src/components/chat_item/chat_item.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
Expand Down Expand Up @@ -31,10 +30,6 @@ class ZetaChatItem extends ZetaStatelessWidget {
this.slidableActions = const [],
this.explicitChildNodes = true,
this.paleButtonColors,
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1') this.onMenuMoreTap,
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1') this.onCallTap,
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1') this.onDeleteTap,
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1') this.onPttTap,
});

/// Whether to apply different background color.
Expand Down Expand Up @@ -87,22 +82,6 @@ class ZetaChatItem extends ZetaStatelessWidget {
/// Pale buttons was the default behavior before 0.15.2, but now buttons have darker colors by default.
final bool? paleButtonColors;

/// Callback for slidable action - menu more.
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1')
final VoidCallback? onMenuMoreTap;

/// Callback for slidable action - call.
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1')
final VoidCallback? onCallTap;

/// Callback for slidable action - delete.
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1')
final VoidCallback? onDeleteTap;

/// Callback for slidable action - ptt.
@Deprecated('Use slidableActions instead.' ' This variable has been replaced as of 0.12.1')
final VoidCallback? onPttTap;

/// List of slidable actions.
///
/// The actions are displayed in the order they are provided; from left to right.
Expand Down Expand Up @@ -138,21 +117,6 @@ class ZetaChatItem extends ZetaStatelessWidget {

final actions = [...slidableActions];

// coverage:ignore-start
if (onMenuMoreTap != null) {
actions.add(ZetaSlidableAction.menuMore(onPressed: onMenuMoreTap));
}
if (onCallTap != null) {
actions.add(ZetaSlidableAction.call(onPressed: onCallTap));
}
if (onPttTap != null) {
actions.add(ZetaSlidableAction.ptt(onPressed: onPttTap));
}
if (onDeleteTap != null) {
actions.add(ZetaSlidableAction.delete(onPressed: onDeleteTap));
}
// coverage:ignore-end

return ZetaRoundedScope(
rounded: context.rounded,
child: Semantics(
Expand Down Expand Up @@ -344,10 +308,6 @@ class ZetaChatItem extends ZetaStatelessWidget {
..add(IntProperty('count', count))
..add(ObjectFlagProperty<VoidCallback?>.has('onTap', onTap))
..add(DiagnosticsProperty<bool?>('starred', starred))
..add(ObjectFlagProperty<VoidCallback?>.has('onMenuMoreTap', onMenuMoreTap))
..add(ObjectFlagProperty<VoidCallback?>.has('onCallTap', onCallTap))
..add(ObjectFlagProperty<VoidCallback?>.has('onDeleteTap', onDeleteTap))
..add(ObjectFlagProperty<VoidCallback?>.has('onPttTap', onPttTap))
..add(DiagnosticsProperty<bool>('explicitChildNodes', explicitChildNodes))
..add(DiagnosticsProperty<bool>('paleButtonColors', paleButtonColors));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export 'badges/tag.dart';
export 'banner/banner.dart';
export 'bottom sheets/bottom_sheet.dart';
export 'bottom sheets/menu_items.dart';
export 'breadcrumb/breadcrumb.dart';
export 'breadcrumb/breadcrumb.dart' hide TruncatedItem;
export 'button_group/button_group.dart';
export 'buttons/button.dart';
export 'buttons/button_style.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/src/components/dropdown/dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class ZetaDropdown<T> extends ZetaStatefulWidget {
super.rounded,
required this.items,
this.onChange,
@Deprecated('Set onChange to null. ' 'Disabled is deprecated as of 0.11.0') bool disabled = false,
this.value,
this.type = ZetaDropdownMenuType.standard,
this.size = ZetaDropdownSize.standard,
Expand Down
3 changes: 1 addition & 2 deletions lib/src/components/fabs/fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ class ZetaFAB extends StatefulWidget {
this.shape = ZetaWidgetBorder.full,
this.icon = ZetaIcons.add,
bool? expanded,
@Deprecated('Please use expanded instead. ' 'Deprecated in 0.15.0') bool? initiallyExpanded,
this.focusNode,
super.key,
}) : expanded = expanded ?? initiallyExpanded ?? label != null;
}) : expanded = expanded ?? label != null;

/// Defines the color of the button.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/global_header/global_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../../../zeta_flutter.dart';
/// This component should not be used as an appbar in a scaffold.
/// It can be used in custom scroll views and columns.
///
/// ```
/// ```dart
/// SingleChildScrollView(
/// child: Column(children: [
/// ZetaGlobalHeader(
Expand Down
6 changes: 3 additions & 3 deletions lib/src/components/navigation_rail/navigation_rail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ class ZetaNavigationRail extends ZetaStatelessWidget {

/// The margin around the [ZetaNavigationRail].
/// If undefined, defaults to:
/// ```
/// ```dart
/// EdgeInsets.all(Zeta.of(context).spacing.xl)
/// ```
final EdgeInsets? margin;

/// The spacing between items in [ZetaNavigationRail].
/// If undefined, defaults to:
/// ```
/// ```dart
/// EdgeInsets.only(bottom: Zeta.of(context).spacing.minimum)
/// ```
final EdgeInsets? itemSpacing;

/// The padding within an item in [ZetaNavigationRail].
/// Default is:
/// ```
/// ```dart
/// EdgeInsets.symmetric(
/// horizontal: Zeta.of(context).spacing.small,
/// vertical: Zeta.of(context).spacing.medium,
Expand Down
1 change: 0 additions & 1 deletion lib/src/components/pagination/pagination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class ZetaPagination extends ZetaStatefulWidget {
this.type = ZetaPaginationType.standard,
this.onChange,
this.currentPage = 1,
@Deprecated('Set onChange to null. ' 'Disabled is deprecated as of 0.11.0') bool disabled = false,
this.semanticFirst,
this.semanticPrevious,
this.semanticNext,
Expand Down
1 change: 0 additions & 1 deletion lib/src/components/password/password_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ZetaPasswordInput extends ZetaTextFormField {
this.size = ZetaWidgetSize.medium,
super.validator,
this.onSubmit,
@Deprecated('Use disabled instead. ' 'This property has been renamed as of 0.11.2') bool enabled = true,
super.controller,
this.hintText,
this.errorText,
Expand Down
10 changes: 0 additions & 10 deletions lib/src/components/phone_input/phone_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,14 @@ class ZetaPhoneInput extends ZetaFormField<PhoneNumber> {
super.onSaved,
super.initialValue,
super.validator,
@Deprecated('Use onChange instead. ' 'Deprecated as of 0.15.0') ValueChanged<PhoneNumber?>? onChanged,
super.onChange,
super.requirementLevel = ZetaFormFieldRequirement.none,
this.label,
@Deprecated('Use hintText instead. ' 'Deprecated as of 0.15.0') String? hint,
this.hintText,
@Deprecated('Use disabled instead. ' 'Deprecated as of 0.15.0') bool enabled = true,
super.disabled = false,
@Deprecated('Use errorText instead. ' 'Deprecated as of 0.15.0') bool hasError = false,
this.errorText,
@Deprecated('Use initialValue instead. ' 'Deprecated as of 0.15.0') String? initialCountry,
this.countries,
this.size = ZetaWidgetSize.medium,
@Deprecated('Set this as part of the initial value instead. ' 'Deprecated as of 0.15.0') String? countryDialCode,
@Deprecated('Set this as part of the initial value instead. ' 'enabled is deprecated as of 0.15.0')
String? phoneNumber,
@Deprecated('Country search hint is deprecated as of 0.15.0') String? countrySearchHint,
@Deprecated('Deprecated as of 0.15.0') bool? useRootNavigator,
this.selectCountrySemanticLabel,
super.autovalidateMode,
}) : super(
Expand Down
8 changes: 0 additions & 8 deletions lib/src/components/progress/progress_circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ class ZetaProgressCircle extends ZetaProgress {
}
}

/// Class definition for [_ZetaProgressCircleState]
@Deprecated('Deprecated in 0.14.1')
typedef ZetaProgressCircleState = _ZetaProgressCircleState;

/// Class definition for [_ZetaProgressCircleState]
class _ZetaProgressCircleState extends ZetaProgressState<ZetaProgressCircle> {
final _controller = WidgetStatesController();
Expand Down Expand Up @@ -198,10 +194,6 @@ class _ZetaProgressCircleState extends ZetaProgressState<ZetaProgressCircle> {
}
}

/// Class definition for [CirclePainter]
@Deprecated('Deprecated in 0.14.1')
typedef CirclePainter = _CirclePainter;

/// Class definition for [_CirclePainter]
class _CirclePainter extends CustomPainter {
///Constructor for [_CirclePainter]
Expand Down
Loading
Loading