flutter_curiosity 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

flutter_curiosity #

集成部分原生功能,支持ios&android

1.原生多个方法 点击查看 #

2.二维码扫描 点击查看 #

   anroid 分 CameraX最新版预览识别 和旧版 Camera API预览识别
   新版API对于条形码的识别率 相对于 旧版的API正确率会低一些
   旧版不支持设置区域识别,新版 仅android支持指定区域识别
   打开闪光灯  android 暂时无效
1、添加相机相关权限:
  • 项目目录->Info.plist->增加
	<key>NSCameraUsageDescription</key>
	<string>扫描二维码时需要使用您的相机</string>
	<key>NSPhotoLibraryUsageDescription</key>
	<string>扫描二维码时需要访问您的相册</string>
    <key>io.flutter.embedded_views_preview</key>
    <true/>

3.图片选择 点击查看 #

ios

1、添加相册相关权限:
  • 项目目录->Info.plist->增加 使用了相机、定位、麦克风、相册,请参考Demo添加下列属性到info.plist文件:
   <key>NSCameraUsageDescription</key>    
    <string>请允许打开相机拍照</string>
    <key>NSLocationWhenInUseUsageDescription</key>
	<string>我们需要通过您的地理位置信息获取您周边的相关数据</string>
	<key>NSPhotoLibraryAddUsageDescription</key>
	<string>请允许访问相册以选取照片</string>
	<key>NSPhotoLibraryUsageDescription</key>
	<string>请允许访问相册以选取照片</string>
	<key>NSFileProviderDomainUsageDescription</key>
	<string>是否允许此App使用你的相机进行拍照?</string>
2、中文适配:
  • 添加中文 Runner -> Info.plist -> Localizations 点击"+"按钮,选择Chinese(Simplified)

4.获取手机硬件信息 (app信息,手机厂商信息) 点击查看 #

[1.0.1] #

remove android r8

[1.0.0] #

publish

[0.0.2] #

format code

[0.0.1] #

create lib

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_curiosity/flutter_curiosity.dart';

import 'ScanPage.dart';

void main() async {
  runApp(MaterialApp(
    debugShowCheckedModeBanner: false,
    title: 'Curiosity',
    home: App(),
  ));
}

class App extends StatelessWidget {
  bool san = true;
  StateSetter setState;
  List<AssetMedia> list = List();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text('Flutter Curiosity Plugin app'),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Center(),
          StatefulBuilder(builder: (BuildContext context, StateSetter state) {
            setState = state;
            return Column(children: showText());
          },),
          RaisedButton(
              onPressed: () {
                scan(context);
              },
              child: Text('扫码')),
          RaisedButton(
              onPressed: () {
                select();
              },
              child: Text('图片选择')),
          RaisedButton(
              onPressed: () {
                shareText();
              },
              child: Text('分享文字')),
          RaisedButton(
              onPressed: () {
                shareImage();
              },
              child: Text('分享图片')),
          RaisedButton(
              onPressed: () {
                shareImages();
              },
              child: Text('分享多张图片')),
          RaisedButton(
              onPressed: () {
                getGPS();
              },
              child: Text('获取gps状态')),
          RaisedButton(
              onPressed: () {
                GPSTools.jumpSetting();
              },
              child: Text('跳转GPS设置')),

        ],
      ),
    );
  }

  shareText() {
    NativeTools.systemShare(
        title: '分享图片', content: '分享几个文字', shareType: ShareType.text);
  }

  shareImage() {
    if (list.length == 0) {
      print('请先选择图片');
      return;
    }
    NativeTools.systemShare(
        title: '分享图片', content: list[0].path, shareType: ShareType.image);
  }

  shareImages() {
    if (list.length == 0) {
      print('请先选择图片');
      return;
    }
    List<String> listPath = [];
    listPath.add(list[0].path);
    listPath.add(list[0].path);
    NativeTools.systemShare(
        title: '分享图片', imagesPath: listPath, shareType: ShareType.images);
  }

  getGPS() async {
    var data = await GPSTools.getStatus();
    print(data);
  }

  List<Widget> showText() {
    List<Widget> widget = List();
    list.map((value) {
      widget.add(Text(value.path + '==' + value.fileName));
    }).toList();
    return widget;
  }

  scan(BuildContext context) {
    showCupertinoModalPopup(context: context, builder: (context) => ScanPage());
  }

  select() async {
    PicturePickerOptions options = PicturePickerOptions();
    list = await PicturePicker.openPicker(options);
    setState(() {});
  }

}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_curiosity: ^1.0.1

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:flutter_curiosity/flutter_curiosity.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
18
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Jul 10, 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 linux

Because:

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

Package does not support Flutter platform macos

Because:

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

Package does not support Flutter platform web

Because:

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

Package does not support Flutter platform windows

Because:

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

Package not compatible with SDK dart

Because:

  • flutter_curiosity that is a package requiring null.

Health suggestions

Format lib/appinfo/AppInfo.dart.

Run flutter format to format lib/appinfo/AppInfo.dart.

Format lib/appinfo/AppInfoModel.dart.

Run flutter format to format lib/appinfo/AppInfoModel.dart.

Format lib/constant/Constant.dart.

Run flutter format to format lib/constant/Constant.dart.

Fix additional 11 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/constant/Enum.dart (Run flutter format to format lib/constant/Enum.dart.)
  • lib/gallery/AssetMedia.dart (Run flutter format to format lib/gallery/AssetMedia.dart.)
  • lib/gallery/PicturePicker.dart (Run flutter format to format lib/gallery/PicturePicker.dart.)
  • lib/gallery/PicturePickerOptions.dart (Run flutter format to format lib/gallery/PicturePickerOptions.dart.)
  • lib/scanner/Scanner.dart (Run flutter format to format lib/scanner/Scanner.dart.)
  • lib/scanner/ScannerController.dart (Run flutter format to format lib/scanner/ScannerController.dart.)
  • lib/scanner/view/ScannerBox.dart (Run flutter format to format lib/scanner/view/ScannerBox.dart.)
  • lib/scanner/view/ScannerPainter.dart (Run flutter format to format lib/scanner/view/ScannerPainter.dart.)
  • lib/tools/GPSTools.dart (Run flutter format to format lib/tools/GPSTools.dart.)
  • lib/tools/NativeTools.dart (Run flutter format to format lib/tools/NativeTools.dart.)
  • lib/tools/Tools.dart (Run flutter format to format lib/tools/Tools.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test