Skip to content

Instantly share code, notes, and snippets.

View RahmiTufanoglu's full-sized avatar
🎯
Focusing

Rahmi Tufanoglu RahmiTufanoglu

🎯
Focusing
View GitHub Profile
@RahmiTufanoglu
RahmiTufanoglu / animated_partial_height_sheet.dart
Created November 16, 2023 12:56 — forked from slightfoot/animated_partial_height_sheet.dart
Animated Partial Height Sheet - by Simon Lightfoot - Humpday Q&A - 01/11/2023 - https://www.youtube.com/watch?v=S9C496aj1cA
// MIT License
//
// Copyright (c) 2023 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:
@RahmiTufanoglu
RahmiTufanoglu / analysis_options.yaml
Created August 25, 2023 13:48 — forked from rydmike/analysis_options.yaml
RydMike lints v2.0.1 - Personal preferences and my starting point for my Dart & Flutter linter rules setup
# RydMike LINTER Preferences v2.1.0
#
# Get this file here: https://gist.github.com/rydmike/fdb53ddd933c37d20e6f3188a936cd4c
#
# We include and activate all lint rules, later below we disable the not used or desired ones.
# You can find a list of all lint rules to put in your all_lint_rules.yaml file here:
# https://dart-lang.github.io/linter/lints/options/options.html
#
# For a full comparison of all lint rules settings in rule styles listed below, please see this
# sheet: https://docs.google.com/spreadsheets/d/1Nc1gFjmCOMubWZD7f2E4fLhWN7LYaOE__tsA7bf2NjA
extension on WidgetTester {
Future<void> launchApp() async {
await app.main();
await pumpAndSettle();
}
Future<void> clearState() async {
await SharedPreferences.getInstance().then((it) => it.clear());
}
@RahmiTufanoglu
RahmiTufanoglu / todo_iw.dart
Created March 19, 2023 22:40
TODO Inherited Widget
class Todo {
String title;
bool isDone;
Todo({
required this.title,
this.isDone = false,
});
}
@RahmiTufanoglu
RahmiTufanoglu / main.dart
Created March 6, 2023 22:43
On app start
final firstEndpointProvider = Provider<String>((_) {
throw Exception('Provider "firstEndpointProvider" was not initialized.');
});
final secondEndpointProvider = Provider<String>((_) {
throw Exception('Provider "secondEndpointProvider" was not initialized.');
});
final sharedPrefsProvider = Provider<SharedPreferences>((_) {
throw Exception('Provider "sharedPrefsProvider" was not initialized.');
@RahmiTufanoglu
RahmiTufanoglu / iterable_extension.dart
Last active March 22, 2023 12:45
IterableExtension
import 'package:flutter/widgets.dart';
extension IterableExtension on Iterable<Widget> {
// This extension method generates a new Iterable of Widgets that inserts
// a given separator between each element in the original Iterable.
Iterable<Widget> separatedBy(Widget separator) sync* {
bool isFirst = true;
for (final widget in this) {
if (!isFirst) yield separator;
yield widget;
@RahmiTufanoglu
RahmiTufanoglu / disallow_indicator.dart
Created February 24, 2023 13:58
Disallow indicator
import 'package:flutter/material.dart';
class DisallowIndicator extends StatelessWidget {
const DisallowIndicator({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
return NotificationListener<OverscrollIndicatorNotification>(
@RahmiTufanoglu
RahmiTufanoglu / git
Last active February 9, 2023 15:30
Git pull scenario_1
git pull --rebase
# resolve conflicts file/files
git add .
# or
git add here/is/my/file.dart
git rebase --continue
@RahmiTufanoglu
RahmiTufanoglu / custom_app_dialog.dart
Last active February 8, 2023 13:21
Custom AppDialog
import 'package:flutter/material.dart';
class CustomDialogTransition extends PageRouteBuilder {
CustomDialogTransition({
required super.pageBuilder,
super.fullscreenDialog = true,
bool opaque = true,
bool barrierDismissible = true,
Color? barrierColor,
Duration transitionDuration = const Duration(milliseconds: 600),
extension DarkMode on BuildContext {
bool get isDarkMode {
final brightness = MediaQuery.of(this).platformBrightness;
return brightness == Brightness.dark;
}
}