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: (_) {}, ), ), ); }