Skip to content

Instantly share code, notes, and snippets.

View DevKhalyd's full-sized avatar
🎯
Focusing

Rolando Garcia DevKhalyd

🎯
Focusing
View GitHub Profile
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@DevKhalyd
DevKhalyd / log_console.dart
Created November 12, 2020 14:16
Log Console for Flutter
/*
In pubsbec yaml
Use that library
logger: ^0.9.4
*/
//File logger.dart
//More info: https://pub.dev/packages/logger
@DevKhalyd
DevKhalyd / search_delegate_custom.dart
Last active September 22, 2020 02:49
Search Delegate Custom
import 'package:flutter/material.dart';
///This class customize the default class SearchDelegate to use less code in each implementation
///
///The `Custom` sufix refers to properties from this class
///
///`Constructor class`
///
/// ```dart
///SearchDelegateCustom(
@DevKhalyd
DevKhalyd / flutter_datepicker.dart
Created September 10, 2020 05:14
Flutter DatePicker with lenguage support
Future<String> getDateByUser(BuildContext context) async {
/*Support lenguage
How to: https://stackoverflow.com/questions/61529343/how-to-change-language-of-show-date-picker-in-flutter
https://flutter.dev/docs/development/accessibility-and-localization/internationalization
*/
DateTime selectedDate = DateTime.now();
final DateTime picked = await showDatePicker(
context: context,
@DevKhalyd
DevKhalyd / cloud_firestore.txt
Last active August 29, 2020 18:13
Summary Cloud Firestore
Cloud Firestore:
Store in:
Collections and Documents
(insisde Documents could be: Data or more collecions. NO Documents)
Set a ubication: https://firebase.google.com/docs/firestore/locations
Set rules: https://firebase.google.com/docs/firestore/security/rules-structure
@DevKhalyd
DevKhalyd / form_flutter.dart
Created August 27, 2020 22:15
Form Example Flutter
//Use a globalKey
final _formKey = GlobalKey<FormState>();
//Use that key inside a Form Widget
return Form(
key: _formKey,
autovalidate: autovaldiate,
child: Column(
children: [
Space(0.05),
@DevKhalyd
DevKhalyd / mini_widgets.dart
Last active February 7, 2021 04:07
Mini Widgets to make easier the develop of an app
import 'package:flutter/gestures.dart';
///THIS FILE CONTAINS A LOT OF WIDGET USEFUL
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../utils/utils.dart';
class CenterText extends StatelessWidget {
const CenterText(this.text, {this.textAlign = TextAlign.center});
@DevKhalyd
DevKhalyd / push_page.dart
Created August 4, 2020 14:43
push_pages_examples
//Just push to the next page
nextPage(BuildContext context, Widget widget) => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => widget,
));
///Remove the stack
nextRemoveWhole(BuildContext context, String route) =>
Navigator.of(context).pushNamedAndRemoveUntil(route, (route) => false);
List<int> getmillisecondsSinceEpochNowAndAfter() {
//Get this day
String value = DateTime.now().toString();
//Get the only the date
String prefix = value.substring(0, 10);
//Today from 0 hours
var today = DateTime.parse("$prefix 00:00:00Z");
@DevKhalyd
DevKhalyd / proxy_provider_example.dart
Created July 23, 2020 21:10
ProxyProvider Example
import 'package:vento_app/notifiers/data_stores_notifiers.dart';
import 'package:vento_app/notifiers/search_item.dart';
//ProxyProvider
class SearchStoreProxy {
//Notifier
DataStoreNotifier _dataStore;
//Notifier
SearchItemNotifier _searhItems;