Skip to content

Instantly share code, notes, and snippets.

View leshchenko's full-sized avatar

Ruslan Leshchenko leshchenko

  • Ukraine, Cherkassy
View GitHub Profile
@b-cancel
b-cancel / main.dart
Last active November 29, 2021 19:41
FLUTTER => Overriding Back Button in Flutter
import 'package:flutter/material.dart';
import 'dart:async';
void main() => runApp(new BackButtonOverrideDemoWidget());
class BackButtonOverrideDemoWidget extends StatefulWidget{
@override
_BackButtonOverrideDemoWidgetState createState() => new _BackButtonOverrideDemoWidgetState();
}
@AliSoftware
AliSoftware / morphing.swift
Created August 3, 2017 13:07
A simple demo of doing some morphing using CAShapeLayer & UIBezierPath
import UIKit
import PlaygroundSupport
// Create a view to display the result in playground
let view = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 500))
view.backgroundColor = .white
PlaygroundPage.current.liveView = view;
@fvilarino
fvilarino / circular_list_step_08.kt
Last active September 28, 2022 08:43
Circular List Step 08
data class CircularListConfig(
val contentHeight: Float = 0f,
val numItems: Int = 0,
val visibleItems: Int = 0,
val circularFraction: Float = 1f,
val overshootItems: Int = 0,
)
@Stable
interface CircularListState {
@deva666
deva666 / main.dart
Last active October 4, 2023 05:45
Flutter OverlayEntry example
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@pbprateek
pbprateek / ComposeScopedViewModelProvider.kt
Last active October 23, 2023 10:53
Viewmodel Scoped to Compose
import android.os.Bundle
import androidx.compose.runtime.Composable
import androidx.compose.runtime.RememberObserver
import androidx.compose.runtime.remember
import androidx.lifecycle.*
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.MutableCreationExtras
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import androidx.lifecycle.viewmodel.compose.viewModel
@tonyawino
tonyawino / MainActivity.kt
Created February 26, 2023 11:59
Popup with Custom Animation in Jetpack Compose
package com.example.popupsample
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.background
@fahied
fahied / MyWKWebVC.Swift
Created January 10, 2017 06:46
WKWebView controller example with progress bar
//
// MyWKWebVC.Swift
// Example
//
// Created by Fahied on 04/01/2017.
//
import Foundation
import UIKit
import WebKit
import androidx.compose.animation.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.window.Popup
@Composable
fun AniJinPopup(
expanded: Boolean,
@danielbierwirth
danielbierwirth / TCPTestClient.cs
Last active April 5, 2024 21:57
TCP Client-Server Connection Example | Unity | C# | Bidirectional communication sample: Client can connect to server; Client can send and receive messages: Server accepts clients; Server reads client messages; Server sends messages to client
// This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/
// or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using UnityEngine;
@inidamleader
inidamleader / AutoSizeText.kt
Last active April 15, 2024 20:36
Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm
// LAST UPDATE: 10 April 2024 v4.3:
// - Correction of updated density value in AutoSizeText function
package com.inidamleader.ovtracker.util.compose
import android.util.Log
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.InternalFoundationTextApi