Skip to content

Instantly share code, notes, and snippets.

@bcse
bcse / 2026-03-07-transparent-embedded-flutter-view.md
Created March 6, 2026 20:08
Making a Transparent Embedded FlutterView Pass Touches Through on iOS

Making a Transparent Embedded FlutterView Pass Touches Through on iOS

When you embed Flutter into an existing iOS app, one common pattern is to place a FlutterViewController on top of native UIKit content as an overlay. Visually, this is straightforward: make the Flutter view transparent and render only the pieces of UI you want to show.

The tricky part is touch handling.

Even when the Flutter overlay is visually transparent, it still sits on top of the native view hierarchy. That means touches inside the overlay’s frame are usually captured by the Flutter view instead of reaching the UIViews underneath. If your design expects native controls below the transparent parts of Flutter to remain tappable, visual transparency alone is not enough.

This post explains the problem, the recommended solution, and a sample implementation for both iOS and Flutter.

@bcse
bcse / gist:3fd23b5d3daaf12c7e99b7b260dd250f
Last active December 3, 2020 15:58
jq - VoTT JSON to CreateML JSON
jq '[.assets[] | { image: .asset.name, annotations: [.regions[] | { label: .tags[0], coordinates: .boundingBox | { x: .left | round, y: .top | round, width: .width | round, height: .height | round } }] }]'
@bcse
bcse / MyMenu.swift
Last active May 25, 2018 07:01
Generics class with delegate
import Foundation
import UIKit
public protocol MenuItem {}
public protocol MenuDelegate: AnyObject {
associatedtype Item: MenuItem
func menu(_ menu: Menu<Item, Self>, didSelect item: Item)
}
@bcse
bcse / main.m
Created September 27, 2017 03:56
[GCD] Use semaphore as lock
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
dispatch_semaphore_t lock = dispatch_semaphore_create(0);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
NSLog(@"unlock");
dispatch_semaphore_signal(lock);
});
@bcse
bcse / app.yaml
Created August 28, 2015 06:59
Debian repository on Google App Engine
application: altcanvas-repo
version: 1
runtime: python
api_version: 1
handlers:
- url: .*
script: debrepo.py
@bcse
bcse / .clang-format
Created March 21, 2014 03:46
My ClangFormat configuration
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignTrailingComments: false
ColumnLimit: 0
NamespaceIndentation: Inner
ObjCSpaceAfterProperty: true
IndentWidth: 4
BreakBeforeBraces: Stroustrup
@bcse
bcse / README.md
Last active December 25, 2015 21:59
Python OrderedSet

OrderedSet is a set-like class that also keeps inserting order like list.

Here are some test results compared with ABC-based OrderedSet:

Boost::MultiIndex-based
  My OrderedSet ABC-based
@bcse
bcse / README.md
Last active December 24, 2015 05:19
iTunes Festival London 2014 Download Link Generator

Usage

  1. Execute iftgen.py
  2. Insert artist name, e.g. 5 Seconds of Summer
  3. 5 Seconds of Summer.txt and 5 Seconds of Summer.ac3.txt will be generated
  4. Download video from 5 Seconds of Summer.txt and combine them with cat *.ts > combined.ts
  5. (Optional) If you want to download 5.1 channel AC-3 audio as well. Download them from 5 Seconds of Summer.ac3.txt and combine them with cat *.ac3 &gt; combined.ac3
@bcse
bcse / UnitBezier.py
Last active December 23, 2015 21:29
Python port of WebKit bezier solver
# Copyright (C) 2008 Apple Inc. All Rights Reserved.
# Copyright (C) 2013 Grey Lee. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
@bcse
bcse / genpot.py
Last active December 21, 2015 19:58
Generate plexconnect.pot
#!/usr/bin/env python
import datetime
import glob
import os
import re
import sys
def main(base_path):
msgid = set()