65 lines
2.1 KiB
Dart
65 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:pweb/controllers/payout_verification.dart';
|
|
import 'package:pweb/pages/2fa/error_message.dart';
|
|
import 'package:pweb/pages/2fa/input.dart';
|
|
import 'package:pweb/pages/2fa/prompt.dart';
|
|
import 'package:pweb/pages/2fa/resend.dart';
|
|
|
|
import 'package:pweb/generated/i18n/app_localizations.dart';
|
|
|
|
|
|
class PayoutVerificationPage extends StatelessWidget {
|
|
const PayoutVerificationPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<PayoutVerificationController>(
|
|
builder: (context, controller, child) {
|
|
if (controller.verificationSuccess) {
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
Navigator.of(context).pop(true);
|
|
});
|
|
}
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(AppLocalizations.of(context)!.twoFactorTitle),
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
TwoFactorPromptText(email: controller.target),
|
|
const SizedBox(height: 32),
|
|
TwoFactorCodeInput(
|
|
onCompleted: controller.submitCode,
|
|
),
|
|
const SizedBox(height: 24),
|
|
if (controller.isSubmitting)
|
|
const Center(child: CircularProgressIndicator())
|
|
else
|
|
ResendCodeButton(
|
|
onPressed: controller.resendCode,
|
|
isCooldownActive: controller.isCooldownActive,
|
|
isResending: controller.isResending,
|
|
cooldownRemainingSeconds: controller.cooldownRemainingSeconds,
|
|
),
|
|
if (controller.hasError) ...[
|
|
const SizedBox(height: 12),
|
|
ErrorMessage(
|
|
error: AppLocalizations.of(context)!.twoFactorError,
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|