ali_auth 1.3.0 copy "ali_auth: ^1.3.0" to clipboard
ali_auth: ^1.3.0 copied to clipboard

This is a plug-in for one click login in the alicloud number authentication service. Alibaba cloud is also used in the one click login function

example/lib/main.dart

import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'my_home_page.dart';
import 'my_home_page_web.dart';
import 'my_router_page.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    configLoading();
  }

  Widget getDefaultRouter() {
    //还记得我们上边的routerPage嘛, 这个东西就是我们传进来的字符串,我们可以根据这个字符串来决定加载那个flutter页面
    String router = window.defaultRouteName;
    if (kDebugMode) {
      print("获取到路由数据--------$router");
    }
    if (defaultTargetPlatform == TargetPlatform.iOS ||
        defaultTargetPlatform == TargetPlatform.android) {
      if (router.contains('routerPage')) {
        return const MyRouterPage();
      } else {
        return const MyHomePage();
      }
    } else {
      return const MyHomePageWeb();
    }
  }

  /// 弹窗插件初始化
  void configLoading() {
    EasyLoading.instance
      ..displayDuration = const Duration(milliseconds: 2000)
      ..indicatorType = EasyLoadingIndicatorType.fadingCircle
      ..loadingStyle = EasyLoadingStyle.dark
      ..indicatorSize = 45.0
      ..radius = 10.0
      ..progressColor = Colors.yellow
      ..backgroundColor = Colors.green
      ..indicatorColor = Colors.yellow
      ..textColor = Colors.yellow
      ..maskColor = Colors.blue.withOpacity(0.5)
      ..userInteractions = true
      ..dismissOnTap = false;
  }

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () {
        // 退出APP方法一
        EasyLoading.show(
          status: '您确定要退出思预云吗?',
        );
        return Future.value(false);
      }, // look here!
      child: MaterialApp(
        home: getDefaultRouter(),
        routes: <String, WidgetBuilder>{
          '/homePage': (BuildContext context) => const MyHomePage(),
          '/routerPage': (BuildContext context) => const MyRouterPage(),
        },
        builder: EasyLoading.init(),
      ),
    );
  }
}
21
likes
160
points
371
downloads
screenshot

Publisher

verified publisherki5k.com

Weekly Downloads

This is a plug-in for one click login in the alicloud number authentication service. Alibaba cloud is also used in the one click login function

Homepage
Repository (GitHub)
View/report issues

Topics

#aliyun #phone

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins, js, plugin_platform_interface

More

Packages that depend on ali_auth