Skip to content

Instantly share code, notes, and snippets.

View justinmc's full-sized avatar

Justin McCandless justinmc

View GitHub Profile
@justinmc
justinmc / main.dart
Last active April 7, 2023 18:50
Futile attempts at listening to all types of route changes of a Navigator.
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This sample demonstrates using CanPopScope to get the correct behavior from
// system back gestures when there are nested Navigator widgets.
import 'package:flutter/material.dart';
final RouteObserver<ModalRoute<void>> routeObserver = RouteObserver<ModalRoute<void>>();
@justinmc
justinmc / main.dart
Created March 30, 2023 16:14
Shows the height of a TextField with maxLines
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
@justinmc
justinmc / lsp.log
Created March 9, 2023 00:17
nvim-lspconfig bug report log file
[START][2022-12-16 13:13:28] LSP logging initiated
[START][2022-12-16 13:22:50] LSP logging initiated
[START][2022-12-16 13:26:15] LSP logging initiated
[START][2022-12-20 10:51:50] LSP logging initiated
[START][2022-12-20 10:53:47] LSP logging initiated
[START][2022-12-20 10:57:09] LSP logging initiated
[START][2022-12-20 10:58:52] LSP logging initiated
[START][2022-12-20 10:59:12] LSP logging initiated
[START][2023-03-08 15:42:52] LSP logging initiated
[ERROR][2023-03-08 15:42:52] .../vim/lsp/rpc.lua:420 "rpc" "/usr/local/google/home/jmccandless/Projects/flutter/bin/dart" "stderr" "Building flutter tool...\n"
@justinmc
justinmc / main.dart
Created December 6, 2022 18:59
Flutter Forward 2023: An example of adapting to window size using MediaQuery.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@justinmc
justinmc / main.dart
Created December 6, 2022 18:00
Flutter Forward 2023: Example of adding a custom button to a TextField's context menu on all platforms.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@justinmc
justinmc / main.dart
Created December 5, 2022 23:39
Flutter Forward 2023: Example of handling light mode and dark mode in Material.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@justinmc
justinmc / main.dart
Created December 5, 2022 23:34
Flutter Forward 2023: Example of handling light mode and dark mode in Cupertino.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart' show Icons;
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@justinmc
justinmc / main.dart
Created November 29, 2022 18:04
A variation of my formfield key example (https://dartpad.dartlang.org/?id=f626ef5b3b000c019f3228360d0c878a) with a custom input
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({
super.key,
});
@override
@justinmc
justinmc / main.dart
Last active November 21, 2022 21:55
A form whose submit button is disabled until the form is valid, and each field validates onUserInteraction.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({
super.key,
});
@override
@justinmc
justinmc / main.dart
Created August 22, 2022 20:30
A super simple starting point for a Flutter app.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override