Skip to content

Instantly share code, notes, and snippets.

Avatar

Rydmike rydmike

View GitHub Profile
@rydmike
rydmike / main.dart
Created Apr 26, 2021
Flutter experiment to better theme center text in Stadium Bordered buttons.
View main.dart
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
@rydmike
rydmike / svg_asset_image.dart
Created Mar 27, 2021
Change the main color of the color used in Undraw SVG images.
View svg_asset_image.dart
import 'dart:async' show Future;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter_svg/flutter_svg.dart';
/// Displays an SVG image provided in the applications asset bundle.
///
/// The [assetName] is the path and name of the SVG file in the asset bundle.
/// This SVG asset display widget is tuned for usage with the Undraw images
@rydmike
rydmike / main.dart
Created Mar 2, 2021
Example: One way to make a dialog bigger
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Alert',
theme: ThemeData(
@rydmike
rydmike / main.dart
Last active Feb 28, 2021
CTRL-V paste shortcut throws in Flutter Windows
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Text Edit',
@rydmike
rydmike / main.dart
Last active Apr 19, 2021
A Flutter long press context menu. Wrap a child with LongPressPopupMenu and it pops up at press location with its PopupMenuItem:s
View main.dart
// 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.
View main.dart
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 Jan 9, 2021
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.
View if_wrapper.dart
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,
View main.dart
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();
View main.dart
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 Nov 24, 2020
Tooltip size test - For testing legibility of different sizes on different platforms
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {