-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2368f65
commit 18f7343
Showing
15 changed files
with
426 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: mix_workspace | ||
|
||
sdkPath: .fvm/flutter_sdk | ||
# sdkPath: .fvm/flutter_sdk | ||
packages: | ||
- packages/** | ||
- examples/** | ||
|
7 changes: 7 additions & 0 deletions
7
packages/mix/lib/src/attributes/modifiers/modifiers_data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import '../../core/modifier.dart'; | ||
|
||
class ModifiersData { | ||
// ignore: avoid-dynamic | ||
final List<WidgetModifierSpec<dynamic>> value; | ||
const ModifiersData(this.value); | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/mix/lib/src/attributes/modifiers/modifiers_data_dto.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import '../../core/core.dart'; | ||
import 'modifiers_data.dart'; | ||
|
||
class ModifiersDataDto extends Dto<ModifiersData> { | ||
final List<WidgetModifierAttribute> value; | ||
|
||
const ModifiersDataDto(this.value); | ||
|
||
@override | ||
ModifiersDataDto merge(ModifiersDataDto? other) { | ||
if (other == null) return this; | ||
final thisMap = AttributeMap(value); | ||
final otherMap = AttributeMap(other.value); | ||
final mergedMap = thisMap.merge(otherMap).values; | ||
|
||
return ModifiersDataDto(mergedMap); | ||
} | ||
|
||
@override | ||
ModifiersData resolve(MixData mix) { | ||
return ModifiersData(value.map((e) => e.resolve(mix)).toList()); | ||
} | ||
|
||
@override | ||
ModifiersData get defaultValue => const ModifiersData([]); | ||
|
||
@override | ||
List<Object?> get props => [value]; | ||
} |
38 changes: 38 additions & 0 deletions
38
packages/mix/lib/src/attributes/modifiers/modifiers_util.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import '../../core/core.dart'; | ||
import '../../modifiers/modifiers.dart'; | ||
import '../spacing/spacing_util.dart'; | ||
import 'modifiers_data_dto.dart'; | ||
|
||
final class ModifiersDataUtility<T extends Attribute> | ||
extends MixUtility<T, ModifiersDataDto> { | ||
late final add = WithModifierUtility((v) => builder(ModifiersDataDto([v]))); | ||
|
||
late final intrinsicWidth = IntrinsicWidthWidgetUtility(only); | ||
late final intrinsicHeight = IntrinsicHeightWidgetUtility(only); | ||
late final rotate = RotatedBoxWidgetUtility(only); | ||
late final opacity = OpacityUtility(only); | ||
late final clipPath = ClipPathUtility(only); | ||
late final clipRRect = ClipRRectUtility(only); | ||
late final clipOval = ClipOvalUtility(only); | ||
late final clipRect = ClipRectUtility(only); | ||
late final clipTriangle = ClipTriangleUtility(only); | ||
late final visibility = VisibilityUtility(only); | ||
late final show = visibility.on; | ||
late final hide = visibility.off; | ||
late final aspectRatio = AspectRatioUtility(only); | ||
late final flexible = FlexibleModifierUtility(only); | ||
late final expanded = flexible.expanded; | ||
late final transform = TransformUtility(only); | ||
|
||
late final scale = transform.scale; | ||
late final align = AlignWidgetUtility(only); | ||
late final fractionallySizedBox = FractionallySizedBoxModifierUtility(only); | ||
late final sizedBox = SizedBoxModifierUtility(only); | ||
late final padding = SpacingUtility(PaddingModifierUtility(only)); | ||
|
||
ModifiersDataUtility(super.builder); | ||
|
||
T only(WidgetModifierAttribute attribute) { | ||
return builder(ModifiersDataDto([attribute])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.