搜索插件、代码仓与 APP 分类

插件详情v4.0.1

flutter_auth_ui

适用于 Flutter 的非官方 firebaseui 包。此库旨在提供对 Android、iOS 和 Web 的支持。支持通过电子邮件、电话、Google 账户等进行登录。

AndroidiOSWeb
近 30 天下载
156
喜欢数
68
Pub 分数
140

安装插件

flutter pub add flutter_auth_ui

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

flutter_auth_ui 是一个非官方的 Flutter 包,受 FirebaseUI 启发,旨在简化 Android、iOS 和 Web 平台上的身份验证。它提供了用于常见身份验证流程(包括电子邮件、电话和 Google 登录)的预构建 UI 组件。利用 Flutter 的跨平台功能构建,旨在减少样板代码,同时保持一致的用户体验。该包可与 Firebase Authentication 无缝集成,并支持现代身份验证模式,如无密码登录和多因素认证。

适合场景

  • 实现电子邮件/密码登录
  • 启用 Google 登录
  • 添加手机号码验证
  • 在网页上构建安全的登录流程
  • 支持多平台应用

主要特点

  • 预构建的身份验证 UI
  • 跨平台支持(Android、iOS、Web)
  • 与 Firebase 认证集成
  • 无密码和多因素认证支持
  • 可自定义的主题和样式

适合对象

  • 开发跨平台应用的开发者
  • 需要快速身份验证实施的团队
  • 使用 Firebase 作为后端的项目
  • 在设备间需要一致的身份验证用户体验的应用程序
  • 专注于快速MVP开发的初创公司

使用建议

  • 需要 Firebase 设置
  • 与原生UI相比,自定义选项有限
  • 依赖外部 Firebase 服务
  • 可能需要额外的状态管理
  • 非 Firebase 官方维护

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_auth_ui

Unofficial firebaseui package for flutter. This library aims to provide support for Android, iOS and the web. Login with Email, Phone, Google account and etc.

Getting Started

This plugin is wrapped Android/iOS/Web native plugin.

Check documents and setup your firebase project.

How to use

// Set provider
final providers = [
  AuthUiProvider.anonymous,
  AuthUiProvider.email,
  AuthUiProvider.phone,
  AuthUiProvider.apple,
  AuthUiProvider.facebook,
  AuthUiProvider.github,
  AuthUiProvider.google,
  AuthUiProvider.microsoft,
  AuthUiProvider.yahoo,
  AuthUiProvider.twitter,
];

final result = await FlutterAuthUi.startUi(
  items: providers,
  tosAndPrivacyPolicy: const TosAndPrivacyPolicy(
    tosUrl: "https://www.google.com",
    privacyPolicyUrl: "https://www.google.com",
  ),
  androidOption: const AndroidOption(
    enableSmartLock: false, // default true
    showLogo: true, // default false
    overrideTheme: true, // default false
  ),
  emailAuthOption: const EmailAuthOption(
    requireDisplayName: true, // default true
    enableMailLink: false, // default false
    handleURL: '',
    androidPackageName: '',
    androidMinimumVersion: '',
  ),
);

Requirements

Android
  • minSdkVersion 21
  • compileSdkVersion 34
iOS
  • iOS 13 or higher

Link

Tips

EmailLink

Note: In order to implement EmailLink, you will need to prepare in advance; check the firebase documentation first.

Let's check the code sample for firebase auth.

Android

To handle dynamic link, add FlutterAuthUiPlugin.catchEmailLink to onCreate and onNewIntent. (If you don't use EmailLink, then you don't need to add it.)

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.dr1009.app.flutter_auth_ui.FlutterAuthUiPlugin;

import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // check intent
        FlutterAuthUiPlugin.catchEmailLink(this, getIntent());
    }

    @Override
    protected void onNewIntent(@NonNull Intent intent) {
        super.onNewIntent(intent);

        // check intent
        FlutterAuthUiPlugin.catchEmailLink(this, intent);
    }
}
Localizing
Android

Supported without any special settings.

iOS

Check Localizing for iOS: Updating the iOS app bundle.

Web

Check Installation - Option 1: CDN - Localized Widget.

To change the title of AppBar on Android

Add the string value as app_name or fui_default_toolbar_title to your app's strings.xml file. Sample code is strings.xml.

Behavior depends on FirebaseUI-Android.

Show Logo (Android)
  1. Add your logo resource file to android/app/src/main/res/drawable/flutter_auth_ui_logo.xml or android/app/src/main/res/drawable-{m~xxxhdpi}/flutter_auth_ui_logo.png
  2. Enable AndroidOption.showLogo
Change Appbar and link color (Android)
  1. Add flutter_auth_ui_style style to your android/app/src/main/res/values/style.xml
  1. Enable AndroidOption.overrideTheme

所属分类

依赖

依赖清单 4 项

源码仓库

使用此插件的项目

暂无相关数据。