Skip to content

Instantly share code, notes, and snippets.

View kitsuniru's full-sized avatar
🥗
Fluttering..

Archie Kitsuniru kitsuniru

🥗
Fluttering..
View GitHub Profile
@kitsuniru
kitsuniru / main.dart
Created July 8, 2024 13:03
layout widget switching problem
// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
@kitsuniru
kitsuniru / main.dart
Last active November 21, 2023 15:24
dart3 instead of if else if else
void main() {
const x = 8;
const y = SomeLongEnum.veryVeryVeryLongEnumValue;
// instead of this unreadable bullshit
int runTest(int taxiStationId) {
if (y == SomeLongEnum.veryVeryVeryLongEnumValue &&
taxiStationId % 3 == 0 &&
taxiStationId % 3 == 0 &&
y == SomeLongEnum.veryVeryVeryLongEnumValue &&
@kitsuniru
kitsuniru / main.dart
Last active September 18, 2023 16:50
'closure_1 as closure_2' problem
import 'dart:isolate';
void main() async {
final toMainIsolate = ReceivePort();
final stream = toMainIsolate.asBroadcastStream();
// Isolate
final isolate = await Isolate.spawn(isolateWorker, toMainIsolate.sendPort);
final SendPort sendPort = await stream.first;
@kitsuniru
kitsuniru / example_route.dart
Last active July 3, 2023 19:15
Animate system chrome (StatusBar & NavBar) during animating between routes
import 'package:flutter/material.dart';
import 'system_chrome_animation.dart';
class AnimatedMaterialRoute<T> extends MaterialPageRoute<T> with SystemChromeAnimationMixin {
AnimatedMaterialRoute({required super.builder, required this.originColor, required this.targetColor});
@override
final Color originColor;
@kitsuniru
kitsuniru / main.dart
Last active July 2, 2023 22:01
Memory leak demo via ListView without count + FadeTransition
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@kitsuniru
kitsuniru / extensions.cmd
Last active February 25, 2023 17:32
All my current extensions, will be updated on change
codium --install-extension adpyke.codesnap
codium --install-extension CoenraadS.bracket-pair-colorizer-2
codium --install-extension DaltonMenezes.aura-theme
codium --install-extension Dart-Code.dart-code
codium --install-extension Dart-Code.flutter
codium --install-extension equinusocio.vsc-material-theme-icons
codium --install-extension fwcd.kotlin
codium --install-extension gaetschwartz.build-runner
codium --install-extension golang.go
codium --install-extension hirantha.json-to-dart
@kitsuniru
kitsuniru / settings.json
Created August 21, 2022 22:41
Personal settings for VSCode [Dart development]
{
"dart.lineLength": 80,
"[dart]": {
"editor.rulers": [
80
],
},
"dart.additionalAnalyzerFileExtensions": [
"drift"
],
@kitsuniru
kitsuniru / aura-color-theme.json
Last active August 21, 2022 22:35
Aura Theme, modified and adapted by me
{
"name": "Aura Dark",
"type": "dark",
"colors": {
"focusBorder": "#a394f033",
"foreground": "#edecee",
"errorForeground": "#ff6767",
"widget.shadow": "#0f0f0f",
// "selection.background": "#3d375e7f",
"selection.background": "#6b657a94",