ali_auth 1.3.6 copy "ali_auth: ^1.3.6" to clipboard
ali_auth: ^1.3.6 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: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({Key? key}) : super(key: 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 = 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();
    }
  }

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () {
        // 退出APP方法一
        Fluttertoast.showToast(
            msg: '您确定要退出思预云吗?',
            toastLength: Toast.LENGTH_SHORT,
            gravity: ToastGravity.CENTER,
            timeInSecForIosWeb: 1,
            backgroundColor: Colors.red,
            textColor: Colors.white,
            fontSize: 16.0);
        return Future.value(false);
      }, // look here!
      child: MaterialApp(
        home: getDefaultRouter(),
        routes: <String, WidgetBuilder>{
          '/homePage': (BuildContext context) => const MyHomePage(),
          '/routerPage': (BuildContext context) => const MyRouterPage(),
        },
      ),
    );
  }
}
30
likes
90
points
420
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, plugin_platform_interface

More

Packages that depend on ali_auth

Packages that implement ali_auth