Skip to content

Instantly share code, notes, and snippets.

View gabrimatic's full-sized avatar
🌌
Full-time learner

Hossein Yousefpour gabrimatic

🌌
Full-time learner
View GitHub Profile
If pod install didn't work on M1 Mac OS, you could use this instead:
arch -x86_64 pod install
/// By https://gabrimatic.info
/// Run in DartPad with: https://dartpad.dev/?id=c1889bf45d03e36f68120954373a3c56&null_safety=true
void main() {
final double baseMoney = 1000;
final double percentage = 1;
double moneyInMonth = baseMoney;
print(
'If you have $baseMoney\$ and earn the $percentage% of your total amount in each day, You\'ll have:');
Customize app/build.gradle as bellow:
android {
...
flavorDimensions "api"
productFlavors {
minApi18 {
* fluttersaurus project src: https://github.com/felangel/fluttersaurus
Ideally, repositories aren't feature-specific. Repositories should be at the domain level and should be reusable across different applications.
It is very common for a single repository to be used by multiple feature-blocs.
You need to define what your domains are.
For example, they might be the user and chat:
- You should define the various API clients.
So, Where is the data coming from? Is it coming from one API or multiple?
- For each backend, there should be an API client in the packages subdirectory.
@gabrimatic
gabrimatic / flutter_chatting_page
Created May 11, 2020 20:21
A simple flutter chatting design page
import 'package:flutter/material.dart';
import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
class ChatPage extends StatefulWidget {
@override
_ChatPageState createState() => _ChatPageState();
}
class _ChatPageState extends State<ChatPage> {
@gabrimatic
gabrimatic / flutter_database
Created May 7, 2020 00:55
simple flutter database structure
import 'dart:async';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
import 'Models/Group.dart';
// using sqflite: ^1.2.1
class GroupModel {
final int id;
final String title;
@gabrimatic
gabrimatic / flutter_navigation
Created May 1, 2020 18:16
flutter_easy_navigation_methods
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void pop(context) {
Navigator.of(context).pop();
}
void popInfinity() {
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
}
@gabrimatic
gabrimatic / flutter_languege_change_dialog
Created May 1, 2020 13:33
shows a dialog to changing language in flutter
void _changeLangDialog() {
const int en = 1;
const int de = 2;
int lang = en;
Locale currentLocal = EasyLocalizationProvider.of(context).locale;
Locale deLocale = new Locale('de', 'DE');
Locale enLocale = new Locale('en', 'US');
lang = (currentLocal == enLocale) ? en : de;