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

fix(UX-1241): Fixed inkwell on ZetaStepper #190

Merged
merged 5 commits into from
Oct 18, 2024
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
47 changes: 4 additions & 43 deletions example/lib/pages/components/stepper_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,9 @@ class StepperExample extends StatefulWidget {
}

class _StepperExampleState extends State<StepperExample> {
int _sharpHorizontalStep = 0;
int _horistonalStep = 0;
int _verticalStep = 0;

ZetaStepType _getForStepIndex({
required int currentStep,
required int stepIndex,
}) {
if (currentStep == stepIndex) return ZetaStepType.enabled;
if (currentStep > stepIndex) return ZetaStepType.complete;

return ZetaStepType.disabled;
}

@override
Widget build(BuildContext context) {
return ExampleScaffold(
Expand All @@ -35,32 +25,17 @@ class _StepperExampleState extends State<StepperExample> {
SizedBox(
height: 150,
child: ZetaStepper(
currentStep: _sharpHorizontalStep,
onStepTapped: (index) => setState(() => _sharpHorizontalStep = index),
currentStep: _horistonalStep,
onStepTapped: (index) => setState(() => _horistonalStep = index),
steps: [
ZetaStep(
type: _getForStepIndex(
currentStep: _sharpHorizontalStep,
stepIndex: 0,
),
title: Text("Title"),
content: Text("Content"),
),
ZetaStep(
type: _getForStepIndex(
currentStep: _sharpHorizontalStep,
stepIndex: 1,
),
title: Text("Title 2"),
content: Text("Content 2"),
),
ZetaStep(
type: _getForStepIndex(
currentStep: _sharpHorizontalStep,
stepIndex: 2,
),
title: Text("Title 3"),
content: Text("Content 3"),
),
],
),
Expand All @@ -73,31 +48,17 @@ class _StepperExampleState extends State<StepperExample> {
onStepTapped: (index) => setState(() => _verticalStep = index),
steps: [
ZetaStep(
type: _getForStepIndex(
currentStep: _verticalStep,
stepIndex: 0,
),
title: Text("Title"),
subtitle: Text("Step Number"),
content: Text("Content"),
),
ZetaStep(
type: _getForStepIndex(
currentStep: _verticalStep,
stepIndex: 1,
),
title: Text("Title 2"),
subtitle: Text("Step Number"),
content: Text("Content 2"),
disabled: true,
),
ZetaStep(
type: _getForStepIndex(
currentStep: _verticalStep,
stepIndex: 2,
),
title: Text("Title 3"),
subtitle: Text("Step Number"),
content: Text("Content 3"),
),
],
),
Expand Down
15 changes: 0 additions & 15 deletions example/widgetbook/pages/components/stepper_widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import '../../utils/scaffold.dart';
Widget stepperUseCase(BuildContext context) {
int currentStep = 0;

ZetaStepType getForStepIndex(int stepIndex) {
if (currentStep == stepIndex) return ZetaStepType.enabled;
if (currentStep > stepIndex) return ZetaStepType.complete;

return ZetaStepType.disabled;
}

final type = context.knobs.list(
label: "Type",
options: [
Expand All @@ -24,8 +17,6 @@ Widget stepperUseCase(BuildContext context) {
labelBuilder: (type) => type.name,
);

final enabledContent = context.knobs.boolean(label: 'Enabled Content', initialValue: true);

return WidgetbookScaffold(
builder: (context, _) => StatefulBuilder(
builder: (context, setState) {
Expand All @@ -40,19 +31,13 @@ Widget stepperUseCase(BuildContext context) {
type: type,
steps: [
ZetaStep(
type: getForStepIndex(0),
title: Text("Title"),
content: enabledContent ? Text("Content") : null,
),
ZetaStep(
type: getForStepIndex(1),
title: Text("Title 2"),
content: enabledContent ? Text("Content 2") : null,
),
ZetaStep(
type: getForStepIndex(2),
title: Text("Title 3"),
content: enabledContent ? Text("Content 3") : null,
),
],
),
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 @@ -45,7 +45,7 @@ export 'segmented_control/segmented_control.dart';
export 'select_input/select_input.dart';
export 'slider/slider.dart';
export 'snack_bar/snack_bar.dart';
export 'stepper/stepper.dart';
export 'stepper/stepper.dart' hide HorizontalStep, StepDivider, StepIcon, VerticalStep;
export 'stepper_input/stepper_input.dart' hide ZetaStepperInputState;
export 'switch/zeta_switch.dart';
export 'tabs/tab.dart';
Expand Down
Loading