- Create a normal iOS App (using SwiftUI) called
SmaApp
. - Cd into
SmaApp
. - Run
pod init
andpod install
in theSmaApp
folder to setup Cocoapods (install it withbrew install cocoapods
). - Add
platform :ios, '17.0'
toPodfile
. - Add
Pods
folder to.gitignore
:echo Pods/ >.gitignore
. - Reopen the project using
open SmaApp.xcworkspace
. - Build & run to make sure everything works.
- Run
flutter --template module sma_flutter
to setup Flutter. - Go into
sma_flutter
and runflutter run
(choose iOS if asked for a device).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class MovingBorder extends StatefulWidget { | |
const MovingBorder({ | |
super.key, | |
this.duration = const Duration(seconds: 2), | |
this.borderColor, | |
this.highlightColor, | |
this.borderRadius, | |
this.child, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url=https://raw.githubusercontent.com/gunnarmorling/1brc/main/data/weather_stations.csv | |
prepare: | |
curl -s ${url} | grep -v '^#' >data2/weather.csv | |
dart run bin/prepare.dart 1_000_000 >data2/1m | |
dart run bin/prepare.dart 10_000_000 >data2/10m | |
dart run bin/prepare.dart 100_000_000 >data2/100m | |
dart run bin/prepare.dart 1_000_000_000 >data2/1g | |
clean: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// A simple incomplete WebAssembly interpreter. | |
library; | |
import 'dart:io'; | |
void main() { | |
// final bytes = File('sum.wasm').readAsBytesSync(); | |
final module = WasmModule(bytes); | |
print(module.exports); | |
print(module.invoke('add', [3, 4])); |
Wenn man einen 2D ScrollView bauen will…
Ich will eine große Hexkarte bauen. Wenn ich naiv 200x200 Hex-Felder in einem Stack anordne (weil die sich ja überlappen) und den in einen InteractiveViewer
packe, dann braucht Flutter 30 Sekunden (!) die 120.000 Widgets zu bauen.
-
Ich muss eine Unterklasse von
TwoDimensionalScrollView
erstellen, die minimal eindelegate
bekommt, der weiß, wie man Kinder baut. Dazu später mehr. Erst mal ist das alles nur boilerplate-Code:class HexMapView extends TwoDimensionalScrollView { const HexMapView({super.key, required super.delegate}) : super(diagonalDragBehavior: DiagonalDragBehavior.free);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'dart:math'; | |
import 'package:unpak/unpak.dart'; | |
void main(List<String> arguments) { | |
if (arguments.length < 2 || !<String>{'-l', '-x'}.contains(arguments[0])) { | |
stderr.writeln('usage: unpak -l <file.pak>'); | |
stderr.writeln(' unpak -x <file.pak> <index> [<output>]'); | |
exit(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:analyzer/dart/ast/ast.dart'; | |
import 'package:analyzer/error/error.dart'; | |
import 'package:analyzer/error/listener.dart'; | |
import 'package:custom_lint_builder/custom_lint_builder.dart'; | |
class MyLintPlugin extends PluginBase { | |
@override | |
List<LintRule> getLintRules(CustomLintConfigs configs) { | |
return [ | |
MyLintRule(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
// ---------------------------------------------------------------------------- | |
class Box<T> { | |
Box(this.value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:collection'; | |
import 'package:cloud_firestore/cloud_firestore.dart'; | |
import 'package:firebase_core/firebase_core.dart'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:signals/signals_flutter.dart'; | |
import 'firebase_options.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { |