Skip to content

Commit

Permalink
Merge branch 'main' into refactor/mediaquery-optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
leoafarias authored Nov 15, 2024
2 parents 90f6cfe + eac0d91 commit 0946a5e
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 55 deletions.
1 change: 1 addition & 0 deletions lints_with_dcm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dart_code_metrics:
avoid-unsafe-collection-methods: false
prefer-prefixed-global-constants: false
avoid-returning-widgets: false
avoid-unnecessary-overrides: false
arguments-ordering:
first:
- key
Expand Down
3 changes: 0 additions & 3 deletions packages/mix/lib/src/attributes/border/border_radius_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ sealed class BorderRadiusGeometryDto<T extends BorderRadiusGeometry>
properties.addUsingDefault('bottomStart', bottomStart);
properties.addUsingDefault('bottomEnd', bottomEnd);
}

@override
T resolve(MixData mix);
}

@MixableDto(generateUtility: false)
Expand Down
6 changes: 0 additions & 6 deletions packages/mix/lib/src/attributes/border/shape_border_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ sealed class ShapeBorderDto<T extends ShapeBorder> extends Dto<T> {

@override
ShapeBorderDto<T> merge(covariant ShapeBorderDto<T>? other);

@override
T resolve(MixData mix);
}

@immutable
Expand Down Expand Up @@ -86,9 +83,6 @@ abstract class OutlinedBorderDto<T extends OutlinedBorder>

@override
OutlinedBorderDto<T> merge(covariant OutlinedBorderDto<T>? other);

@override
T resolve(MixData mix);
}

@MixableDto()
Expand Down
4 changes: 1 addition & 3 deletions packages/mix/lib/src/core/attribute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import 'package:flutter/widgets.dart';
import '../internal/compare_mixin.dart';
import 'dto.dart';

abstract class Attribute with MergeableMixin, EqualityMixin {
abstract class Attribute with MergeableMixin<Attribute>, EqualityMixin {
const Attribute();

// Used as the key to determine how
// attributes get merged
Object get mergeKey => runtimeType;
@override
Attribute merge(covariant Attribute? other);
}

/// Provides the ability to merge this object with another of the same type.
Expand Down
5 changes: 1 addition & 4 deletions packages/mix/lib/src/core/dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ import 'factory/mix_data.dart';
import 'utility.dart';

@immutable
abstract class Dto<Value> with EqualityMixin, MergeableMixin {
abstract class Dto<Value> with EqualityMixin, MergeableMixin<Dto> {
const Dto();

Value get defaultValue;

Value resolve(MixData mix);
// /// Merges this object with [other], returning a new object of type [T].
@override
Dto merge(covariant Dto? other);
}

abstract class DtoUtility<Attr extends Attribute, D extends Dto<Value>, Value>
Expand Down
4 changes: 0 additions & 4 deletions packages/mix/lib/src/core/modifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';

import 'attribute.dart';
import 'factory/mix_data.dart';
import 'spec.dart';
import 'utility.dart';

Expand Down Expand Up @@ -34,9 +33,6 @@ abstract class WidgetModifierSpecAttribute<
Value extends WidgetModifierSpec<Value>> extends SpecAttribute<Value>
with Diagnosticable {
const WidgetModifierSpecAttribute();

@override
Value resolve(MixData mix);
}

abstract class WidgetModifierUtility<
Expand Down
3 changes: 0 additions & 3 deletions packages/mix/lib/src/core/styled_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ abstract class StyledWidget extends StatelessWidget {
builder: builder,
);
}

@override
Widget build(BuildContext context);
}

