Skip to content

Instantly share code, notes, and snippets.

View raymondddenny's full-sized avatar
😎

Denny Raymond raymondddenny

😎
  • Sprout Digital Labs
  • Indonesia
View GitHub Profile
@raymondddenny
raymondddenny / main.dart
Created February 2, 2024 03:35 — forked from eduardoflorence/main.dart
GetX - Sample GetMiddleware
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class GlobalMiddleware extends GetMiddleware {
final authController = Get.find<AuthController>();
@override
RouteSettings redirect(String route) {
return authController.authenticated || route == '/login'
? null
@raymondddenny
raymondddenny / app_colors_extension.dart
Created November 16, 2023 15:54 — forked from SashaKryzh/app_colors_extension.dart
Flutter ThemeExtension for custom app colors.
import 'package:flutter/material.dart';
/// `ThemeExtension` template for custom colors.
///
/// For example purposes, it has all required fields from the default Material `ColorScheme`.
/// But you can add, rename and delete any fields your need.
///
/// ### Motivation
///
/// At the beginning, you may not know if your colors will fit into the Material `ColorScheme`,
import 'dart:async' show StreamSubscription, Timer;
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:testsejuta/bloc/username_bloc.dart';
part 'dasboard_event.dart';
part 'dasboard_state.dart';
class DasboardBloc extends Bloc<DasboardEvent, DasboardState> {
NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo) {
if (scrollInfo is ScrollEndNotification && // ? <-- dia dah di paling bawah, padding child juga dihitung
scrollInfo.metrics.extentAfter == 0 && // ? <-- bener2 mentok sampai ada splash-nya
_shopController.productState == ProductState.ok && //? <-- kondisi tambahan, cuma reload kalau lagi tidak loading
_shopController.pageQ != -1) { //? <-- kondisi tambahan, cuma reload kalau bukan halaman/paginasi terakhir
_shopController.getAllProductsNextPage(); //? <-- yang dilakukan untuk get next items
return true;
}
return false;