Skip to content

Instantly share code, notes, and snippets.

View e200's full-sized avatar
👋
I may be slow to respond.

E L E A N D R O e200

👋
I may be slow to respond.
View GitHub Profile
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
linter:
rules:
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
@e200
e200 / gitlab-ci.yml
Created December 3, 2020 11:30
Frontend deploy
image: debian:latest
stages:
- build
cache:
untracked: true
key: "$CI_BUILD_REF_NAME"
paths:
@e200
e200 / dart_tip_2.dart
Last active September 25, 2020 20:30
Dart Cascade Notation
main() {
final _numbers = List<int>()
..add(1)
..add(2)
..add(3);
print(_numbers);
}
/****************************
import 'package:flutter/material.dart';
void main() {
runApp(LazyGridViewApp());
}
class LazyGridViewApp extends StatelessWidget {
final _list = List.generate(42, (index) => index);
@override
@e200
e200 / flutter_grid_view_with_loading_indicator.dart
Last active August 21, 2020 12:52
GridView with load indicator at the end
import 'package:flutter/material.dart';
void main() {
runApp(LazyGridViewApp());
}
class LazyGridViewApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@e200
e200 / gist:3857e0160d6cd344d2a6b46883464341
Created August 17, 2020 13:22 — forked from karanvs/gist:44599464f72988b138f5bc783f423b07
A solution to putting multiple ListViews inside a ScrollView in Flutter
return new Scaffold(
appBar: new AppBar(
title: new Text("Project Details"),
backgroundColor: Colors.blue[800]),
body:
new CustomScrollView(
slivers: <Widget>[
new SliverPadding(padding: const EdgeInsets.only(left: 10.0,right: 10.0,
top: 10.0,bottom: 0.0),
sliver: new SliverList(delegate:
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:math';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
void _setupScrollController() {
_scrollController = ScrollController();
_scrollController.addListener(_scrollListener);
}
void _scrollListener() {
if (_scrollController.offset >=
_scrollController.position.maxScrollExtent) {
_page++;
int _page = 1;
int _limit = 10;
ScrollController _scrollController;
@override
void initState() {
_setupScrollController();
_fetch();
_fetch() {
_http.get('/posts?_start=$_page&_limit=$_limit')
.then((response) {
final _fetchedPosts = (response.data as List)
.map((_user) => {
'id': _user['id'],
'title': _user['title'],
'body': 'body',
})
.toList();