Skip to content

Instantly share code, notes, and snippets.

View PlugFox's full-sized avatar
🦊
🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊

Plague Fox PlugFox

🦊
🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
View GitHub Profile
@PlugFox
PlugFox / main.dart
Last active November 11, 2024 14:53
Mutex benchmark
/*
* Mutex benchmark
* https://gist.github.com/PlugFox/264d59a37d02dd06a7123ef19ee8537d
* https://dartpad.dev?id=264d59a37d02dd06a7123ef19ee8537d
* Mike Matiunin <[email protected]>, 11 November 2024
*/
import 'dart:async';
import 'dart:collection';
import 'dart:isolate';
@PlugFox
PlugFox / main.dart
Created November 7, 2024 17:55
Completer throws an error to the zone.
/*
* Completer throws an error to the zone.
* https://gist.github.com/PlugFox/675bdaf8ae604989e1dc7959abddbfd5
* https://dartpad.dev?id=675bdaf8ae604989e1dc7959abddbfd5
* Mike Matiunin <[email protected]>, 07 November 2024
*/
// ignore_for_file: cascade_invocations, avoid_print
import 'dart:async';
@PlugFox
PlugFox / main.dart
Last active October 25, 2024 19:46
Сортировка чисел от 10 до 100 по их русскому текстовому представлению
/*
* Сортировка чисел от 10 до 100 по их русскому текстовому представлению
* https://gist.github.com/PlugFox/cf41859c3c03fb8ee4ae1e8fd1de81f1
* https://dartpad.dev?id=cf41859c3c03fb8ee4ae1e8fd1de81f1
* Mike Matiunin <[email protected]>, 25 October 2024
*/
const units = [
'ноль',
'один',
@PlugFox
PlugFox / main.dart
Last active October 25, 2024 19:18
Sort numbers from 10 to 100 by their English word representation
/*
* Sort numbers from 10 to 100 by their English word representation
* https://gist.github.com/PlugFox/80541bd650f17a0796780f7f953a1dda
* https://dartpad.dev?id=80541bd650f17a0796780f7f953a1dda
* Mike Matiunin <[email protected]>, 25 October 2024
*/
const units = [
'zero',
'one',
@PlugFox
PlugFox / main.dart
Last active October 24, 2024 16:33
Horizontal PageView with Hero Animation
// ignore_for_file: avoid_positional_boolean_parameters
/*
* Horizontal PageView with Hero Animation
* https://gist.github.com/PlugFox/a977312dbe79c830f77306c2185064c1
* https://dartpad.dev/?id=a977312dbe79c830f77306c2185064c1
* Mike Matiunin <[email protected]>, 24 October 2024
*/
import 'dart:async';
@PlugFox
PlugFox / text.dart
Last active October 17, 2024 07:15
Flutter Text Wrappers
import 'package:flutter/material.dart';
import 'package:ui/src/theme/extensions/typography.dart';
/// Helper widget to display text with the App's typography.
///
/// https://docs.flutter.dev/ui/design/text/typography
/// https://m3.material.io/styles/typography/overview
/// https://api.flutter.dev/flutter/material/Typography-class.html
/// https://api.flutter.dev/flutter/widgets/Text-class.html
class AppText extends StatelessWidget {
@PlugFox
PlugFox / main.dart
Created October 6, 2024 12:08
Padded date
import 'package:meta/meta.dart';
void main() {
final now = DateTime.now();
print(now.toIso8601String());
print(Date.from(now).toIso8601String());
print((Date.from(now) as DateTime).toIso8601String());
}
extension type Date.from(DateTime _dt) implements DateTime {
@PlugFox
PlugFox / main.dart
Last active October 29, 2024 08:32
Custom layout with Flutter
/*
* Custom layout with Flutter
* https://gist.github.com/PlugFox/8dbafc696927ab7111d03250cc01b712
* https://dartpad.dev?id=8dbafc696927ab7111d03250cc01b712
* Mike Matiunin <[email protected]>, 22 September 2024
*/
import 'dart:math' as math;
import 'package:flutter/material.dart';
@PlugFox
PlugFox / main.dart
Last active August 27, 2024 14:40
Behavior distinct
/*
* Behavior distinct
* https://gist.github.com/PlugFox/d2afc6bd33c138e9ef0e6c74f405c779
* https://dartpad.dev?id=d2afc6bd33c138e9ef0e6c74f405c779
* Mike Matiunin <[email protected]>, 27 August 2024
*/
// ignore_for_file: avoid_print
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:math' as math;
class CustomLayout extends MultiChildRenderObjectWidget {
CustomLayout({
Key key,
List<Widget> children = const <Widget>[],
}) : super(key: key, children: children);