Skip to content

Instantly share code, notes, and snippets.

View logickoder's full-sized avatar
😶‍🌫️
Doing what needs to be done

Jeffery Orazulike logickoder

😶‍🌫️
Doing what needs to be done
View GitHub Profile
@logickoder
logickoder / ViewTreeAnalyser.kt
Created May 18, 2025 06:59
Unified View Tree Analyser for Android (Views and Compose)
import android.content.Context
import android.util.Log
import android.view.View
import android.view.ViewGroup
import androidx.compose.ui.semantics.SemanticsNode
import androidx.compose.ui.semantics.SemanticsOwner
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.compose.ui.semantics.SemanticsPropertyKey
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
import androidx.compose.ui.semantics.getOrNull
@logickoder
logickoder / message_controller.dart
Created April 1, 2025 16:02
Simple flutter websocket controller with riverpod
import 'dart:async';
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
import '../../../config/app_config.dart';
@logickoder
logickoder / ComposePdfExporter.kt
Created January 1, 2025 16:22
Export a scrollable composable to PDF
package dev.logickoder.printer
import android.app.Dialog
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Rect
import android.graphics.pdf.PdfDocument
import android.view.View
import androidx.compose.foundation.gestures.scrollBy
@logickoder
logickoder / DeviceRestartChecker.kt
Created December 10, 2024 06:01
Check if an android device restarted without depending on BOOT_COMPLETED
object DeviceRestartChecker {
private const val PREFS_NAME = "device_restart_prefs"
private const val KEY_LAST_UPTIME = "last_uptime"
operator fun invoke(context: Context): Boolean {
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
val savedUptime = prefs.getLong(KEY_LAST_UPTIME, 0L)
val currentUptime = SystemClock.uptimeMillis()
return if (currentUptime < savedUptime) {
@logickoder
logickoder / build-production.yml
Last active November 19, 2024 13:56
My Flutter CI/CD Workflow
# From .github/workflows/build-production.yml
name: Build and upload android app to Google Play Store
on:
push:
branches:
- main
paths:
- 'android/**'
@logickoder
logickoder / multi_progress_indicator.dart
Created November 4, 2024 06:58
Multi Progress Indicator
import 'package:flutter/material.dart';
/// A progress indicator that is divided into sections, each section represents a part of the total progress
/// The current position of the progress indicator is represented by the [current] property
/// The [sections] property represents the sections of the progress indicator
/// The length of the [sections] list represents the total number of sections
class MultiProgressIndicator extends StatelessWidget {
/// The current position of the progress indicator in relation to the sections
final int current;
@logickoder
logickoder / ChatBubbleShape.kt
Created October 23, 2024 14:50
ChatBubbleShape
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@logickoder
logickoder / ChartView.kt
Created September 29, 2024 16:44
Compose Hour Bar Chart
package dev.logickoder.compose.chart
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@logickoder
logickoder / curved_overlay_screen.dart
Created April 22, 2024 14:34
Curved Overlay Screen
import 'package:flutter/material.dart';
class CurvedOverlayScreen extends StatelessWidget {
const CurvedOverlayScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: LayoutBuilder(builder: (_, constraints) {
return Stack(
@logickoder
logickoder / comparing-rest-soap-graphql.csv
Created August 11, 2023 05:53
Comparing REST, SOAP, and GraphQL, and understanding their messaging formats.
Feature REST SOAP GraphQL
Data format Flexible (JSON, XML, etc.) Primarily XML JSON
Message structure No predefined pattern Envelope encompassing header and body Query employing fields
Message size Variable based on data Generally larger due to XML verbosity and envelope Compact due to query specificity
Message complexity Simplicity to moderate based on resource design Moderate to high due to XML syntax and RPC semantics Simple to high depending on query depth
Message validation Lack of standardized validation method XML Schema Definition (XSD) for validation Schema for query and response validation