{"id":31370092,"url":"https://github.com/irineu333/nil","last_synced_at":"2025-09-27T18:46:48.082Z","repository":{"id":299157614,"uuid":"1001803253","full_name":"Irineu333/Nil","owner":"Irineu333","description":"Compose Multiplatform image loader library","archived":false,"fork":false,"pushed_at":"2025-09-27T01:58:45.000Z","size":2364,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T03:29:37.337Z","etag":null,"topics":["compose-multiplatform","image-loading","kotlin-multiplatform"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Irineu333.png","metadata":{"files":{"readme":"README-pt.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-14T04:11:03.000Z","updated_at":"2025-09-20T03:44:53.000Z","dependencies_parsed_at":"2025-06-15T02:37:17.485Z","dependency_job_id":"f04e9679-da5a-417f-a6d7-604679a73bec","html_url":"https://github.com/Irineu333/Nil","commit_stats":null,"previous_names":["irineu333/imageloader-poc","irineu333/nil"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Irineu333/Nil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Irineu333%2FNil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Irineu333%2FNil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Irineu333%2FNil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Irineu333%2FNil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Irineu333","download_url":"https://codeload.github.com/Irineu333/Nil/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Irineu333%2FNil/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277275901,"owners_count":25791106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compose-multiplatform","image-loading","kotlin-multiplatform"],"created_at":"2025-09-27T18:46:46.247Z","updated_at":"2025-09-27T18:46:48.075Z","avatar_url":"https://github.com/Irineu333.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nil\n\nUma biblioteca de carregamento de imagens para **Compose Multiplatform**.\n\n## Início rápido\n\nImporte o módulo **core**, um **fetcher** e um **decodificador**.\n\n```kotlin\nimplementation(\"com.neoutils.nil:core:0.1.0-alpha05\")\nimplementation(\"com.neoutils.nil:bitmap-decoder:0.1.0-alpha05\")\nimplementation(\"com.neoutils.nil:network-fetcher-default:0.1.0-alpha05\")\n```\n\nUtilize `asyncPainterResource` para carregar uma imagem de forma assíncrona.\n\n```kotlin\nImage(\n    painter = asyncPainterResource(\n        Request.network(\"https://cataas.com/cat\")\n    ),\n    contentDescription = null,\n)\n```\n\n## Cache\n\nAdicione as dependencias das funcionalidades de cache desejadas.\n\n```kotlin\nimplementation(\"com.neoutils.nil:memory-cache:0.1.0-alpha05\")\nimplementation(\"com.neoutils.nil:disk-cache:0.1.0-alpha05\")\n```\n\nUtilize as extensões `diskCache` e `memoryCache` para configurar.\n\n``` kotlin\nImage(\n    painter = asyncPainterResource(...) {\n        diskCache {\n            maxSize = 10.mb\n            ...\n        }\n    },\n    contentDescription = null,\n)\n```\n\n## Suporte a GIF\n\nPara suporte a imagens animadas como **Gif** e **WebP**, adicione a dependencia do `GifDecoder`.\n\n```kotlin\nimplementation(\"com.neoutils.nil:gif-decoder:0.1.0-alpha05\")\n```\n\nE declare na configuração.\n\n```kotlin\nImage(\n    painter = asyncPainterResource(\n        Request.network(\"https://cataas.com/cat/gif\"),\n    ) {\n        decoders {\n            gif() // or +GifDecoder()\n        }\n    },\n    contentDescription = null,\n)\n```\n\nUtilize a extensão `gif` para configurar.\n\n``` kotlin\nImage(\n    painter = asyncPainterResource(...) {\n        ...\n    \n        gif {\n            repeatCount = 2\n        }\n    },\n    contentDescription = null,\n)\n```\n\n## Suporte a SVG\n\nPara suporte a imagens **SVG**, adicione a dependência do `SvgDecoder`.\n\n```kotlin\nimplementation(\"com.neoutils.nil:svg-decoder:0.1.0-alpha05\")\n```\n\nE declare na configuração.\n\n```kotlin\nImage(\n    painter = asyncPainterResource(\n        Request.network(\"https://example.com/image.svg\"),\n    ) {\n        decoders {\n            svg() // or +SvgDecoder()\n        }\n    },\n    contentDescription = null,\n)\n```\n\n## Compose Resources\n\nPara carregar imagens do **Compose Resources**, adicione a dependencia de `ResourcesFetcher`.\n\n```kotlin\nimplementation(\"com.neoutils.nil:resources-fetcher:0.1.0-alpha05\")\n```\n\nE utilize a extension `Request.resource(...)` para acionar.\n\n```kotlin\nImage(\n    painter = syncPainterResource(\n        Request.resource(Res.drawable.cute_cat),\n    ),\n    contentDescription = null,\n)\n```\n\n### Suporte a XML\n\nPara exibir icones do android, `DrawableImageVector`, adicione a dependência do `XmlDecoder`.\n\n```kotlin\nimplementation(\"com.neoutils.nil:xml-decoder:0.1.0-alpha05\")\n```\n\nE declare na configuração.\n\n```kotlin\nImage(\n    painter = syncPainterResource(\n        Request.resource(Res.drawable.vector_icon),\n    ) {\n        decoders {\n            xml() // or +XmlDecoder()\n        }\n    },\n    contentDescription = null,\n)\n```\n\n## Configurações de rede\n\nUtilize a extensão `network` para configurar o `NetworkFetcher`.\n\n``` kotlin\nImage(\n    painter = asyncPainterResource(\n        Request.network(...),\n    ) {\n        network {\n            headers = mapOf(\"Autorization\" to \"Bearer ...\")\n        }\n    },\n    contentDescription = null,\n)\n```\n\nUtilize a dependência do `network-fetcher` invés `network-fetcher-default` para especificar manualmente\no [Ktor Client](https://ktor.io/docs/client-engines.html).\n\n```kotlin\nimplementation(\"com.neoutils.nil:network-fetcher:0.1.0-alpha05\")\n```\n\nConfigure o client para cada salvo.\n\n``` kotlin\n\nkotlin {\n    sourceSets {\n        androidMain {\n            dependencies {\n                implementation(\"io.ktor:ktor-client-okhttp:3.1.0\")\n            }\n        }\n        \n        iosMain {\n            dependencies {\n                implementation(\"io.ktor:ktor-client-darwin:3.1.0\")\n            }\n        }\n        \n        jvmMain {\n            dependencies {\n                implementation(\"io.ktor:ktor-client-java:3.1.0\")\n            }\n        }\n        \n        ...\n    }\n}\n\n```\n\n## Tratamento de estados\n\nUtilize os parâmetros `placeholder` e `failure` para exibir imagens durante o carregamento ou em caso de falha.\n\n``` kotlin\nImage(\n    painter = asyncPainterResource(\n        request = Request.network(\"...\"),\n        placeholder = painterResource(Res.drawable.placeholder),\n        failure = painterResource(Res.drawable.failure),\n    ),\n    contentDescription = null,\n)\n```\n\nOu trate os estados manualmente.\n\n``` kotlin\nval resource = asyncPainterResource(\n    Request.network(\"...\"),\n)\n\nwhen (resource) {\n    is PainterResource.Result.Success -\u003e {\n        Image(\n            painter = resource,\n            contentDescription = null,\n        )\n    }\n\n    is PainterResource.Loading -\u003e {\n        if (resource.progress != null) {\n            CircularProgressIndicator(\n                progress = { resource.progress!! }\n            )\n        } else {\n            CircularProgressIndicator()\n        }\n    }\n\n    is PainterResource.Result.Failure -\u003e {\n        if (resource.throwable is ResponseException) {\n            Image(\n                painter = painterResource(Res.drawable.failure),\n                contentDescription = null,\n            )\n        } else {\n            throw resource.throwable\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firineu333%2Fnil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firineu333%2Fnil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firineu333%2Fnil/lists"}