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
#!/bin/bash | |
# Update Gradle, Java and other Android project settings in a Flutter project | |
# Works with both .gradle and .gradle.kts build files | |
# See: https://gradle.org/releases/ | |
# See: https://developer.android.com/build/releases/gradle-plugin#compatibility | |
DESIRED_GRADLE_VERSION="8.11.1" | |
# Build errors often show the required Java version | |
DESIRED_JAVA_VERSION="17" | |
# See: https://developer.android.com/ndk/downloads |
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
// Source code for this tutorial: | |
// https://codewithandrea.com/articles/shake-text-effect-flutter/ | |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
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
/// Function to get the changed value everytime | |
typedef GetChangeFunction<T> = T Function(); | |
extension AsStream<T> on ChangeNotifier { | |
Stream<T> statusAsStream(GetChangeFunction<T> getChange) { | |
final controller = StreamController<T>(); | |
// Redirect status changes into the Stream |
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
// MIT License | |
// | |
// Copyright (c) 2020 Simon Lightfoot | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
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'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
primarySwatch: Colors.blue, |
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
# download this file to your project folder and excute | |
# chmod +x generate-ios.sh | |
# then run using | |
# ./generate-ios.sh | |
# flutter build defaults to --release | |
flutter build ios | |
# make folder, add .app then zip it and rename it to .ipa | |
mkdir -p Payload |
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 PlaygroundSupport | |
import SwiftUI | |
struct LiveView: View { | |
@State var isPresented = false | |
var modalPresentation: some View { | |
NavigationView { | |
Text("Hello World") | |
.font(.caption) |
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 SwiftUI | |
struct NumbersCollectionView : UIViewRepresentable { | |
@Binding var numbers: [Int] | |
func makeUIView(context: Context) -> UICollectionView { | |
let layout = UICollectionViewFlowLayout() | |
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) | |
collectionView.backgroundColor = .white | |
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 SwiftUI | |
import Combine | |
struct OnScroll: ViewModifier { | |
@Binding var offset: CGFloat | |
//we can have a version with a closure instead of the binding, but that triggers an infinite loop if content depends on the same Store | |
// var onOffset: (CGFloat) -> () | |
func body(content: Content) -> some View { | |
return VStack { |
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
// | |
// Picker+Style.swift | |
// | |
// Copyright 2019, Sven Herzberg | |
// | |
// License: MIT | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to | |
// deal in the Software without restriction, including without limitation the |
NewerOlder