Skip to content

Instantly share code, notes, and snippets.

View KDCinfo's full-sized avatar
💭
Flutter Developer | Contra Costa Co. CA

Keith D Commiskey KDCinfo

💭
Flutter Developer | Contra Costa Co. CA
View GitHub Profile
@KDCinfo
KDCinfo / tic_tac_tuples_bot_play.dart
Last active June 3, 2024 23:57
Working on a `botPlay` for Tic Tac Tuples.
/// Open source multi-player dynamic (3-5) grid tic-tac-toe
/// https://github.com/KDCinfo/dev-play/tree/main/tictactoe
/// This is a **Work In Progress**
/// Just wanted to capture a snapshot of it.
/// Update 2024-06-02:
/// - Extracted out `runBotPlay` as a static method into its own abstract class.
/// - Only 'Rows' is done (albeit untested yet)
/// Update 2024-06-03:
@KDCinfo
KDCinfo / main.dart
Last active March 21, 2024 10:55
iOS Unusual App Crashing - Flutter 3.21
import 'dart:developer';
import 'package:flutter/material.dart';
/// To recreate:
///
/// 1. Using any Flutter version merged after Mar 7, 2024, (e.g. v3.21),
/// build and run the provided code example on an iOS device or simulator.
/// 2. Tap the title in the AppBar.
///
@KDCinfo
KDCinfo / main.dart
Last active October 16, 2023 07:51
Flutter - GoRouter - themeMode
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
/// Update: Swapped out bloc with provider.
void main() {
runApp(const MainApp());
}
@KDCinfo
KDCinfo / data.dart
Created June 21, 2023 05:47
Files from Dart's codelab: Dive into Dart 3's OO Language Enhancements including patterns, records, enhanced switch and case, and sealed classes.
import 'dart:convert';
/// In this codelab, you simplify that more-realistic use case by
/// mocking incoming JSON data with a multi-line string in the documentJson variable.
///
/// https://codelabs.developers.google.com/codelabs/dart-patterns-records#5
///
class Document {
final Map<String, Object?> _json;
Document() : _json = jsonDecode(documentJson);
@KDCinfo
KDCinfo / dart_null_safe_map_key.dart
Created September 16, 2021 06:47
Dart (/Flutter): A null safe approach to convert a dynamic List inside a Map into a List of Strings.
void main() {
/// I got the below working as a null safe approach used to
/// convert a `dynamic` List inside a Map, such as one received
/// and json.decoded from an API endpoint, into a List of `String`s.
///
/// If anyone knows if anything is incorrect or can be done better, please comment.
/// Always looking to learn proper methodologies and better approaches.
/// Two scenarios: A key exists in a Map, or it doesn't (is null).
///
@KDCinfo
KDCinfo / main.dart
Last active May 2, 2021 09:07
Find differences between two Lists with Dart | Flutter
///
/// Find differences between two Lists with Dart | Flutter
///
/// DartPad: https://dartpad.dev/3b4d345e76d8c7dd3f0f571bdefcdfdb
///
void main() {
List<double> _current = [1, 2, 3, 4, 7]; // [1,2,3,4, 7]
List<double> _new = [3, 5, 6, 7, 9, 10]; // [ 3, 5,6,7,9,10]
@KDCinfo
KDCinfo / flutter_dragtarget_hover.dart
Created January 28, 2021 20:46
Flutter: Draggable and DragTarget Annotated
import 'package:flutter/material.dart';
/// Inspiration for how the DragTarget hovering works goes to:
/// Stack Overflow A: https://stackoverflow.com/a/53981607/638153
/// Stack Overflow Q: https://stackoverflow.com/questions/53979586/flutter-dragtarget-on-hover
final Color darkBlue = Color.fromARGB(255, 18, 32, 45);
void main() {
runApp(MyApp());
@KDCinfo
KDCinfo / provider_scope_test.dart
Last active December 4, 2020 07:33
Flutter Provider Scope for NotifyListeners() - The following code shows that Provider only listens on its own ChangeNotifier updates.
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
void main() { runApp(MaterialApp(home: TestScreen())); }
class TestScreen extends StatelessWidget {
///
/// Flutter Provider Scope for NotifyListeners()
///
/// The following code shows that Provider only listens on its own ChangeNotifier updates.
.expander {
display: flex;
}
.expander__container {
width: 100%;
}
.expander__content {
position: relative;
transition: all .3s ease;
max-height: 0;
@KDCinfo
KDCinfo / README.md
Last active August 2, 2019 15:04
Simple Automated Tooltips for Form Input Fields

Automated Tooltips for Form Input Fields

Tooltip auto-generated content is based on input placeholder content.

Source HTML

<input type='text' placeholder='Welcome home, World!'>

Expected/Generated HTML