Files
sendico/frontend/pweb/lib/pages/2fa/input.dart
2026-02-17 10:20:39 +01:00

34 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:pin_code_fields/pin_code_fields.dart';
class TwoFactorCodeInput extends StatelessWidget {
final void Function(String) onCompleted;
const TwoFactorCodeInput({super.key, required this.onCompleted});
@override
Widget build(BuildContext context) => Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 300),
child: MaterialPinField(
length: 6,
autoFocus: true,
keyboardType: TextInputType.number,
theme: MaterialPinTheme(
entryAnimation: MaterialPinAnimation.fade,
shape: MaterialPinShape.outlined,
borderRadius: BorderRadius.circular(4),
cellSize: Size(40, 48),
borderColor: Theme.of(context).colorScheme.primaryContainer,
focusedBorderColor: Theme.of(context).colorScheme.primary,
cursorColor: Theme.of(context).colorScheme.primary,
),
onCompleted: onCompleted,
onChanged: (_) {},
),
),
);
}