Skip to content

Instantly share code, notes, and snippets.

View VB10's full-sized avatar
🏠
Working from home

Veli Bacik VB10

🏠
Working from home
View GitHub Profile
@VB10
VB10 / Insets+Copy.swift
Created September 14, 2022 22:07
Edge instets with copywith
extension EdgeInsets {
func copyWith(top: CGFloat? = nil, leading: CGFloat? = nil, bottom: CGFloat? = nil, trailing: CGFloat? = nil) -> EdgeInsets {
return EdgeInsets.init(top: top ?? self.top, leading: leading ?? self.leading, bottom: bottom ?? self.bottom, trailing: trailing ?? self.trailing)
}
}
@VB10
VB10 / page_sheet.dart
Created September 11, 2022 01:04
Custom page sheet
import 'package:flutter/material.dart';
class CustomPage extends StatelessWidget {
const CustomPage({super.key});
@override
Widget build(BuildContext context) {
return Container();
}
}
@VB10
VB10 / close_keyboard.dart
Last active November 7, 2022 15:30
Close Keyboard
class CloseKeyboardView extends StatelessWidget {
const CloseKeyboardView({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => FocusScope.of(context).unfocus(),
child: child,
);
}
name: classlist
description: Classlist a education
publish_to: "none"
version: 0.0.2
environment:
sdk: ">=2.17.0 <3.0.0"
dependencies:
flutter:
extension ListViewExtension on ListView {
// It will notify to each paging load
// You should control the state for your widget
Widget onLazyLoads(Future<void> Function() onPagingLoad, {Widget? itemLoadWidget}) {
if (childrenDelegate is SliverChildListDelegate) throw Exception('You should use list view builder ');
final delegate = childrenDelegate as SliverChildBuilderDelegate;
final itemCount = delegate.childCount ?? 0;
return NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification notification) {
if (notification.metrics.pixels == notification.metrics.maxScrollExtent) {
@VB10
VB10 / sample_cancalable.dart
Created August 24, 2022 00:56
Cancelable Feature
class SamplePage extends StatefulWidget {
const SamplePage({Key? key}) : super(key: key);
@override
_SamplePageState createState() => _SamplePageState();
}
class _SamplePageState extends State<SamplePage> {
void _fetchItems() {
@VB10
VB10 / page_padding.dart
Created July 3, 2022 19:47
Flutter padding class
import 'package:flutter/material.dart';
class PagePadding extends EdgeInsets {
static const double _normalValue = 10;
const PagePadding.horizontalSymmetric() : super.symmetric(horizontal: _normalValue);
const PagePadding.verticalSymmetric() : super.symmetric(vertical: _normalValue);
const PagePadding.general() : super.only(right: _normalValue, left: _normalValue, top: _normalValue);
const PagePadding.all() : super.all(_normalValue);
const PagePadding.onlyLeft() : super.only(left: _normalValue);
@VB10
VB10 / extension.sh
Last active January 7, 2025 07:48
2024 My Visual Code(Cursor) Extension list
code --install-extension 1yib.nodejs-bundle
code --install-extension 1yib.svelte-bundle
code --install-extension aaron-bond.better-comments
code --install-extension adpyke.codesnap
code --install-extension adrianwilczynski.add-reference
code --install-extension adrianwilczynski.asp-net-core-switcher
code --install-extension adrianwilczynski.blazor-snippet-pack
code --install-extension adrianwilczynski.csharp-to-typescript
code --install-extension adrianwilczynski.libman
code --install-extension adrianwilczynski.namespace
@VB10
VB10 / register_deafult.swift
Last active May 17, 2022 00:16
setup all config
private func registerDefaultsFromSettingsBundle()
{
guard let settingsUrl = Bundle.main.url(forResource: "Settings", withExtension: "bundle")?.appendingPathComponent("Root.plist") else
{ return }
guard let settingsPlist = NSDictionary(contentsOf: settingsUrl) else { return }
guard let preferences = settingsPlist["PreferenceSpecifiers"] as? [NSDictionary] else { return }
var defaultsToRegister = Dictionary<String, Any>()
for preference in preferences {
@VB10
VB10 / pigeon_run.sh
Created May 8, 2022 20:37
IOS run native code
flutter pub run pigeon \
--input pigeons/configuration.dart \
--dart_out lib/native/configuration.dart \
--objc_header_out ios/Runner/configuration.h \
--objc_source_out ios/Runner/configuration.m