Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View RafaelBarbosatec's full-sized avatar

Rafael Almeida Barbosa RafaelBarbosatec

View GitHub Profile
@slightfoot
slightfoot / smooth_scroll.dart
Created July 14, 2022 17:35
Correct smooth scroll for Flutter Web - by Simon Lightfoot - 14th July 2022
// MIT License
//
// Copyright (c) 2022 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 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) {