From 531b88109e893b9a6a740cbc52a63c20587f3c08 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 1 Sep 2022 12:01:08 +0300 Subject: [PATCH] Google GMS in F-Droid build #478 --- lib/ui/app/pinput.dart | 24 ++++++++++++++++++++++++ lib/ui/app/pinput.dart.foss | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 lib/ui/app/pinput.dart create mode 100644 lib/ui/app/pinput.dart.foss diff --git a/lib/ui/app/pinput.dart b/lib/ui/app/pinput.dart new file mode 100644 index 000000000..20ab75ecd --- /dev/null +++ b/lib/ui/app/pinput.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:invoiceninja_flutter/utils/localization.dart'; +import 'package:pinput/pinput.dart'; + +class AppPinput extends StatelessWidget { + const AppPinput({Key key, this.onCompleted}) : super(key: key); + + final ValueChanged onCompleted; + + @override + Widget build(BuildContext context) { + final localization = AppLocalization.of(context); + + return Pinput( + onCompleted: onCompleted, + autofocus: true, + length: 6, + showCursor: true, + androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi, + validator: (value) => + value.isEmpty ? localization.pleaseEnterACode : null, + ); + } +} diff --git a/lib/ui/app/pinput.dart.foss b/lib/ui/app/pinput.dart.foss new file mode 100644 index 000000000..aba7a3874 --- /dev/null +++ b/lib/ui/app/pinput.dart.foss @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart'; +import 'package:invoiceninja_flutter/utils/localization.dart'; + +class AppPinput extends StatelessWidget { + const AppPinput({Key key, this.onCompleted}) : super(key: key); + + final ValueChanged onCompleted; + + @override + Widget build(BuildContext context) { + final localization = AppLocalization.of(context); + + return DecoratedFormField( + label: localization.code, + keyboardType: TextInputType.number, + onChanged: onCompleted, + autofocus: true, + validator: (value) => + value.isEmpty ? localization.pleaseEnterACode : null, + ); + } +}