Skip to content

Instantly share code, notes, and snippets.

@andyduke
andyduke / main.dart
Created February 20, 2024 19:45
Flutter: ButtonsGroup
import 'package:flutter/material.dart';
// ---
typedef ButtonWidgetBuilder<T> = Widget Function(BuildContext context, T value, VoidCallback? onPressed);
typedef ButtonsGroupLayoutWidgetBuilder<T> = Widget Function(BuildContext context, T value);
class ButtonsGroup<T> extends StatelessWidget {
final List<T> values;
final ButtonWidgetBuilder<T> buttonBuilder;
@andyduke
andyduke / main.dart
Last active October 10, 2023 08:08
Flutter: InheritedSettings concept
import 'package:flutter/material.dart';
import 'package:collection/collection.dart';
abstract interface class InheritedSettingsData {}
class InheritedSettings extends InheritedWidget {
final List<InheritedSettingsData> settings;
const InheritedSettings({

Flutter install without android studio

set flutter

Download flutter

tar xvf flutter_linux_1.17.5-stable.tar.xz

@andyduke
andyduke / github_quick_setup.md
Last active April 23, 2022 09:39 — forked from loretoparisi/github_quick_setup.md
Github Quick setup — if you’ve done this kind of thing before

Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line

git init
git add README.md
git commit -m "first commit"
git branch -M master
git remote add origin https://github.com/<path_to_repo>.git
git push -u origin master
@andyduke
andyduke / main.dart
Last active September 10, 2021 10:02
Flutter Multi-line text overflow
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@andyduke
andyduke / main.dart
Created March 10, 2021 08:37
SnackBar demo
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@andyduke
andyduke / main.dart
Created February 21, 2021 18:37
Wrap Fluid prototype 1
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class FluidBox extends ConstrainedBox {
FluidBox({
Key key,
@required BoxConstraints constraints,
Widget child,
}) : super(
@andyduke
andyduke / main.dart
Last active February 8, 2021 11:05
Dart DynamicValue prototype
enum DynamicValueType { isMap, isList, isString, isNum, isBool, isNull, unknown }
class DynamicValue {
final dynamic value;
DynamicValueType _type;
DynamicValueType get type {
if (_type == null) {
_type = DynamicValueType.unknown;
@andyduke
andyduke / main.dart
Created January 31, 2021 00:00
FutureData concept 2
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
@andyduke
andyduke / main.dart
Last active December 13, 2020 23:49
Flutter: Custom TextStyle
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/diagnostics.dart';
import 'dart:ui' as ui show TextStyle;
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
class CustomStyle with Diagnosticable implements TextStyle {