Skip to content

Instantly share code, notes, and snippets.

View superhard's full-sized avatar
🎯
Focusing

Artem superhard

🎯
Focusing
View GitHub Profile
@bizz84
bizz84 / update-android-project.sh
Last active May 12, 2025 04:04
Script to update Gradle, Java and other Android project settings in a Flutter project
#!/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
// 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 {
@danielgomezrico
danielgomezrico / provider_generic_extensions.dart
Last active October 19, 2023 16:07
Dart/Flutter - Extensions to emit ChangeNotifier changes as a Stream, very useful for unit testing
/// 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
@slightfoot
slightfoot / media_query_extension.dart
Last active July 29, 2021 13:32
Media Query Extension - by Simon Lightfoot
// 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:
@elisar4
elisar4 / main.dart
Last active June 28, 2022 02:25
Flutter iOS Keyboard Animation
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,
@monmonja
monmonja / generate-ios.sh
Created July 16, 2019 13:16
generate ios from command line
# 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
import PlaygroundSupport
import SwiftUI
struct LiveView: View {
@State var isPresented = false
var modalPresentation: some View {
NavigationView {
Text("Hello World")
.font(.caption)
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
@pteasima
pteasima / OnScroll.swift
Last active December 16, 2020 17:35
SwiftUI onScroll
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 {
//
// 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