ali_loyalty_flutter 1.0.0+200525

  • Readme
  • Changelog
  • Example
  • Installing
  • 36

#README

Create build file #

tar --exclude='.dart_tool' --exclude='example' --exclude='.idea' --exclude='.vscode' --exclude='.tar.gz' -czf ali_loyalty_flutter-1.0.0+200522.tar.gz ./

Upload to Cloudsmith #

cloudsmith push dart ali/ali-loyalty-flutter ali_loyalty_flutter-1.0.0+200522.tar.gz

[1.0.0+200525] #

[1.0.0+200526] #

  • Update Android Project

example/lib/main.dart

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

import 'package:ali_loyalty_flutter/ali_loyalty_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue, fontFamily: "NunitoSans"),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final clientId = "42486";
  final phone = "0949194668";
  final fullname = "Vu Ho Mlo";

  final apiKey = "c4ca4238a0b923820dcc509a6f75849b";
  final apiSecret = "3792b218b5a17487da14abb94bb7b4ef";

  @override
  void initState() {
    super.initState();

    _getCurrentLocation();
  }

  Future<void> _getCurrentLocation() async {
    try {
      var location = Location();
      if (await location.serviceEnabled()) {
        bool success =
            await location.hasPermission() == PermissionStatus.GRANTED;
        if (!success) {
          success =
              await location.requestPermission() == PermissionStatus.GRANTED;
        }

        if (success) {
          LocationData data = await location.getLocation();
          AliLoyalty().auth(
              appName: "TOT Loyalty",
              apiKey: apiKey,
              apiSecret: apiSecret,
              clientId: clientId,
              phone: phone,
              fullname: fullname,
              currentLat: data.latitude,
              currentLng: data.longitude,
              language: "vi");
        } else {
          throw Exception;
        }
      } else {
        throw Exception;
      }
    } catch (_) {}
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: AliLoyalty().widget(onBack: () {
        debugPrint("on go back");
      }),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  ali_loyalty_flutter: ^1.0.0+200525

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:ali_loyalty_flutter/ali_loyalty_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
81
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
36
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:ali_loyalty_flutter/ali_loyalty_flutter.dart that imports:
  • package:ali_loyalty_flutter/src/ui/app/app.dart that imports:
  • package:ali_loyalty_flutter/src/utils/nav_service.dart that imports:
  • package:ali_loyalty_flutter/src/ui/page/voucher_detail/voucher_detail_page.dart that imports:
  • package:ali_loyalty_flutter/src/ui/widgets/network_image.dart that imports:
  • package:cached_network_image/cached_network_image.dart that imports:
  • package:cached_network_image/src/image_provider/cached_network_image_provider.dart that imports:
  • package:cached_network_image/src/image_provider/_image_provider_io.dart that imports:
  • package:flutter_cache_manager/flutter_cache_manager.dart that imports:
  • package:flutter_cache_manager/src/cache_manager.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform ios

Because:

  • package:ali_loyalty_flutter/ali_loyalty_flutter.dart that imports:
  • package:ali_loyalty_flutter/src/ui/app/app.dart that imports:
  • package:ali_loyalty_flutter/src/utils/nav_service.dart that imports:
  • package:ali_loyalty_flutter/src/ui/page/voucher_detail/voucher_detail_page.dart that imports:
  • package:ali_loyalty_flutter/src/ui/widgets/network_image.dart that imports:
  • package:cached_network_image/cached_network_image.dart that imports:
  • package:cached_network_image/src/image_provider/cached_network_image_provider.dart that imports:
  • package:cached_network_image/src/image_provider/_image_provider_io.dart that imports:
  • package:flutter_cache_manager/flutter_cache_manager.dart that imports:
  • package:flutter_cache_manager/src/cache_manager.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform linux

Because:

  • package:ali_loyalty_flutter/ali_loyalty_flutter.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:ali_loyalty_flutter/ali_loyalty_flutter.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:ali_loyalty_flutter/ali_loyalty_flutter.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:ali_loyalty_flutter/ali_loyalty_flutter.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • ali_loyalty_flutter that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

5 out of 5 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/core/objects/point_using.dart. (-8.17 points)

Analysis of lib/src/core/objects/point_using.dart reported 17 hints, including:

line 9 col 10: Name non-constant identifiers using lowerCamelCase.

line 11 col 10: Name non-constant identifiers using lowerCamelCase.

line 12 col 10: Name non-constant identifiers using lowerCamelCase.

line 14 col 10: Name non-constant identifiers using lowerCamelCase.

line 15 col 10: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/ui/page/use_voucher/tabs/qrcode_tab.dart. (-1.49 points)

Analysis of lib/src/ui/page/use_voucher/tabs/qrcode_tab.dart reported 3 hints:

line 1 col 8: Unused import: 'package:cached_network_image/cached_network_image.dart'.

line 9 col 8: Unused import: 'package:flutter_spinkit/flutter_spinkit.dart'.

line 17 col 18: Close instances of dart.core.Sink.

Fix lib/src/ui/page/point_log/point_log_page.dart. (-1 points)

Analysis of lib/src/ui/page/point_log/point_log_page.dart reported 2 hints:

line 7 col 8: Unused import: 'package:ali_loyalty_flutter/src/ui/widgets/nav_back_button.dart'.

line 26 col 34: The value of the field '_scaffoldKey' isn't used.

Fix additional 20 files with analysis or formatting issues. (-8.50 points)

Additional issues in the following files:

  • lib/src/ui/page/search/search_page.dart (2 hints)
  • lib/src/ui/page/supplier_page/supplier_page.dart (2 hints)
  • lib/src/ui/page/voucher_detail/tabs/info_tab.dart (2 hints)
  • lib/src/ui/widgets/category_widget.dart (2 hints)
  • lib/src/core/objects/voucher.dart (1 hint)
  • lib/src/ui/page/my_voucher/bloc/my_voucher_event.dart (1 hint)
  • lib/src/ui/page/my_voucher/my_voucher_page.dart (1 hint)
  • lib/src/ui/page/search/bloc/search_event.dart (1 hint)
  • lib/src/ui/page/supplier_page/bloc/supplier_event.dart (1 hint)
  • lib/src/ui/page/voucher_detail/tabs/where_to_use_tab.dart (1 hint)
  • lib/src/ui/styles/r.dart (1 hint)
  • lib/src/ui/widgets/nav_bar.dart (1 hint)
  • lib/src/utils/datetime_utils.dart (1 hint)
  • lib/src/core/exception.dart (Run flutter format to format lib/src/core/exception.dart.)
  • lib/src/ui/page/filter/bloc/bloc.dart (Run flutter format to format lib/src/ui/page/filter/bloc/bloc.dart.)
  • lib/src/ui/page/home/bloc/bloc.dart (Run flutter format to format lib/src/ui/page/home/bloc/bloc.dart.)
  • lib/src/ui/page/point_log/bloc/point_log_event.dart (Run flutter format to format lib/src/ui/page/point_log/bloc/point_log_event.dart.)
  • lib/src/ui/page/point_log/bloc/point_log_state.dart (Run flutter format to format lib/src/ui/page/point_log/bloc/point_log_state.dart.)
  • lib/src/ui/page/search/bloc/bloc.dart (Run flutter format to format lib/src/ui/page/search/bloc/bloc.dart.)
  • lib/src/ui/page/voucher_detail/bloc/bloc.dart (Run flutter format to format lib/src/ui/page/voucher_detail/bloc/bloc.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (bloc, flutter_bloc).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
bloc ^4.0.0 4.0.0 5.0.1
cached_network_image ^2.2.0+1 2.2.0+1 2.3.0-rc
cupertino_icons ^0.1.2 0.1.3
device_info ^0.4.0+4 0.4.2+4
equatable ^1.1.1 1.2.2
flutter 0.0.0
flutter_bloc ^4.0.0 4.0.1 5.0.1
flutter_html ^1.0.0 1.0.0
flutter_spinkit ^4.1.0 4.1.2+1
flutter_torch ^0.2.3 0.2.3
http ^0.12.0+1 0.12.1
intl ^0.16.1 0.16.1
qr_mobile_vision ^1.0.0 1.0.1+1
shimmer ^1.1.0 1.1.1
url_launcher ^5.4.1 5.5.0
Transitive dependencies
charcode 1.1.3
chewie 0.9.10
chewie_audio 1.0.0+1
clock 1.0.1
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
css_colors 1.0.2
csslib 0.16.1
file 5.2.1
flutter_cache_manager 1.4.1
flutter_svg 0.17.4 0.18.0
flutter_web_plugins 0.0.0
html 0.14.0+3
http_parser 3.1.4
meta 1.1.8 1.2.2
native_device_orientation 0.3.0
nested 0.0.4
open_iconic_flutter 0.3.0
path 1.7.0
path_drawing 0.4.1
path_parsing 0.1.4
path_provider 1.6.11
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedantic 1.9.0 1.9.2
petitparser 3.0.4
platform 2.2.1
platform_detect 1.4.0
plugin_platform_interface 1.0.2
process 3.0.13
provider 4.3.1
pub_semver 1.4.4
rxdart 0.24.1
screen 0.0.5
sky_engine 0.0.99
source_span 1.7.0
sqflite 1.3.1
sqflite_common 1.0.2+1
string_scanner 1.0.5
synchronized 2.2.0+1
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
url_launcher_linux 0.0.1+1
url_launcher_macos 0.0.1+7
url_launcher_platform_interface 1.0.7
url_launcher_web 0.1.2
uuid 2.2.0
vector_math 2.0.8 2.1.0-nullsafety
video_player 0.10.11+2
video_player_platform_interface 2.0.2
video_player_web 0.1.3+2
wakelock 0.1.4+2
webview_flutter 0.3.22+1
xdg_directories 0.1.0
xml 3.7.0 4.2.0