As a developer I want to open source the widget_toolkit_pin package as part of this mono-repo a.k.a packages/widget_toolkit_pin
so that I can publish it in pub.dev
PinCodeKeyboard({
required PinCodeService pinCodeService,
required BiometricsLocalDataSource biometricsLocalDataSource,
required String Function(Object error) translateError,
PinLocalizedStrings? translatableStrings,
Function(Object error)? onError,
Key? key,
});
extension PinCodeThemeContextExtension on BuildContext {
/// Returns a reference to the [PinCodeTheme] theme extension of the current [Theme]
PinCodeTheme get pinCodeTheme {
final theme = Theme.of(this).extension<PinCodeTheme>();
if (theme == null) {
throw UnimplementedError(
'Not Implemented PinCodeTheme. '
'Please add it as extension to the MaterialApp -> ThemeData',
);
}
return theme;
}
}
themeExtension
PinCodeCustomKey? bottomLeftKeyboardButton,
PinCodeCustomKey? bottomRightKeyboardButton,
abstract class PinCodeService{
// reads from device internal storage and returns the stored pin code to the bloc
Future<String?> getPinCode();
//pinCode from user input, whether it was verified by the server
Future<bool> verifyPinCode(String pinCode);
// the servers returns the correct length
Future<int> getPinLength();
// encrypt the string and store it in the device secure storage, add a default implementation to
store what is the input
// returns the encrypted pinCode
String encyptPinCode(String pinCode) => pinCode;
}