Skip to content

Instantly share code, notes, and snippets.

@atreeon
atreeon / main.dart
Created June 4, 2024 15:19
BlocProvider placement efficiency
// ignore_for_file: unused_field
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
void main() {
CounterRepo_Sing().init(0);
runApp(const MyApp());
@atreeon
atreeon / typedefTypes.dart
Last active May 14, 2024 12:16
Typedef types
/*
An easy way to create a new type in Dart is using typedef.
The type is of course a named record so the underlining type would match any record where the property types are named the same.
*/
typedef BarAndSpaceWidth = ({int barWidth, int spaceWidth});
BarAndSpaceWidth getBarAndSpaceWidth() {
var blah = (barWidth: 10, spaceWidth: 20);
return blah;
@atreeon
atreeon / main.dart
Last active February 21, 2024 13:16
DropdownButton - padding size between items
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@atreeon
atreeon / main.dart
Last active January 10, 2023 10:32
PaginatedDataTable behaviour vs DataTable behaviour
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
@atreeon
atreeon / main.dart
Created November 29, 2022 17:00
Flutter TextFormField event examples
// ignore_for_file: annotate_overrides
// ignore_for_file: prefer_const_constructors
// ignore_for_file: prefer_const_literals_to_create_immutables
// ignore_for_file: unused_local_variable
// ignore_for_file: library_private_types_in_public_api
// ignore_for_file: unused_field
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
@atreeon
atreeon / main.dart
Last active November 29, 2022 16:48
Flutter TextField events
// ignore_for_file: annotate_overrides
// ignore_for_file: prefer_const_constructors
// ignore_for_file: prefer_const_literals_to_create_immutables
// ignore_for_file: unused_local_variable
// ignore_for_file: library_private_types_in_public_api
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);

Where - restrict by single item

employees?and=(employee_id.gt.2)

select * from employees e where employee_id > 2

Where - restrict by multiple criteria

employees?or=(employee_id.eq.3,employee_id.eq.5,employee_id.eq.7)&and=(employee_id.gt.4)

@atreeon
atreeon / gist:fef93fa9f269390f79c854c78383cf42
Created February 4, 2021 13:06
analyzer for all darts
analyzer:
linter:
rules:
prefer_single_quotes: true
curly_braces_in_flow_control_structures: false
function slx {
echo "...stopping any backups, closing any programmes known to cause issues"
tmutil stopbackup
pkill -x qemu-system-i386
pkill -x qemu-system-x86_64
pkill -x Music
pkill -x VLC
echo "...turning off bluetooth & ejecting external drive"
blueutil --power 0
# updateFlutterVersion 1.23456
function updateFlutterVersion {
cd $HOME/installs/flutter
CURRENTVERSION=$(git describe --tags)
if [ "${CURRENTVERSION}" == "$1" ]; then
echo "it looks like you're already on that branch"
echo "not changing version"
say 'failed'