ali_auth 1.3.9 copy "ali_auth: ^1.3.9" to clipboard
ali_auth: ^1.3.9 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 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.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({super.key});

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

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

  Widget getDefaultRouter() {
    //还记得我们上边的routerPage嘛, 这个东西就是我们传进来的字符串,我们可以根据这个字符串来决定加载那个flutter页面
    String router = PlatformDispatcher.instance.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();
    }
  }

  @override
  Widget build(BuildContext context) {
    return PopScope(
      canPop: false,
      onPopInvokedWithResult: (didPop, result) {
        // 退出APP方法二
        if (!didPop) {
          Fluttertoast.showToast(
              msg: '您确定要退出思预云吗?',
              toastLength: Toast.LENGTH_SHORT,
              gravity: ToastGravity.CENTER,
              timeInSecForIosWeb: 1,
              backgroundColor: Colors.red,
              textColor: Colors.white,
              fontSize: 16.0);
        }
      },// look here!
      child: MaterialApp(
        home: getDefaultRouter(),
        routes: <String, WidgetBuilder>{
          '/homePage': (BuildContext context) => const MyHomePage(),
          '/routerPage': (BuildContext context) => const MyRouterPage(),
        },
      ),
    );
  }
}
31
likes
140
points
869
downloads
screenshot

Documentation

API reference

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

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins, js, plugin_platform_interface

More

Packages that depend on ali_auth

Packages that implement ali_auth