This file contains hidden or 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 GlobalMiddleware extends GetMiddleware { | |
| final authController = Get.find<AuthController>(); | |
| @override | |
| RouteSettings redirect(String route) { | |
| return authController.authenticated || route == '/login' | |
| ? null |
This file contains hidden or 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'; | |
| /// `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`, |
This file contains hidden or 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' 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> { |
This file contains hidden or 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
| 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; |