Skip to content

Instantly share code, notes, and snippets.

View DaemonLoki's full-sized avatar
🕺
Excited about technology!

Stefan Blos DaemonLoki

🕺
Excited about technology!
View GitHub Profile
@DaemonLoki
DaemonLoki / ContentView.swift
Created July 12, 2022 20:01
Card Flip Animation with a drag.
import SwiftUI
struct ViewContainer: View {
var flipped: Bool
var isReversed: Bool
var body: some View {
if flipped {
ZStack {
String mailPattern = r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$";
RegExp regEx = RegExp(mailPattern);
String mailAddress = "Couldn't find any mail in the foto! Please try again!";
for (TextBlock block in visionText.blocks) {
for (TextLine line in block.lines) {
if (regEx.hasMatch(line.text)) {
mailAddress = line.text;
}
}
final TextRecognizer textRecognizer = FirebaseVision.instance.textRecognizer();
final VisionText visionText = await textRecognizer.processImage(visionImage);
import 'dart:io';
import 'package:firebase_ml_vision/firebase_ml_vision.dart';
final File imageFile = File(filePath);
final FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(imageFile);
import 'package:camera/camera.dart';
List<CameraDescription> cameras = await availableCameras();
CameraController controller = CameraController(cameras[0], ResolutionPreset.medium);
String filePath = "Photos/image_test.jpg"
await controller.takePicture(filePath);