This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="AndroidLogKotlin"> | |
<template name="logd" value="android.util.Log.d("$CLASS_NAME$", "$METHOD_NAME$ (line $LINE$): $MESSAGE$")$END$" description="Log.d statement" toReformat="false" toShortenFQNames="true"> | |
<variable name="CLASS_NAME" expression="groovyScript("if(_1.length() > 23) { return _1.substring(0, 23)} else { return _1}", kotlinClassName())" defaultValue="" alwaysStopAt="true" /> | |
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="LINE" expression="lineNumber()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="MESSAGE" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN_STATEMENT" value="true" /> | |
</context> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for multiple requests | |
let isRefreshing = false; | |
let failedQueue = []; | |
const processQueue = (error, token = null) => { | |
failedQueue.forEach(prom => { | |
if (error) { | |
prom.reject(error); | |
} else { | |
prom.resolve(token); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Absolute path of the Flutter sandbox project | |
sandbox_path="/Users/fre.dumazy/Developer/Playground/flutter_sandbox" | |
# Name of Android emulator to open. | |
# Check with `emulator -list-avds` | |
avd_name="Pixel_4_API_30" | |
main() { | |
processOptions "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return SizedBox( | |
width: 500.0, | |
child: Column( | |
children: [ | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: ['English', 'Russian', 'Spanish'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:convert'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
// This widget is the root of your application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When there are external events triggering notifyListeners() in a ChangeNotifier, | |
// how can we easily test them? Not sure if something like this `ChangeNotifierListener` below | |
// is a valid approach, or if there are easy ways to test `ChangeNotifier` in a unit test, without a widget test. | |
// Just for sake of the example | |
class MyViewModel with ChangeNotifier { | |
MyViewModel(Stream<Object> eventStream) { | |
eventStream.listen((event) { | |
_counter++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script applies Dart fixes to a project and commits the changes for each fix separately. | |
# It uses the `dart fix --dry-run` command to find the fixes that can be applied. | |
# For each fix, it applies the fix and commits the changes with a message indicating the fix code. | |
checkDart() { | |
if ! command -v dart &> /dev/null | |
then | |
echo "Dart could not be found. Please install Dart first." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:math'; | |
import 'dart:ui' as ui; | |
import 'dart:ui'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
final _scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>(); | |
void showThemedSnackBar() { | |
final messenger = _scaffoldMessengerKey.currentState!; |
OlderNewer