Skip to content

Instantly share code, notes, and snippets.

View kamranbekirovyz's full-sized avatar
🧢
UserOrient

Kamran Bekirov kamranbekirovyz

🧢
UserOrient
View GitHub Profile
@110chang
110chang / flutter_make_material_autocomplete_widget_to_cupertino_style.dart
Last active December 14, 2021 03:28
Flutter cupertino autocomplete sample
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
void main() => runApp(const AutocompleteExampleApp());
class AutocompleteExampleApp extends StatelessWidget {
const AutocompleteExampleApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@j05u3
j05u3 / lifecycle_aware_stream_builder.dart
Last active November 7, 2022 03:07
Lifecycle aware stream builder (flutter). Find more details on https://medium.com/p/a2ae7244af32
import 'dart:async';
import 'package:flutter/widgets.dart';
abstract class StreamBuilderBase<T, S> extends StatefulWidget {
/// Creates a [StreamBuilderBase] connected to the specified [stream].
const StreamBuilderBase({ Key key, this.stream }) : super(key: key);
/// The asynchronous computation to which this builder is currently connected,
@itsJoKr
itsJoKr / marker_generator.dart
Last active January 30, 2025 20:19
Quick way to convert the widget to marker, not supposed to work with images.
import 'package:flutter/material.dart';
import 'dart:typed_data';
import 'package:flutter/rendering.dart';
import 'dart:ui' as ui;
/// This just adds overlay and builds [_MarkerHelper] on that overlay.
/// [_MarkerHelper] does all the heavy work of creating and getting bitmaps
class MarkerGenerator {
final Function(List<Uint8List>) callback;
final List<Widget> markerWidgets;
@zzpmaster
zzpmaster / formatBytes.dart
Last active April 21, 2025 17:26
convert bytes to kb mb in dart
static String formatBytes(int bytes, int decimals) {
if (bytes <= 0) return "0 B";
const suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
var i = (log(bytes) / log(1024)).floor();
return ((bytes / pow(1024, i)).toStringAsFixed(decimals)) +
' ' +
suffixes[i];
}
@kasperpeulen
kasperpeulen / README.md
Last active March 14, 2025 13:39
How to pretty-print JSON using Dart.