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
| Positioned positionedPageView( | |
| BuildContext context, PointsCompleted completed) { | |
| return Positioned( | |
| height: context.dynamicHeight(0.12), | |
| bottom: 0, | |
| right: 0, | |
| left: -context.dynamicWidth(0.1), | |
| child: PageView.builder( | |
| onPageChanged: (value) { | |
| context |
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
| class PointsCompleted extends PointsState { | |
| final List<Coordinate> coordinates; | |
| final int selectedItem; | |
| PointsCompleted(this.coordinates, {this.selectedItem}); | |
| PointsCompleted copyWith({ | |
| List<Coordinate> coordinates, | |
| int selectedItem, |
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
| class RouteManager implements IRouteManager { | |
| @override | |
| double calculateDistance(LatLng cordinate, LatLng secondCordinate) { | |
| return (distanceBetween( | |
| cordinate.latitude, cordinate.longitude, secondCordinate.latitude, secondCordinate.longitude)) | |
| .roundToDouble() / | |
| 1000; | |
| } | |
| } |
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
| enum NetworkPath { LOGIN, BUILD_HOME } | |
| extension NetworkPath on NetworkRoutes { | |
| String get rawValue { | |
| switch (this) { | |
| case NetworkRoutes.LOGIN: | |
| return 'login'; | |
| case NetworkRoutes.BUILD_HOME: | |
| return 'house'; | |
| default: |
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
| extension ListViewExtension on ListView { | |
| Widget onLazyLoads(Future<void> Function() onPagingLoad, {Widget? itemLoadWidget}) { | |
| final delegate = childrenDelegate as SliverChildBuilderDelegate; | |
| final itemCount = delegate.childCount ?? 0; | |
| return NotificationListener<ScrollNotification>( | |
| onNotification: (ScrollNotification notification) { | |
| if (notification.metrics.pixels == notification.metrics.maxScrollExtent) { | |
| onPagingLoad(); | |
| } | |
| return true; |
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
| extension StringExtension on String { | |
| bool validateMinLenght([double value = 6]) { | |
| return this.length > value; | |
| } | |
| } |
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
| class LocaleManager { | |
| static final LocaleManager _instance = LocaleManager._init(); | |
| SharedPreferences? _preferences; | |
| static LocaleManager get instance => _instance; | |
| /// [SharedPreferences] init constructor. | |
| LocaleManager._init() { | |
| SharedPreferences.getInstance().then((value) { | |
| _preferences = value; |
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
| abstract class IHomeService { | |
| final INetworkManager manager; | |
| IHomeService(this.manager); | |
| Future<List<ItemModel>> fetchItem(); | |
| Future<Uint8List?> downloadFile(String url, ProgressCallback callback); | |
| } | |
| enum _HomeServicePath { CACHE } |
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
| test('Fetch Pdf And Cache', () async { | |
| final response = await manager.downloadFileSimple('http://www.africau.edu/images/default/sample.pdf', null); | |
| final directory = await getApplicationDocumentsDirectory(); | |
| await Directory('${directory.path}').create(); | |
| await Directory('${directory.path}/vb2').create(); | |
| final path = '${directory.path}/vb2/1.pdf'; | |
| final file = File(path); | |
| final fileWithData = await file.writeAsBytes(response.data!); | |
| expect(await fileWithData.exists(), true); | |
| }); |