Skip to content

Commit a4f0ef4

Browse files
Fix double alignment arg
1 parent 5f2726b commit a4f0ef4

File tree

3 files changed

+24
-42
lines changed

3 files changed

+24
-42
lines changed

example/lib/storybook/stories/help_widget_story.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ WidgetbookComponent get helpWidgetStory => WidgetbookComponent(
4545
width: testWidth,
4646
child: OverlayWidget(
4747
alignment: _alignment,
48-
overlayWidget: HorizontalHelpWidget(
49-
alignment: _alignment,
50-
),
48+
overlayWidget: HorizontalHelpWidget(),
5149
child: ListView(
5250
children: [
5351
for (var i = 0; i < _listLength; i++)

lib/src/widgets/help_collection/horizontal_help_widget.dart

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ class HorizontalHelpWidget extends StatelessWidget {
1414
/// A description for the button that will be shown on the main card.
1515
final String detailsButtonDescription;
1616

17-
/// where to align this widget inside its container
18-
/// (matters for collapsed view mostly)
19-
final Alignment alignment;
20-
2117
static const _defaultTitle = 'Stop Russian Aggression!';
2218
static const _defaultDetailsButtonDesc = 'See what you can do';
2319

@@ -26,19 +22,21 @@ class HorizontalHelpWidget extends StatelessWidget {
2622
Key? key,
2723
this.title = _defaultTitle,
2824
this.detailsButtonDescription = _defaultDetailsButtonDesc,
29-
this.alignment = Alignment.topLeft,
3025
}) : super(key: key);
3126

3227
@override
3328
Widget build(BuildContext context) {
3429
return HelpWidget(
35-
alignment: alignment,
3630
controller: _controller,
37-
optionsView: CardRounded(
38-
padding: const EdgeInsets.only(right: 3, left: 3, bottom: 12, top: 6),
39-
child: LinksCardWidget(
40-
options: defaultOptionsList,
41-
onClose: _controller.goBack,
31+
optionsView: Container(
32+
constraints: const BoxConstraints.tightFor(width: 340),
33+
child: CardRounded(
34+
padding: const EdgeInsets.only(right: 3, left: 3, bottom: 12, top: 6),
35+
// width: 366,
36+
child: LinksCardWidget(
37+
options: defaultOptionsList,
38+
onClose: _controller.goBack,
39+
),
4240
),
4341
),
4442
mainView: CardRounded(
@@ -83,7 +81,6 @@ class HorizontalHelpWidget extends StatelessWidget {
8381
onTap: _controller.goForward,
8482
child: const FlagCard(),
8583
),
86-
constraints: const BoxConstraints.tightFor(width: 366),
8784
);
8885
}
8986
}

lib/src/widgets/help_widget/help_widget.dart

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ class HelpWidget extends StatelessWidget {
2424

2525
final TraverseController<HelpWidgetView> _controller;
2626

27-
/// It's a parameter that defines the allowed size of the widget.
28-
final BoxConstraints? constraints;
29-
30-
/// where to align this widget inside its container
31-
/// (matters for collapsed view mostly)
32-
final Alignment alignment;
33-
3427
///Constructor
3528
const HelpWidget({
3629
Key? key,
@@ -39,8 +32,6 @@ class HelpWidget extends StatelessWidget {
3932
required this.mainView,
4033
required TraverseController<HelpWidgetView> controller,
4134
this.axis = Axis.vertical,
42-
this.alignment = Alignment.topLeft,
43-
this.constraints,
4435
}) : _controller = controller,
4536
super(key: key);
4637

@@ -52,24 +43,20 @@ class HelpWidget extends StatelessWidget {
5243
HelpWidgetView.options: optionsView,
5344
};
5445

55-
return Container(
56-
alignment: alignment,
57-
constraints: constraints,
58-
child: AnimatedBuilder(
59-
animation: _controller,
60-
builder: (context, _) {
61-
final view = _controller.currentItem;
62-
63-
return AnimatedViewTransition(
64-
axis: axis,
65-
transitionForward: _controller.didTraverseForward,
66-
child: SizedBox(
67-
key: ValueKey(view),
68-
child: viewMap[view],
69-
),
70-
);
71-
},
72-
),
46+
return AnimatedBuilder(
47+
animation: _controller,
48+
builder: (context, _) {
49+
final view = _controller.currentItem;
50+
51+
return AnimatedViewTransition(
52+
axis: axis,
53+
transitionForward: _controller.didTraverseForward,
54+
child: SizedBox(
55+
key: ValueKey(view),
56+
child: viewMap[view],
57+
),
58+
);
59+
},
7360
);
7461
}
7562
}

0 commit comments

Comments
 (0)