Skip to content

Commit

Permalink
Refactor pillar and sentinel naming
Browse files Browse the repository at this point in the history
  • Loading branch information
KingGorrin committed Mar 18, 2024
1 parent 767df11 commit 7a0f9fa
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion lib/widgets/modular_widgets/modular_widgets.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export 'accelerator_widgets/accelerator_widgets.dart';
export 'dashboard_widgets/dashboard_widgets.dart';
export 'help_widgets/help_widgets.dart';
export 'pillars_widgets/pillar_widgets.dart';
export 'pillar_widgets/pillar_widgets.dart';
export 'plasma_widgets/plasma_widgets.dart';
export 'sentinel_widgets/sentinel_widgets.dart';
export 'settings_widgets/settings_widgets.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class _CreatePillarState extends State<CreatePillar> {
context,
MaterialPageRoute(
builder: (context) => StepperScreen(
stepper: const PillarsStepperContainer(),
stepper: const PillarStepperContainer(),
onStepperNotificationSeeMorePressed:
widget.onStepperNotificationSeeMorePressed,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import 'package:zenon_syrius_wallet_flutter/utils/zts_utils.dart';
import 'package:zenon_syrius_wallet_flutter/widgets/widgets.dart';
import 'package:znn_sdk_dart/znn_sdk_dart.dart';

class PillarsListWidget extends StatefulWidget {
class PillarListWidget extends StatefulWidget {
final String? title;

const PillarsListWidget({Key? key, this.title}) : super(key: key);
const PillarListWidget({Key? key, this.title}) : super(key: key);

@override
State<PillarsListWidget> createState() => _PillarsListWidgetState();
State<PillarListWidget> createState() => _PillarListWidgetState();
}

class _PillarsListWidgetState extends State<PillarsListWidget> {
class _PillarListWidgetState extends State<PillarListWidget> {
final ScrollController _scrollController = ScrollController();

final PagingController<int, PillarInfo> _pagingController = PagingController(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,27 @@ enum PillarType {
regularPillar,
}

enum PillarsStepperStep {
enum PillarStepperStep {
checkPlasma,
qsrManagement,
znnManagement,
deployPillar,
}

class PillarsStepperContainer extends StatefulWidget {
const PillarsStepperContainer({Key? key}) : super(key: key);
class PillarStepperContainer extends StatefulWidget {
const PillarStepperContainer({Key? key}) : super(key: key);

@override
State createState() {
return _MainPillarsState();
return _MainPillarState();
}
}

class _MainPillarsState extends State<PillarsStepperContainer> {
late PillarsStepperStep _currentStep;
PillarsStepperStep? _lastCompletedStep;
class _MainPillarState extends State<PillarStepperContainer> {
late PillarStepperStep _currentStep;
PillarStepperStep? _lastCompletedStep;

final int _numSteps = PillarsStepperStep.values.length;
final int _numSteps = PillarStepperStep.values.length;

PillarType? _selectedPillarType = PillarType.regularPillar;

Expand Down Expand Up @@ -406,7 +406,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
if (event != null) {
_withdrawButtonKey.currentState?.animateReverse();
_saveProgressAndNavigateToNextStep(
PillarsStepperStep.checkPlasma,
PillarStepperStep.checkPlasma,
);
_pillarsQsrInfoViewModel.getQsrManagementInfo(
_selectedPillarType,
Expand Down Expand Up @@ -459,7 +459,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
stepContent: _getPlasmaCheckFutureBuilder(),
stepSubtitle: 'Sufficient Plasma',
stepState: StepperUtils.getStepState(
PillarsStepperStep.checkPlasma.index,
PillarStepperStep.checkPlasma.index,
_lastCompletedStep?.index,
),
context: context,
Expand All @@ -469,7 +469,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
stepContent: _getQsrManagementStep(context, accountInfo),
stepSubtitle: '${kQsrCoin.symbol} deposited',
stepState: StepperUtils.getStepState(
PillarsStepperStep.qsrManagement.index,
PillarStepperStep.qsrManagement.index,
_lastCompletedStep?.index,
),
context: context,
Expand All @@ -480,7 +480,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
stepContent: _getZnnManagementStepBody(context, accountInfo),
stepSubtitle: '${kZnnCoin.symbol} locked',
stepState: StepperUtils.getStepState(
PillarsStepperStep.znnManagement.index,
PillarStepperStep.znnManagement.index,
_lastCompletedStep?.index,
),
context: context,
Expand All @@ -490,7 +490,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
stepContent: _getDeployPillarStepBody(context),
stepSubtitle: 'Pillar registered',
stepState: StepperUtils.getStepState(
PillarsStepperStep.deployPillar.index,
PillarStepperStep.deployPillar.index,
_lastCompletedStep?.index,
),
context: context,
Expand Down Expand Up @@ -631,7 +631,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
if (response != null) {
_registerButtonKey.currentState?.animateReverse();
_saveProgressAndNavigateToNextStep(
PillarsStepperStep.deployPillar,
PillarStepperStep.deployPillar,
);
setState(() {});
} else {
Expand Down Expand Up @@ -675,7 +675,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
],
),
kVerticalSpacing,
StepperUtils.getBalanceWidget(kZnnCoin, accountInfo!),
StepperUtils.getBalanceWidget(kZnnCoin, accountInfo),
kVerticalSpacing,
Row(
children: [
Expand Down Expand Up @@ -723,21 +723,21 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
}

void _onNextPressed() {
if (_lastCompletedStep == PillarsStepperStep.qsrManagement) {
_saveProgressAndNavigateToNextStep(PillarsStepperStep.znnManagement);
if (_lastCompletedStep == PillarStepperStep.qsrManagement) {
_saveProgressAndNavigateToNextStep(PillarStepperStep.znnManagement);
} else if (StepperUtils.getStepState(
PillarsStepperStep.qsrManagement.index,
PillarStepperStep.qsrManagement.index,
_lastCompletedStep?.index,
) ==
custom_material_stepper.StepState.complete) {
setState(() {
_currentStep = PillarsStepperStep.values[_currentStep.index + 1];
_currentStep = PillarStepperStep.values[_currentStep.index + 1];
});
}
}

void _onDeployPressed(PillarsDeployBloc model) {
if (_lastCompletedStep == PillarsStepperStep.znnManagement) {
if (_lastCompletedStep == PillarStepperStep.znnManagement) {
if (_pillarFormKeys
.every((element) => element.currentState!.validate())) {
_registerButtonKey.currentState?.animateForward();
Expand Down Expand Up @@ -910,17 +910,17 @@ class _MainPillarsState extends State<PillarsStepperContainer> {
});
}

void _saveProgressAndNavigateToNextStep(PillarsStepperStep completedStep) {
void _saveProgressAndNavigateToNextStep(PillarStepperStep completedStep) {
setState(() {
_lastCompletedStep = completedStep;
if (_lastCompletedStep!.index + 1 < _numSteps) {
_currentStep = PillarsStepperStep.values[completedStep.index + 1];
_currentStep = PillarStepperStep.values[completedStep.index + 1];
}
});
}

void _iniStepperControllers() {
_currentStep = PillarsStepperStep.values.first;
_currentStep = PillarStepperStep.values.first;
_selectedPillarType = PillarType.values.first;
}

Expand Down Expand Up @@ -955,7 +955,7 @@ class _MainPillarsState extends State<PillarsStepperContainer> {

void _onQsrNextPressed() {
setState(() {
_saveProgressAndNavigateToNextStep(PillarsStepperStep.qsrManagement);
_saveProgressAndNavigateToNextStep(PillarStepperStep.qsrManagement);
});
}

Expand Down Expand Up @@ -1014,14 +1014,14 @@ class _MainPillarsState extends State<PillarsStepperContainer> {

void _onPlasmaCheckNextPressed() {
if (_lastCompletedStep == null) {
_saveProgressAndNavigateToNextStep(PillarsStepperStep.checkPlasma);
_saveProgressAndNavigateToNextStep(PillarStepperStep.checkPlasma);
} else if (StepperUtils.getStepState(
PillarsStepperStep.checkPlasma.index,
PillarStepperStep.checkPlasma.index,
_lastCompletedStep?.index,
) ==
custom_material_stepper.StepState.complete) {
setState(() {
_currentStep = PillarsStepperStep.values[_currentStep.index + 1];
_currentStep = PillarStepperStep.values[_currentStep.index + 1];
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export 'create_pillar.dart';
export 'pillar_collect.dart';
export 'pillar_list_widget.dart';
export 'pillar_rewards.dart';
export 'pillar_stepper_container.dart';
export 'pillar_update_stepper.dart';
export 'pillars_list_widget.dart';
export 'pillars_stepper_container.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _CreateSentinelState extends State<CreateSentinel> {
context,
MaterialPageRoute(
builder: (context) => StepperScreen(
stepper: const SentinelsStepperContainer(),
stepper: const SentinelStepperContainer(),
onStepperNotificationSeeMorePressed:
widget.onStepperNotificationSeeMorePressed,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import 'package:zenon_syrius_wallet_flutter/utils/widget_utils.dart';
import 'package:zenon_syrius_wallet_flutter/widgets/widgets.dart';
import 'package:znn_sdk_dart/znn_sdk_dart.dart';

class SentinelsListWidget extends StatefulWidget {
const SentinelsListWidget({Key? key}) : super(key: key);
class SentinelListWidget extends StatefulWidget {
const SentinelListWidget({Key? key}) : super(key: key);

@override
State<SentinelsListWidget> createState() => _SentinelsListWidgetState();
State<SentinelListWidget> createState() => _SentinelListWidgetState();
}

class _SentinelsListWidgetState extends State<SentinelsListWidget> {
class _SentinelListWidgetState extends State<SentinelListWidget> {
late SentinelsListBloc _bloc;

final List<SentinelInfo> _sentinels = [];
Expand Down
Loading

0 comments on commit 7a0f9fa

Please sign in to comment.