Skip to content

Instantly share code, notes, and snippets.

View KrzysztofLen's full-sized avatar
:octocat:
https://www.fun4code.com/

Krzysztof Len KrzysztofLen

:octocat:
https://www.fun4code.com/
View GitHub Profile
@KrzysztofLen
KrzysztofLen / main.dart
Created November 23, 2023 07:11
#10FlutterChallenges — Part 4: Filtering List by Matching IDs
class User {
int id;
String name;
User({required this.id, required this.name});
}
List<User> usersList = [
User(id: 1, name: "John"),
User(id: 2, name: "Alex"),
@KrzysztofLen
KrzysztofLen / useRequest.ts
Last active May 24, 2022 20:14
useRequest hook for handling Http calls
import { useState } from "react";
import axios, { AxiosError, AxiosRequestConfig } from "axios";
import React from "react";
interface Props {
url: string;
method: "post" | "put" | "get" | "delete";
body: AxiosRequestConfig<unknown> | undefined;
onSuccess: (data: unknown) => void;
}
@KrzysztofLen
KrzysztofLen / audio_service.dart
Last active March 19, 2022 07:57
This is the source code of the Flutter Challenges series post: https://fun4code.com/10flutterchallanges-part3/
import 'package:audioplayers/audioplayers.dart';
abstract class AudioService {
static AudioCache audioCache = AudioCache();
static AudioPlayer audioPlayer = AudioPlayer(
playerId: 'my_unique_playerId',
mode: PlayerMode.LOW_LATENCY,
);
static void play(String filename) async {
@KrzysztofLen
KrzysztofLen / main.dart
Created January 23, 2022 09:47
This is the source code of the Flutter Challenges series post: https://fun4code.com/10flutterchallanges-part2/
import 'package:flutter/material.dart';
import 'package:samples/switch_button/switch_button.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
@KrzysztofLen
KrzysztofLen / candy_cane_progress_bar.dart
Last active December 3, 2022 11:27
This is the source code of the Flutter Challenges series post: https://fun4code.com/10flutterchallanges-part1/
class CandyCaneProgressBar extends StatelessWidget {
const CandyCaneProgressBar({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 20,
@KrzysztofLen
KrzysztofLen / main.dart
Last active December 24, 2021 13:51
This is the source code of the tutorial post: https://fun4code.com/custom-flutter-bar-chart/
import 'package:flutter/material.dart';
import 'package:samples/progress_bar/progress_bar.dart';
import 'package:samples/withcher_chart/witcher_chart.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.