Skip to content

Commit

Permalink
select
Browse files Browse the repository at this point in the history
  • Loading branch information
tilucasoli committed Dec 18, 2024
1 parent d753973 commit 1b956e8
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,13 @@ class DropdownMenuState extends State<DropdownMenu> {
),
);

return AnimatedBoxSpecWidget(
spec: FlexContainer.box,
duration: animatedStyle?.animated.duration ?? Duration.zero,
curve: animatedStyle?.animated.curve ?? Curves.easeInOut,
child: FlexContainer.flex(
direction: Axis.vertical,
children: List.generate(widget.items.length, (index) {
final item = widget.items[index];

return item;
}),
),
return FlexContainer(
direction: Axis.vertical,
children: List.generate(widget.items.length, (index) {
final item = widget.items[index];

return item;
}),
);
},
),
Expand Down
23 changes: 13 additions & 10 deletions packages/remix/lib/src/components/select/select_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ class SelectStyle extends SpecStyle<SelectSpecUtility> {
..color.white()
..border.color.black12()
..padding.all(4)
..wrap.intrinsicWidth()
..wrap.transform.scale(0.95)
..wrap.opacity(0)
..wrap.padding.top(0)
..box.wrap.intrinsicWidth()
..box.wrap.transform.scale(0.95)
..box.wrap.opacity(0)
..box.wrap.padding.top(0)
..flex.mainAxisSize.min()
..flex.crossAxisAlignment.start(),
$.menu.wrap.transform.scale(1.5),
$.menu.autoWidth.off(),
spec.on.selected(
$.menu.container.chain
..wrap.transform.scale(1)
..wrap.opacity(1)
..wrap.padding.top(4),
..box.wrap.transform.scale(1)
..box.wrap.opacity(1)
..box.wrap.padding.top(4),
),
];

Expand All @@ -75,8 +75,8 @@ class SelectStyle extends SpecStyle<SelectSpecUtility> {
...menuStyle,
...positionStyle,
]).animate(
duration: const Duration(milliseconds: 1500),
curve: Curves.easeInOut,
duration: const Duration(milliseconds: 100),
curve: Curves.decelerate,
);
}
}
Expand Down Expand Up @@ -107,6 +107,9 @@ class SelectDarkStyle extends SelectStyle {
itemStyle,
spec.on.hover($.item.container.color.white12()),
spec.on.disabled($.button.container.color.white10()),
]);
]).animate(
duration: const Duration(milliseconds: 100),
curve: Curves.decelerate,
);
}
}
40 changes: 17 additions & 23 deletions packages/remix/lib/src/components/select/select_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ class Select<T> extends StatefulWidget {
State<Select> createState() => SelectState<T>();
}

class SelectState<T> extends State<Select<T>>
with SingleTickerProviderStateMixin {
class SelectState<T> extends State<Select<T>> {
late final MixWidgetStateController _menuStateController;
late final MixWidgetStateController _buttonStateController;

Expand Down Expand Up @@ -123,29 +122,24 @@ class SelectState<T> extends State<Select<T>>
),
);

return AnimatedBoxSpecWidget(
spec: FlexContainer.box,
duration: animatedStyle?.animated.duration ?? Duration.zero,
curve: animatedStyle?.animated.curve ?? Curves.easeInOut,
child: FlexContainer.flex(
direction: Axis.vertical,
children: widget.items
.map(
(item) => Pressable(
onPress: () {
widget.onChanged(item.value);
closeMenu();
return FlexContainer(
direction: Axis.vertical,
children: widget.items
.map(
(item) => Pressable(
onPress: () {
widget.onChanged(item.value);
closeMenu();
},
child: SpecBuilder(
style: appliedStyle,
builder: (context) {
return item.child;
},
child: SpecBuilder(
style: appliedStyle,
builder: (context) {
return item.child;
},
),
),
)
.toList(),
),
),
)
.toList(),
);
},
),
Expand Down
1 change: 1 addition & 0 deletions packages/remix/lib/src/helpers/overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class OverlayWrapperState extends State<OverlayWrapper> {
void didUpdateWidget(OverlayWrapper oldWidget) {
super.didUpdateWidget(oldWidget);

if (widget.showOverlay == oldWidget.showOverlay) return;
if (widget.showOverlay) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_controller!.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class FortalezaSelectStyle extends SelectStyle {
soft(softVariant()),
ghost(ghostVariant()),
],
);
).animate(duration: const Duration(milliseconds: 100));
}
}

Expand Down

0 comments on commit 1b956e8

Please sign in to comment.