如何在Flutter中实现凭证管理API?
我想在 Google 中保存登录凭据。如何在浏览器中调用凭证管理API?
使用自动填充组在浏览器中保存您的凭据并与您的谷歌帐户同步。
return Form(
key: _mobileKey,
child: AutofillGroup(
child: FocusScope(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormField(
controller: mobileController,
autofillHints: const [AutofillHints.telephoneNumber],
autofocus: true,
maxLength: 10,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(10),
],
textInputAction: TextInputAction.next,
keyboardType: TextInputType.phone,
// move to the next field
// onEditingComplete: _node.nextFocus,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Enter Your Mobile Number",
),
// The validator receives the text that the user has entered.
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your mobile number';
} else if (value.length < 10) {
return 'Enter Valid mobile number';
} else {
return null;
}
},
),
]))));
您可以将它用于指定的内置关键字。 例子
autofillHints: const [AutofillHints.email],
autofillHints: const [AutofillHints.password],
autofillHints: const [AutofillHints.name]
记住你不能使用自己的关键字