Skip to content

Instantly share code, notes, and snippets.

View mo-karbalaee's full-sized avatar

Mohammad Karbalaee mo-karbalaee

View GitHub Profile
@mo-karbalaee
mo-karbalaee / tips.md
Last active February 18, 2023 00:16
The tips and tricks that I learn throughout the problems that I solve during my mobile development career

Builder with Getx

when you use the Builder widget, it has its own context, therefore the values inside it won't get updated as you expect. Because they are not part of the Getx's widget tree.

Flutter File Picker

As of the day that I am writing this tip, Feb 2023, Flutter File Dialog works flawlessly in both Android and iOS. If the file_picker package does not work for you then give this one a little try. You will not regret it.

@mo-karbalaee
mo-karbalaee / readme.md
Created February 22, 2023 16:23
The trick to make an circle image in Flutter

Circle image in Flutter

wrap your image inside a CliRRect and give the BorderRadius.circular("width") to this widget which "width" is the width of the image itself.

Here is an example:

ClipRRect(
  borderRadius: BorderRadius.circular(10),
 child: Image.network(
@mo-karbalaee
mo-karbalaee / 2023.feb.23.md
Last active March 8, 2023 17:42
Daily Flutter experiences and tips and tricks which I learn along the way. I will store the tips of each day separately on a markdown file.

StateFulBuilder

the variable which the state inside StateFulBuilder is dependant on should be defined outside the builder method of StateFulBuilder. If it is defined inside, It will not have any affect.

Container Color

A container should have either its color specified or its decoration specified. They cannot be mixed up. If you want to use both of them, the trick is to define the color inside BoxDecoration and pass it through the decoration field of your Container.

@mo-karbalaee
mo-karbalaee / main.dart
Created April 10, 2023 08:40
forlorn-eucalyptus-8793
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@mo-karbalaee
mo-karbalaee / countries.json
Created April 12, 2023 10:33 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@mo-karbalaee
mo-karbalaee / countries.json
Created April 12, 2023 13:21 — forked from bensquire/countries.json
JSON Country List based on the ISO-3366-1 Alpha-3 Codes, with eu countries marked
[
{
"code": "AFG",
"name": "Afghanistan",
"eu": false
},
{
"code": "ALA",
"name": "Åland Islands",
"eu": false
@mo-karbalaee
mo-karbalaee / habits.md
Created July 11, 2023 12:19
The good habits that I formed in summer 2023 and I want to continue them from now on.

1st

Going to the study room and doing my work there with full focus and mind control

2nd

@mo-karbalaee
mo-karbalaee / 15_aug_2023.md
Created August 15, 2023 15:09
Whatever I find interesting in my iOS dev journey

Hiding the scrollbar for lists

On iOS 16+ use the code below:

.scrollIndicators(.hidden)

For example:

List {
@mo-karbalaee
mo-karbalaee / podforceupdate.sh
Created March 1, 2024 23:31 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update

Okay, let's get your Ruby 2.6.10 updated! Since you're on a Mac, the best way to do this cleanly and manage your Ruby versions effectively is by using a Ruby version manager like rbenv.

Here's a step-by-step guide using rbenv:

1. Install rbenv and ruby-build (if you haven't already):

ruby-build is an rbenv plugin that simplifies the process of installing different Ruby versions.

  • Open your Terminal.
  • If you don't have Homebrew installed, install it first: