aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.

Home Page:https://docs.amplify.aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customize title of Authentication with Amplify flutter Authentication UI

KumarHalder opened this issue · comments

I am trying to update the text "Log in using", and preferably remove it. I did not find anything to do that. I am using a mix of prebuilt ui with customization in flutter amplify_authenticator package.

image

I have tried all AuthStringResolver as follows.

  ButtonResolver? buttons,
  DialCodeResolver? dialCodes,
  InputResolver? inputs,
  MessageResolver? messages,
  TitleResolver? titles,
  InstructionsResolver? instructions,
})

They work for pretty much all the text in different components. However, I could not change the title of tab. Any help regarding this would much appreciated.

Hello @KumarHalder - It looks like you are already customizing some of the content in the authenticator. This content is considered an input label and can be customized with a custom InputResolver. There is no way to remove the Text widget (without rebuilding the full screen) but you can return an empty string.

class CustomInputResolver extends InputResolver {
  const CustomInputResolver();

  @override
  String title(BuildContext context, InputField field) {
    switch (field) {
      case InputField.usernameType:
        return '';
      default:
        return super.title(context, field);
    }
  }
}
return Authenticator(
  stringResolver: AuthStringResolver(
    inputs: CustomInputResolver(),
  ),
  // other props
);

Let me know if you have any other questions

Thank you so much! That worked! I wished there was more documentation about this. I believe a lot can be achieved by customization, and due to proper documentation, we are missing a lot.