Jonny Borges

fix bottombar

@@ -14,11 +14,12 @@ class HomeView extends GetView<HomeController> { @@ -14,11 +14,12 @@ class HomeView extends GetView<HomeController> {
14 final delegate = context.navigation; 14 final delegate = context.navigation;
15 //This router outlet handles the appbar and the bottom navigation bar 15 //This router outlet handles the appbar and the bottom navigation bar
16 final currentLocation = context.location; 16 final currentLocation = context.location;
  17 + print(currentLocation);
17 var currentIndex = 0; 18 var currentIndex = 0;
18 if (currentLocation.startsWith(Routes.products) == true) { 19 if (currentLocation.startsWith(Routes.products) == true) {
19 currentIndex = 2; 20 currentIndex = 2;
20 } 21 }
21 - if (currentLocation.startsWith(Routes.products) == true) { 22 + if (currentLocation.startsWith(Routes.profile) == true) {
22 currentIndex = 1; 23 currentIndex = 1;
23 } 24 }
24 return Scaffold( 25 return Scaffold(
@@ -3,7 +3,7 @@ version: 1.0.0+1 @@ -3,7 +3,7 @@ version: 1.0.0+1
3 publish_to: none 3 publish_to: none
4 description: A new Flutter project. 4 description: A new Flutter project.
5 environment: 5 environment:
6 - sdk: ">=2.12.0 <3.0.0" 6 + sdk: ">=2.17.0 <3.0.0"
7 7
8 dependencies: 8 dependencies:
9 cupertino_icons: ^1.0.2 9 cupertino_icons: ^1.0.2
1 library get_core; 1 library get_core;
2 2
  3 +export 'src/flutter_engine.dart';
3 export 'src/get_interface.dart'; 4 export 'src/get_interface.dart';
4 export 'src/get_main.dart'; 5 export 'src/get_main.dart';
5 export 'src/log.dart'; 6 export 'src/log.dart';
6 -  
7 export 'src/smart_management.dart'; 7 export 'src/smart_management.dart';
8 -  
9 export 'src/typedefs.dart'; 8 export 'src/typedefs.dart';
  1 +import 'package:flutter/widgets.dart';
  2 +
  3 +class Engine{
  4 + static WidgetsBinding get instance {
  5 + return WidgetsFlutterBinding.ensureInitialized();
  6 + }
  7 +}
1 import 'package:flutter/foundation.dart'; 1 import 'package:flutter/foundation.dart';
2 -import 'package:flutter/scheduler.dart';  
3 2
4 import '../../get.dart'; 3 import '../../get.dart';
5 4
@@ -18,7 +17,8 @@ mixin GetLifeCycleMixin { @@ -18,7 +17,8 @@ mixin GetLifeCycleMixin {
18 @protected 17 @protected
19 @mustCallSuper 18 @mustCallSuper
20 void onInit() { 19 void onInit() {
21 - ambiguate(SchedulerBinding.instance) 20 +
  21 + ambiguate(Engine.instance)
22 ?.addPostFrameCallback((_) => onReady()); 22 ?.addPostFrameCallback((_) => onReady());
23 } 23 }
24 24
1 import 'dart:ui' as ui; 1 import 'dart:ui' as ui;
2 2
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 -import 'package:flutter/scheduler.dart';  
5 4
6 import '../../get_core/get_core.dart'; 5 import '../../get_core/get_core.dart';
7 import '../../get_instance/src/bindings_interface.dart'; 6 import '../../get_instance/src/bindings_interface.dart';
@@ -358,7 +357,7 @@ extension ExtensionSnackbar on GetInterface { @@ -358,7 +357,7 @@ extension ExtensionSnackbar on GetInterface {
358 if (instantInit) { 357 if (instantInit) {
359 controller.show(); 358 controller.show();
360 } else { 359 } else {
361 - ambiguate(SchedulerBinding.instance)!.addPostFrameCallback((_) { 360 + ambiguate(Engine.instance)!.addPostFrameCallback((_) {
362 controller.show(); 361 controller.show();
363 }); 362 });
364 } 363 }
@@ -469,7 +468,7 @@ extension ExtensionSnackbar on GetInterface { @@ -469,7 +468,7 @@ extension ExtensionSnackbar on GetInterface {
469 controller.show(); 468 controller.show();
470 } else { 469 } else {
471 //routing.isSnackbar = true; 470 //routing.isSnackbar = true;
472 - ambiguate(SchedulerBinding.instance)!.addPostFrameCallback((_) { 471 + ambiguate(Engine.instance)!.addPostFrameCallback((_) {
473 controller.show(); 472 controller.show();
474 }); 473 });
475 } 474 }
@@ -1170,14 +1169,14 @@ extension GetNavigationExt on GetInterface { @@ -1170,14 +1169,14 @@ extension GetNavigationExt on GetInterface {
1170 } 1169 }
1171 1170
1172 /// The window to which this binding is bound. 1171 /// The window to which this binding is bound.
1173 - ui.SingletonFlutterWindow get window => ui.window; 1172 + ui.SingletonFlutterWindow get window => engine.window;
1174 1173
1175 - Locale? get deviceLocale => ui.window.locale; 1174 + Locale? get deviceLocale => engine.window.locale;
1176 1175
1177 ///The number of device pixels for each logical pixel. 1176 ///The number of device pixels for each logical pixel.
1178 - double get pixelRatio => ui.window.devicePixelRatio; 1177 + double get pixelRatio => engine.window.devicePixelRatio;
1179 1178
1180 - Size get size => ui.window.physicalSize / pixelRatio; 1179 + Size get size => engine.window.physicalSize / pixelRatio;
1181 1180
1182 ///The horizontal extent of this size. 1181 ///The horizontal extent of this size.
1183 double get width => size.width; 1182 double get width => size.width;
@@ -1187,14 +1186,14 @@ extension GetNavigationExt on GetInterface { @@ -1187,14 +1186,14 @@ extension GetNavigationExt on GetInterface {
1187 1186
1188 ///The distance from the top edge to the first unpadded pixel, 1187 ///The distance from the top edge to the first unpadded pixel,
1189 ///in physical pixels. 1188 ///in physical pixels.
1190 - double get statusBarHeight => ui.window.padding.top; 1189 + double get statusBarHeight => engine.window.padding.top;
1191 1190
1192 ///The distance from the bottom edge to the first unpadded pixel, 1191 ///The distance from the bottom edge to the first unpadded pixel,
1193 ///in physical pixels. 1192 ///in physical pixels.
1194 - double get bottomBarHeight => ui.window.padding.bottom; 1193 + double get bottomBarHeight => engine.window.padding.bottom;
1195 1194
1196 ///The system-reported text scale. 1195 ///The system-reported text scale.
1197 - double get textScaleFactor => ui.window.textScaleFactor; 1196 + double get textScaleFactor => engine.window.textScaleFactor;
1198 1197
1199 /// give access to TextTheme.of(context) 1198 /// give access to TextTheme.of(context)
1200 TextTheme get textTheme => theme.textTheme; 1199 TextTheme get textTheme => theme.textTheme;
@@ -1260,41 +1259,8 @@ extension GetNavigationExt on GetInterface { @@ -1260,41 +1259,8 @@ extension GetNavigationExt on GetInterface {
1260 TDelegate? delegate<TDelegate extends RouterDelegate<TPage>, TPage>() => 1259 TDelegate? delegate<TDelegate extends RouterDelegate<TPage>, TPage>() =>
1261 _getxController.routerDelegate as TDelegate?; 1260 _getxController.routerDelegate as TDelegate?;
1262 1261
1263 - // void resetRootNavigator() {  
1264 - // _getxController = GetMaterialController();  
1265 - // }  
1266 -  
1267 - // RouterDelegate? get routerDelegate => _getxController.routerDelegate;  
1268 - // RouteInformationParser? get routeInformationParser =>  
1269 - // _getxController.routeInformationParser;  
1270 1262
1271 GetMaterialController get _getxController => GetMaterialController.to; 1263 GetMaterialController get _getxController => GetMaterialController.to;
1272 -  
1273 - // void addPages(List<GetPage> getPages) {  
1274 - // routeTree.addRoutes(getPages);  
1275 - // }  
1276 -  
1277 - // void clearRouteTree() {  
1278 - // routeTree.routes.clear();  
1279 - // }  
1280 -  
1281 - // ParseRouteTree get routeTree {  
1282 - // final delegate = _getxController.routerDelegate;  
1283 - // if (delegate is GetDelegate) {  
1284 - // return delegate.routeTree;  
1285 - // } else {  
1286 - // //TODO: Urgent: Refactor this  
1287 - // return ParseRouteTree(routes: []);  
1288 - // }  
1289 - // }  
1290 -  
1291 - // void addPage(GetPage getPage) {  
1292 - // routeTree.addRoute(getPage);  
1293 - // }  
1294 -  
1295 - // void removePage(GetPage getPage) {  
1296 - // routeTree.removeRoute(getPage);  
1297 - // }  
1298 } 1264 }
1299 1265
1300 extension OverlayExt on GetInterface { 1266 extension OverlayExt on GetInterface {
@@ -61,7 +61,7 @@ class RouterReportManager<T> { @@ -61,7 +61,7 @@ class RouterReportManager<T> {
61 61
62 void reportRouteDispose(T disposed) { 62 void reportRouteDispose(T disposed) {
63 if (Get.smartManagement != SmartManagement.onlyBuilder) { 63 if (Get.smartManagement != SmartManagement.onlyBuilder) {
64 - ambiguate(WidgetsBinding.instance)!.addPostFrameCallback((_) { 64 + ambiguate(Engine.instance)!.addPostFrameCallback((_) {
65 _removeDependencyByRoute(disposed); 65 _removeDependencyByRoute(disposed);
66 }); 66 });
67 } 67 }
@@ -2,7 +2,6 @@ import 'dart:async'; @@ -2,7 +2,6 @@ import 'dart:async';
2 import 'dart:ui'; 2 import 'dart:ui';
3 3
4 import 'package:flutter/material.dart'; 4 import 'package:flutter/material.dart';
5 -import 'package:flutter/scheduler.dart';  
6 5
7 import '../../../get_core/get_core.dart'; 6 import '../../../get_core/get_core.dart';
8 import '../../get_navigation.dart'; 7 import '../../get_navigation.dart';
@@ -449,7 +448,7 @@ You need to either use message[String], or messageText[Widget] or define a userI @@ -449,7 +448,7 @@ You need to either use message[String], or messageText[Widget] or define a userI
449 } 448 }
450 449
451 void _configureLeftBarFuture() { 450 void _configureLeftBarFuture() {
452 - ambiguate(SchedulerBinding.instance)!.addPostFrameCallback( 451 + ambiguate(Engine.instance)!.addPostFrameCallback(
453 (_) { 452 (_) {
454 final keyContext = _backgroundBoxKey.currentContext; 453 final keyContext = _backgroundBoxKey.currentContext;
455 if (keyContext != null) { 454 if (keyContext != null) {
@@ -96,13 +96,13 @@ mixin FullLifeCycleMixin on FullLifeCycleController { @@ -96,13 +96,13 @@ mixin FullLifeCycleMixin on FullLifeCycleController {
96 @override 96 @override
97 void onInit() { 97 void onInit() {
98 super.onInit(); 98 super.onInit();
99 - ambiguate(WidgetsBinding.instance)!.addObserver(this); 99 + ambiguate(Engine.instance)!.addObserver(this);
100 } 100 }
101 101
102 @mustCallSuper 102 @mustCallSuper
103 @override 103 @override
104 void onClose() { 104 void onClose() {
105 - ambiguate(WidgetsBinding.instance)!.removeObserver(this); 105 + ambiguate(Engine.instance)!.removeObserver(this);
106 super.onClose(); 106 super.onClose();
107 } 107 }
108 108