Skip to content

Instantly share code, notes, and snippets.

View pszklarska's full-sized avatar
🏠
Working from home

Paulina Szklarska pszklarska

🏠
Working from home
View GitHub Profile
@pszklarska
pszklarska / intellij-template.dart
Created July 5, 2021 09:14
Flutter Redux User Snippet for IntelliJ IDEA
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux/redux.dart';
class $NAME$Page extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StoreConnector<$END$AppState, $NAME$ViewModel>(
converter: (store) => $NAME$ViewModel(store),
builder: (context, viewModel) => _$NAME$Page(viewModel),
@pszklarska
pszklarska / dart.json
Last active July 5, 2021 09:07
Flutter Redux User Snippet for VSC
{
"Create new Page with Redux template": {
"prefix": "redux",
"body": [
"import 'package:flutter/material.dart';",
"import 'package:flutter_redux/flutter_redux.dart';",
"import 'package:redux/redux.dart';",
"class ${1:name}Page extends StatelessWidget {",
" @override",
" Widget build(BuildContext context) {",
@pszklarska
pszklarska / adaptable_row.dart
Last active November 27, 2023 13:56
Flutter Adaptable layout
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(body: AdaptableRow()),
@pszklarska
pszklarska / main.dart
Created January 2, 2021 00:00
Flutter Testing - Given-When-Then Example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Home(user: User()),
package pl.pszklarska.leakexample;
public class RxJavaLeakActivity extends AppCompatActivity {
private Subscription pokemonSubscription;
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
package pl.pszklarska.leakexample;
public class SensorManagerLeakActivity extends AppCompatActivity implements SensorEventListener {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
Sensor lightSensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
package pl.pszklarska.leakexample;
public class AnonymousClassLeakActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new AsyncTask<Void, Void, Void>() {
@Override
package pl.pszklarska.leakexample;
public class InnerClassLeakActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
InnerClass innerClassInstance = new InnerClass();
innerClassInstance.showToast();
package pl.pszklarska.leakexample;
import android.content.Context;
import android.widget.Toast;
public class StaticContextLeak {
private static Context context;
public void setContext(final Context context) {
@pszklarska
pszklarska / DependentObservables.java
Created March 22, 2017 08:23
RxJava example for combining two dependent Observables
Observable<CatWithToys> catWithToysObservable =
getCatObservable()
.flatMap((cat) -> getToysForCatObservable(cat),
(cat, toys) -> new CatWithToys(cat, toys));