buildContent method

  1. @override
Widget buildContent({
  1. required BuildContext context,
  2. required PageChangeCallback<ResetFaultsPage> setPage,
  3. required int deviceId,
})
override

Implementation

@override
Widget buildContent({
  required BuildContext context,
  required PageChangeCallback<ResetFaultsPage> setPage,
  required int deviceId,
}) {
  return ResetFaultsContentBuilder(
    deviceId: deviceId,
    builder: (context, eventLog) {
      return DefaultTextStyle(
        style: context.textTheme.titleSmall!,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Flexible(
              child: SingleChildScrollView(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    if (eventLog.resetValidation.isCriticalFault) ...[
                      Text.rich(
                        TextSpan(
                          children: [
                            TextSpan(
                              text:
                                  '${context.sharedL10n.attemptingToReset} ',
                            ),
                            TextSpan(
                              text: context.sharedL10n.criticalFault,
                              style: TextStyle(
                                fontWeight: FontWeight.w700,
                                color: context.appColors.red,
                              ),
                            ),
                          ],
                        ),
                        style: context.textTheme.titleMedium?.copyWith(
                          fontWeight: FontWeight.w400,
                        ),
                      ),
                      const SizedBox(height: 22.0),
                      Text(
                        context.sharedL10n.precautionsResettingFaultRemotely,
                      ),
                    ] else ...[
                      Text.rich(
                        TextSpan(
                          children: [
                            TextSpan(
                              text:
                                  '${context.sharedL10n.attemptingToReset} ',
                            ),
                            TextSpan(
                              text: context.sharedL10n.fault,
                              style: const TextStyle(
                                fontWeight: FontWeight.w700,
                              ),
                            ),
                          ],
                        ),
                        style: context.textTheme.titleMedium?.copyWith(
                          fontWeight: FontWeight.w400,
                        ),
                      ),
                      const SizedBox(height: 22.0),
                      Text(
                        context.sharedL10n.faultPersistsMessage,
                      ),
                    ],
                    const SizedBox(height: 22.0),
                    Text(
                      context
                          .sharedL10n.generatorRequirementsClearFaultRemotely,
                      style: context.textTheme.bodySmall,
                    ),
                    const SizedBox(height: 22.0),
                    _ResetFaultRequirement(
                      passing: eventLog.resetValidation.isSupportedFaultType,
                      label: Text(context.sharedL10n.faulTypeCanBeReset),
                    ),
                    const SizedBox(height: 22.0),
                    _ResetFaultRequirement(
                      passing: eventLog.resetValidation.isAuto,
                      label: Text(context.sharedL10n.inAutoBeforeShutdown),
                    ),
                    const SizedBox(height: 22.0),
                    _ResetFaultRequirement(
                      passing: eventLog.resetValidation.isConnected,
                      label: Text(context.sharedL10n.connectedToInternet),
                    ),
                    const SizedBox(height: 22.0),
                    _ResetFaultRequirement(
                      passing: eventLog.resetValidation.isFirmwareUpdated,
                      label: Text(context.sharedL10n.firmwareRDCOrAbove),
                    ),
                  ],
                ),
              ),
            ),
            const SizedBox(height: 24.0),
            FractionallySizedBox(
              widthFactor: 1.0,
              child: ElevatedButton(
                onPressed:
                    eventLog.resetValidation.meetsResetFaultRequirements
                        ? () => PagedDialog.maybeOf<ResetFaultsPage>(context)
                            ?.setPage(const ConfirmResetFaultsPage())
                        : null,
                child: Text(context.sharedL10n.understand),
              ),
            ),
          ],
        ),
      );
    },
  );
}