Skip to content

Instantly share code, notes, and snippets.

View loic-sharma's full-sized avatar
🙃

Loïc Sharma loic-sharma

🙃
View GitHub Profile
@loic-sharma
loic-sharma / main.dart
Last active December 29, 2025 19:47
Sliding square using explicit animation
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: SlidingSquarePage()));
}
class SlidingSquarePage extends StatefulWidget {
const SlidingSquarePage({super.key});
@override
@loic-sharma
loic-sharma / main.dart
Last active December 29, 2025 19:41
Sliding using RepeatingAnimationBuilder
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: SlidingSquarePage()));
}
class SlidingSquarePage extends StatelessWidget {
const SlidingSquarePage({super.key});
@override
@loic-sharma
loic-sharma / README.md
Last active December 27, 2025 21:14
Inherited value

InheritedValue

Before After
@loic-sharma
loic-sharma / main.dart
Last active December 26, 2025 18:47
Dot shorthands error on map
enum MyEnum {
value1,
value2,
}
void foo() {
// Works as expected!
final Map<MyEnum, String> myMap = <MyEnum, String>{
MyEnum.value1: 'First',
.value2: 'Second',
@loic-sharma
loic-sharma / README.md
Created December 16, 2025 20:59
APIs that use the ".of" pattern on a BuildContext
ActionIconTheme.of
Actions.of
AnimatedGrid.maybeOf
AnimatedGrid.of
AnimatedList.maybeOf
AnimatedList.of
AppBarTheme.of
AutocompleteHighlightedOption.of
AutofillGroup.maybeOf
final counter = signal(0);
final userProfile = signal({ 'name': 'Guest' });
final counterSquared = computed((context) {
final count = context.watch(counter);
return count * count;
})
final printEffect = effect((context) {
final count = context.watch(counter);
print('Counter changed to $count');
@loic-sharma
loic-sharma / README.md
Created November 21, 2025 18:01
Quantifying the demand to stop pinning the Flutter SDK's dependencies

Here is the activity on flutter/flutter#158050 in hte last 100 days (from 2025-08-13 to 2025-11-21):

Total reactions Total comments New reactions New comments
95 14 3 2

How to analyze this data yourself

  1. Install DuckDB.
@loic-sharma
loic-sharma / main.dart
Last active November 19, 2025 03:11
Style API
import 'package:flutter/material.dart';
void main() => runApp(const MyWidget());
class MyWidget extends StatelessWidget {
const MyWidget({super.key});
@override
Widget build(BuildContext context) {
return const Column(
@loic-sharma
loic-sharma / ParagraphSlide.cpp
Created October 30, 2025 18:19
Impact of letter spacing on Arabic text
class ParagraphSlide0 : public ParagraphSlide_Base {
public:
ParagraphSlide0() { fName = "Paragraph0"; }
void draw(SkCanvas* canvas) override {
canvas->drawColor(SK_ColorWHITE);
auto multiplier = 5.67;
const char* text = "English English\n\nمرحبا بالعالم";
auto fontCollection = sk_make_sp<FontCollection>();
@loic-sharma
loic-sharma / ContentView.swift
Created August 8, 2025 22:08
iOS's three finger swipe gesture to undo/redo pops the current page
import SwiftUI
/// This is the main view of the application, analogous to the `MaterialApp` and `HomePage` widgets in the Flutter example.
struct ContentView: View {
var body: some View {
NavigationStack {
VStack {
NavigationLink {
TextFieldView()
} label: {