Frontend first draft

This commit is contained in:
Arseni
2025-11-13 15:06:15 +03:00
parent e47f343afb
commit ddb54ddfdc
504 changed files with 25498 additions and 1 deletions

View File

@@ -0,0 +1,61 @@
import 'package:flutter/material.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';
import 'package:provider/provider.dart';
import 'package:pweb/providers/two_factor.dart';
class TwoFactorCodePage extends StatelessWidget {
final VoidCallback onVerificationSuccess;
const TwoFactorCodePage({
super.key,
required this.onVerificationSuccess,
});
@override
Widget build(BuildContext context) {
return Consumer<TwoFactorProvider>(
builder: (context, provider, child) {
if (provider.verificationSuccess) {
WidgetsBinding.instance.addPostFrameCallback((_) {
onVerificationSuccess();
});
}
return Scaffold(
appBar: AppBar(title: const Text('')),
body: Padding(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const TwoFactorPromptText(),
const SizedBox(height: 32),
TwoFactorCodeInput(
onCompleted: (code) => provider.submitCode(code),
),
const SizedBox(height: 24),
if (provider.isSubmitting)
const Center(child: CircularProgressIndicator())
else
const ResendCodeButton(),
if (provider.hasError) ...[
const SizedBox(height: 12),
ErrorMessage(error: AppLocalizations.of(context)!.twoFactorError),
],
],
),
),
);
},
);
}
}