Git Product home page Git Product logo

barras's People

Contributors

deadblit avatar felipecalderaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

barras's Issues

NoSuchMethodError on cancel()

======== Exception caught by widgets library =======================================================
The following NoSuchMethodError was thrown while finalizing the widget tree:
The method 'cancel' was called on null.
Receiver: null
Tried calling: cancel()

qrcode-dependency throws an error on Android ("Execution failed for task ':qrcode:compileDebugKotlin'.")

Hello,

Thank you for the nice package.

I've been playing around with it, and it was working fine. But after upgrading to new flutter.

The package throws exception when building the project. Execution failed for task ':qrcode:compileDebugKotlin'.

Screenshot 2021-01-01 at 14 06 27

@deadblit

Pub Dependencies

`publish_to: 'none' version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^1.0.1
google_fonts: ^1.1.1
firebase_messaging: ^7.0.3
overlay_support: ^1.0.5
url_launcher: ^5.7.10
flutter_local_notifications: ^3.0.2
webview_flutter: ^1.0.7
http: ^0.12.2
shared_preferences: ^0.5.12+4
barras: ^0.0.2

dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter

`

android/build.gradle [project root]

` buildscript { ext.kotlin_version = "1.3.50" repositories { google() jcenter() }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.android.tools.build:gradle:4.1.0'
        // Add the google services classpath
        classpath 'com.google.gms:google-services:4.3.2'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

`

android/app/build.gradle

` def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    lintOptions {
        abortOnError false
        checkReleaseBuilds false //<- add this line
    }
    compileSdkVersion 30

    defaultConfig {
        multiDexEnabled true
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.mangowi.mpwa"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    signingConfigs {
       release {
          
       }
    }
    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }
    flavorDimensions "flavors"
    // product flavors
    productFlavors{
       
        demomain{
            dimension "flavors"
            applicationIdSuffix ".app.mainflavor"
            versionCode 6
            versionName "1.0.0"
        }
        demohumle{
            dimension "flavors"
            applicationIdSuffix ".app.secondflavor"
            versionCode 6
            versionName "1.0.0"
        }


    }

}

dependencies{
    implementation 'com.android.support:multidex:1.0.3'
}

flutter {
    source '../..'
}

apply plugin: 'com.google.gms.google-services'

`

Blank Screen pops up when the Scanner is selected

I'm having a BarCode scanner and a TextFormField.

When presssed on the BarCode scanner it scans perfectly and retreives the BarCode and prints it in the TextFormField.

But when you enter your custom text in the TextFormField and press the BarCode scanner a black screen cones inside the scanner but retreives some odd Barcode value.

TextEditingController someController = TextEditingController();
  String _scannedCode = "";

  scanBarCode() async {
    final data = await Barras.scan(
      context,
      viewfinderHeight: 120,
      viewfinderWidth: 300,
      scrimColor: Color.fromRGBO(128, 0, 0, 0.5),
      borderColor: Colors.red,
      borderRadius: 24,
      borderStrokeWidth: 2,
      buttonColor: Colors.yellow,
      borderFlashDuration: 250,
      cancelButtonText: "Cancel",
      successBeep: false,
    );

    setState(() {
      _scannedCode = data ?? "";
      print(data);
      print(_scannedCode);
    });
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: [
          IconButton(
              icon: Icon(Icons.scanner),
              onPressed: scanBarCode),
          SizedBox(
            width: 20,
          ),
        ],
      ),
      body: Padding(
        padding: const EdgeInsets.all(20.0),
        child: Column(
          children: [
            _scannedCode.isEmpty ? TextFormField(
              style: TextStyle(color: Colors.blueGrey),
              controller: someController,
              textCapitalization: TextCapitalization.characters,
              decoration: InputDecoration(
                  enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Colors.blueGrey),
                  ),
                  prefixIcon: Icon(
                    Icons.scanner,
                    color: Colors.blueGrey,
                  ),
                  suffixIcon: IconButton(
                    icon: Icon(
                      Icons.clear,
                      color: Colors.blueGrey,
                    ),
                    onPressed: () {
                      someController.clear();
                    },
                  ),
                  labelStyle: TextStyle(color: Color(0xFFCFB53B)),
                  labelText: 'Article Number',
                  contentPadding: EdgeInsets.all(15.0),
                  isDense: true,
                  border: OutlineInputBorder(borderSide: BorderSide(color: Colors.blueGrey)),
                  focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.blueGrey))),
            ) : TextFormField(
              style: TextStyle(color: Colors.blueGrey),
              controller: someController..text = _scannedCode,
              textCapitalization: TextCapitalization.characters,
              decoration: InputDecoration(
                  enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Colors.blueGrey),
                  ),
                  prefixIcon: Icon(
                    Icons.scanner,
                    color: Colors.blueGrey,
                  ),
                  suffixIcon: IconButton(
                    icon: Icon(
                      Icons.clear,
                      color: Colors.blueGrey,
                    ),
                    onPressed: () {
                      someController.clear();
                    },
                  ),
                  labelStyle: TextStyle(color: Color(0xFFCFB53B)),
                  labelText: 'Article Number',
                  contentPadding: EdgeInsets.all(15.0),
                  isDense: true,
                  border: OutlineInputBorder(borderSide: BorderSide(color: Colors.blueGrey)),
                  focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.blueGrey))),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 16.0),
              child: ElevatedButton(
                onPressed: () {
                  scanBarCode();
                },
                child: Text('Scan'),
              ),
            ),
          ],
        ),
      ),
    );
  }

Execution failed for task ':qrcode:compileDebugKotlin'

I can't even run the app, it's giving me this error with the qrcode library... (even that I want to use just the barcode function)

e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (126, 10): Object is not abstract and does not implement abstract member public abstract fun onActivityPaused(@NonNull p0: Activity): Unit defined in android.app.Application.ActivityLifecycleCallbacks
e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (127, 14): 'onActivityPaused' overrides nothing
e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (133, 14): 'onActivityResumed' overrides nothing

e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (139, 14): 'onActivityStarted' overrides nothing
e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (142, 14): 'onActivityDestroyed' overrides nothing
e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (145, 14): 'onActivitySaveInstanceState' overrides nothing
e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (148, 14): 'onActivityStopped' overrides nothing
e: C:\Program Files\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode-1.0.4\android\src\main\kotlin\com\example\qrcode\QRCaptureView.kt: (151, 14): 'onActivityCreated' overrides nothing

FAILURE: Build failed with an exception.

Feel free to ask me any question so we can solve this issue together (Brasileiro aqui tambem... so escrevi em ingles para see algum extrangeiro tiver alguma ideia de como resolver)

Parabens pelo trabalho incrivel!

Update to null safety!

Really thankful for the package
But to use this with the latest version of flutter with sound null safety, a problem occurs.
As most of the packages are migrated to null safety, this too needs an update.

Tela preta na hora de escanear

Muito boa essa lib.
Funcionou muito bem quase todas as vezes que testei. Mas as vezes a tela de escanear fica preta.
Mesmo com a tela preta ele consegue detectar o código de barras.

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on Mac OS X 10.15.2 19C57 darwin-x64, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.51.1)
[✓] Connected device (2 available)

• No issues found!

Feauture request: validation function

Could you, please, add some validation?
Would be great to pass the function that return true if barcode is valid (scanned item is exists in database, for example) or false if not and scan in infinity loop until this function return true or cancel pressed. Maybe it's reasonable to pass callback for failed scan - developers could show a Toast in that case or play custom sound

Android V2 Embedding

The plugins qrcode, torch_compat use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.