/// A styled widget that builds its child using a [MixData] object.
Expand Down
34 changes: 8 additions & 26 deletions packages/mix/lib/src/specs/icon/icon_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ class StyledIcon extends StyledWidget {
this.textDirection,
@Deprecated('Use orderOfModifiers parameter instead')
List<Type> modifierOrder = const <Type>[],
List<Type> orderOfModifiers = const <Type>[],
}) : assert(modifierOrder == const <Type>[] ||
orderOfModifiers == const <Type>[]),
super(
orderOfModifiers:
orderOfModifiers == const [] ? modifierOrder : orderOfModifiers,
);
super.orderOfModifiers = const <Type>[],
});

final IconData? icon;
final String? semanticLabel;
Expand Down Expand Up @@ -60,11 +55,8 @@ class IconSpecWidget extends StatelessWidget {
this.textDirection,
@Deprecated('Use orderOfModifiers parameter instead')
List<Type> modifierOrder = const <Type>[],
List<Type> orderOfModifiers = const <Type>[],
}) : assert(modifierOrder == const <Type>[] ||
orderOfModifiers == const <Type>[]),
orderOfModifiers =
orderOfModifiers == const [] ? modifierOrder : orderOfModifiers;
this.orderOfModifiers = const <Type>[],
});

final IconData? icon;
final IconSpec? spec;
Expand Down Expand Up @@ -104,14 +96,8 @@ class AnimatedStyledIcon extends StyledWidget {
this.textDirection,
@Deprecated('Use orderOfModifiers parameter instead')
List<Type> modifierOrder = const <Type>[],
List<Type> orderOfModifiers = const <Type>[],
}) : assert(modifierOrder == const <Type>[] ||
orderOfModifiers == const <Type>[]),
super(
orderOfModifiers: orderOfModifiers == const <Type>[]
? modifierOrder
: orderOfModifiers,
);
super.orderOfModifiers = const <Type>[],
});

final AnimatedIconData icon;
final String? semanticLabel;
Expand Down Expand Up @@ -147,12 +133,8 @@ class AnimatedIconSpecWidget extends ImplicitlyAnimatedWidget {
super.onEnd,
@Deprecated('Use orderOfModifiers parameter instead')
List<Type> modifierOrder = const <Type>[],
List<Type> orderOfModifiers = const <Type>[],
}) : assert(modifierOrder == const <Type>[] ||
orderOfModifiers == const <Type>[]),
orderOfModifiers = orderOfModifiers == const <Type>[]
? modifierOrder
: orderOfModifiers;
this.orderOfModifiers = const <Type>[],
});

final IconData? icon;
final IconSpec spec;
Expand Down
3 changes: 2 additions & 1 deletion packages/mix/lib/src/theme/mix/mix_theme.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import '../../internal/iterable_ext.dart';
Expand Down Expand Up @@ -152,7 +153,7 @@ class MixThemeData {
other.breakpoints == breakpoints &&
other.radii == radii &&
other.spaces == spaces &&
other.defaultOrderOfModifiers == defaultOrderOfModifiers;
listEquals(other.defaultOrderOfModifiers, defaultOrderOfModifiers);
}

@override
Expand Down
1 change: 1 addition & 0 deletions packages/mix/lib/src/theme/tokens/text_style_token.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//ignore_for_file: avoid-suspicious-super-overrides
import 'package:flutter/widgets.dart';

import '../../internal/mix_error.dart';
Expand Down
3 changes: 0 additions & 3 deletions packages/mix/lib/src/variants/context_variant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ abstract class ContextVariant extends IVariant {
return VariantAttribute(this, Style.create(params));
}

@override
bool when(BuildContext context);

@override
VariantPriority get priority => VariantPriority.normal;

Expand Down
2 changes: 0 additions & 2 deletions packages/mix/test/src/specs/flexbox/flexbox_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ void main() {
),
).animate(
onEnd: () {
print('onEnd');
countOnEnd++;
},
),
Expand Down Expand Up @@ -142,7 +141,6 @@ void main() {
),
).animate(
onEnd: () {
print('onEnd');
countOnEnd++;
},
),
Expand Down

0 comments on commit 0946a5e

Please sign in to comment.