Skip to content

Instantly share code, notes, and snippets.

@ianholing
ianholing / GenerateVideoFunc.dart
Last active May 26, 2022 08:16
AvatART App realtime video encoding with flutter ffmpeg
Future<String> generateVideo(String videoPath, List<StyleChangeRecord> videoChangeRecords, Function(data.Stack<ProgressItem> progress) callback) async {
await _checkDirs();
_cleanBasePathWithFilter(".aac");
_pushProgress(ProgressItem("Transformation Step", 1, 4, "Clean folder.."), callback);
List<Future> futures = <Future>[];
new Directory('$basePath/$_framesFolder').listSync().forEach((frame) async {
if (FileSystemEntity.typeSync(frame.path) == FileSystemEntityType.file) {
futures.add((frame as File).delete());
}
@CalvinGonsalves
CalvinGonsalves / main.dart
Last active January 15, 2025 18:15
open and close video stream from web cam in flutter web
import 'package:flutter/material.dart';
import 'dart:html' as html;
import 'dart:ui' as ui;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@nicholas-ochoa
nicholas-ochoa / dbconfig.js
Created February 26, 2020 20:22
Node OracleDB 5.x PL/SQL Nested Cursor tests
/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
/******************************************************************************
*
* You may not use the identified files except in compliance with the Apache
* License, Version 2.0 (the "License.")
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
var express = require('express')
var multer = require('multer')
var fs = require('fs');
var upload = multer({ dest: 'uploads/' })
var app = express()
app.post('/upload', upload.single("picture"), function (req,res) {
console.log("Received file" + req.file.originalname);
var src = fs.createReadStream(req.file.path);
class BlurView extends StatefulWidget {
final String imagePath;
const BlurView(this.imagePath, {Key key}) : super(key: key);
@override
_BlurViewState createState() => _BlurViewState();
}
class _BlurViewState extends State<BlurView> {
ui.Image image;
// imgLib -> Image package from https://pub.dartlang.org/packages/image
import 'package:image/image.dart' as imglib;
import 'package:camera/camera.dart';
Future<List<int>> convertImagetoPng(CameraImage image) async {
try {
imglib.Image img;
if (image.format.group == ImageFormatGroup.yuv420) {
img = _convertYUV420(image);
} else if (image.format.group == ImageFormatGroup.bgra8888) {
@mcany
mcany / app.dart
Last active May 27, 2021 04:23
New Flutter Project with Bloc
export 'app_bloc.dart';
export 'app_event.dart';
export 'app_state.dart';
export 'app_route.dart';
@roipeker
roipeker / image_color_picker_widget.dart
Last active January 21, 2025 13:18
Basic image pixel color detection in Flutter (supports screenshots of the widget tree)
//////////////////////////////
//
// 2019, roipeker.com
// screencast - demo simple image:
// https://youtu.be/EJyRH4_pY8I
//
// screencast - demo snapshot:
// https://youtu.be/-LxPcL7T61E
//
//////////////////////////////
@Andrious
Andrious / Scaffold_FooterButtons.dart
Created June 6, 2019 16:27
Scaffold's persistentFooterButtons parameter example
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key);
State createState() => _MyAppState();
}
import 'package:flutter/material.dart';
class NavigatorPage extends StatefulWidget {
const NavigatorPage({ Key key, this.child }) : super(key: key);
final Widget child;
@override
_NavigatorPageState createState() => _NavigatorPageState();
}