This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
class Relation | |
def pluck_in_batches(*columns, batch_size: 1000, start: nil) | |
relation = self | |
relation = relation.where(table[primary_key].gteq(start)) if start | |
batch_order = "#{table.name}.#{primary_key} ASC" | |
relation = relation.reorder(batch_order) | |
loop do | |
batch = relation.limit(batch_size).pluck(*columns, primary_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
import 'package:dio/dio.dart'; | |
void main() { | |
runApp(GetMaterialApp( | |
initialRoute: '/home', | |
getPages: [ | |
GetPage( | |
name: '/home', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:get/get.dart'; | |
import 'package:flutter/material.dart'; | |
class OverLayLoader { | |
OverLayLoader._privateConstructor(); | |
static final OverLayLoader find = OverLayLoader._privateConstructor(); | |
Route _dialogRoute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:math' as math; | |
import 'dart:ui'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
import 'package:flutter_icons/flutter_icons.dart'; | |
import 'package:get/get.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// copyright 2020, roipeker | |
class FormValidations { | |
static String email(String val) { | |
val = val.trim(); | |
if (val.isEmpty) return 'Email cant be empty'; | |
if (val.length <= 4) return 'Email is too short'; | |
if (!val.isEmail) return 'Invalid email'; | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simplified version with focusOut validation | |
Obx( | |
() => Focus( | |
onFocusChange: (hasFocus) { | |
if (!hasFocus) { | |
controller.stateTaxIdController.refresh(); | |
GetUtils.isCnpj(stateTaxIdMask.getUnmaskedText()); | |
} | |
}, | |
child: TextFormFieldOnPrimary( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// roipeker - 2020 | |
/// Based on | |
/// https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf | |
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
class SampleMultiNavColors extends StatelessWidget { | |
@override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
class EmbarqueModel { | |
final String name; | |
final String id; | |
EmbarqueModel({this.name, this.id}); | |
String get endpoint => '/$id'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppGetUtils { | |
static bool isPreloading = false; | |
static Future<void> hidePreloader() async { | |
if (!isPreloading) return; | |
isPreloading = false; | |
if (!Get.isSnackbarOpen) { | |
Get.close(1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
class SampleTodoDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return GetMaterialApp( | |
home: TodoPage(), | |
); | |
} |
NewerOlder