Skip to content

Instantly share code, notes, and snippets.

View rydmike's full-sized avatar

Rydmike rydmike

View GitHub Profile
@rydmike
rydmike / main.dart
Last active June 2, 2021 13:07
A Flutter long press context menu. Wrap a child with LongPressPopupMenu and it pops up at press location with its PopupMenuItem:s
// BSD 3-Clause License
//
// Copyright (c) 2021, Mike Rydstrom (Rydmike)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
import 'package:flutter/material.dart';
import 'package:flex_color_scheme/flex_color_scheme.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@rydmike
rydmike / if_wrapper.dart
Created January 9, 2021 23:46
Flutter: A builder that if the [condition] is true, will run its builder and the child will be wrapped by the builder, if false it just returns the child.
import 'package:flutter/material.dart';
/// Type definition for a builder function used by IfWrapper.
typedef IfWrapBuilder = Widget Function(BuildContext context, Widget child);
/// A builder that if the [condition] is true, will run its builder and the
/// child will be wrapped by the builder, if false it just returns the child.
///
/// A convenient way to wrap a widget with another widget, but only if
/// the condition is true. It can save you from having to define a large widget,
@rydmike
rydmike / main.dart
Created January 2, 2021 11:17
Example for FlexColorPicker issue [#1](https://github.com/rydmike/flex_color_picker/issues/1)
import 'package:flutter/material.dart';
import 'package:flex_color_picker/flex_color_picker.dart';
void main() => runApp(const ColorPickerDemo());
class ColorPickerDemo extends StatefulWidget {
const ColorPickerDemo({Key key}) : super(key: key);
@override
_ColorPickerDemoState createState() => _ColorPickerDemoState();
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
const String demoTooltip = 'Share the selected files and folders\n'
'with other people on the network.';
// const String demoTooltip = 'Tooltip message ijklmnop ABC 123';
class MyApp extends StatefulWidget {
@override
@rydmike
rydmike / main.dart
Created November 24, 2020 12:37
Tooltip size test - For testing legibility of different sizes on different platforms
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@rydmike
rydmike / main.dart
Created November 20, 2020 14:22
Playground to demonstrate Plasma Issue in Simple animation and Liquid Studio
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@rydmike
rydmike / main.dart
Last active November 4, 2020 21:14
Sample code for Flutter issue https://github.com/flutter/flutter/issues/48099
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
debugShowCheckedModeBanner: false,
home: MyHomePage(),
);
@rydmike
rydmike / main.dart
Created October 20, 2020 13:14
A const widget example/demo....
// MIT License
// Copyright 2020 Mike Rydstrom
//
// 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:
//
@rydmike
rydmike / main.dart
Last active March 30, 2021 08:15
Flutter CanvasKit Random Crash (https://github.com/flutter/flutter/issues/67949)
// MIT License
// Copyright 2020 Mike Rydstrom
//
// 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:
//