GitHub 代码仓MuhammadHassanRazaa/FlutterSocialLoginButtons

FlutterSocialLoginButtons

一个全新的 Flutter 包,可轻松创建社交登录按钮。

FlutterSocialLoginButtons 项目封面
星标
5
复刻
9
最近推送(UTC)
2024年6月2日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

pub package pub points

Flutter Social Login Button

Social Login Button is a flutter package to create social media login buttons of all common used SSO.

Usage

Add the dependency in pubsec.yaml file.

  dependencies:
    flutter:
      sdk: flutter
    social_login_buttons: 1.0.7

How to Use

  SocialLoginButton(
    buttonType: SocialLoginButtonType.apple,
    onPressed: () {},
  )          

You can also specify some other arguments which are:

  • imageURL (if you're specifying the image link from your Github repo, don't forget to change blob with raw)
  • imagePath (you can also use local image, Local will be preferred incase cpecifed both)
  • imageWidth
  • text
  • backgroundColor
  • textColor
  • height
  • width
  • borderRadius
  • fontSize
  • mode

Below is the example with all arguments supplied:

   SocialLoginButton(
      backgroundColor: Colors.amber,
      height: 50,
      text: 'SignIn',
      borderRadius: 20,
      fontSize: 25,
      buttonType: SocialLoginButtonType.generalLogin,
      imageWidth: 20,
      imagepath: "assets/file.png",
      imageURL: "URL",
      onPressed: () {},
   ),

Button Types

  • Facebook
  • Google
  • Twitter
  • Apple
  • AppleBlack
  • Microsoft
  • MicrosoftBlack
  • Github
  • General Login

Mode

There are two modes available for the buttons, You can make shorter buttons with single mode.

  • single
  • multi

Example

import 'package:flutter/material.dart';
import 'package:social_login_buttons/social_login_buttons.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Social Login Buttons',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(tittle: 'Flutter Social Login Buttons'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key, required this.tittle}) : super(key: key);
  final String tittle;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Social Login Button'),
        elevation: 2.0,
      ),
      body: _buildContainer(context),
      backgroundColor: Colors.grey[200],
    );
  }

  Widget _buildContainer(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(16.0),
      child: Center(
        child: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              SocialLoginButton(
                buttonType: SocialLoginButtonType.apple,
                onPressed: () {},
              ),
              const SizedBox(height: 10),
              SocialLoginButton(
                buttonType: SocialLoginButtonType.appleBlack,
                onPressed: () {},
              ),
              const SizedBox(height: 10),
              SocialLoginButton(
                buttonType: SocialLoginButtonType.facebook,
                onPressed: () {},
              ),
              const SizedBox(height: 10),
              SocialLoginButton(
                buttonType: SocialLoginButtonType.github,
                onPressed: () {},
              ),
              const SizedBox(height: 10),
              SocialLoginButton(
                buttonType: SocialLoginButtonType.google,
                onPressed: () {},
              ),
              const SizedBox(height: 10),
              SocialLoginButton(
                buttonType: SocialLoginButtonType.microsoft,
                onPressed: () {},
              ),
              const SizedBox(height: 10),
              SocialLoginButton(
                buttonType: SocialLoginButtonType.microsoftBlack,
                onPressed: () {},
                imageWidth: 20,
              ),
              const SizedBox(height: 10),
              SocialLoginButton(
                backgroundColor: Colors.amber,
                height: 50,
                text: 'SignIn',
                borderRadius: 20,
                fontSize: 25,
                buttonType: SocialLoginButtonType.generalLogin,
                onPressed: () {},
              ),
              const SizedBox(height: 10),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  SocialLoginButton(
                    buttonType: SocialLoginButtonType.google,
                    onPressed: () {},
                    mode: SocialLoginButtonMode.single,
                  ),
                ],
              )
            ],
          ),
        ),
      ),
    );
  }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Apache-2.0

Screenshot

Image

Muhammad Hassan Raza GitHub avatar
GitHub 作者

Muhammad Hassan Raza ↗

A hardworking and resourceful problem solver, GDG Budapest Co-Organizer & GDSC Leads Mentor, with the ability to persuade people about computer-related works.

Morgan StanleyBudapest, Hungary官方网站 ↗
语言C++DartCMakeCKotlin

分类

此仓库发布的插件

使用的依赖

依赖清单 3 项

  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}
  • flutter_lints开发依赖^1.0.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