openAppPage function Null safety
- String name
Open page (screen, menu, popup) of the generated application using it's FIgma name
Implementation
void openAppPage(String name) {
if (screenClasses.containsKey(name)) {
//navigatorKey.currentState.push(MaterialPageRoute(builder: (context) => screenClasses[name].widget));
//navigatorKey.currentState.pushReplacement(MaterialPageRoute(builder: (context) => screenClasses[name].widget));
String componentType = screenClasses[name]?.type ?? '';
print('componentType $componentType');
if(componentType == 'popups'){
//final GlobalKey<NavigatorState> navigatorKey = new GlobalKey<NavigatorState>();
showGeneralDialog(
context: navigatorKey.currentState!.context,
useRootNavigator:false,
barrierLabel:'Discard',
barrierDismissible:true,
barrierColor: Color(0x00000000),
transitionDuration: const Duration(milliseconds: 500),
pageBuilder: (BuildContext buildContext, Animation animation, Animation secondaryAnimation) {
return screenClasses[name]?.widget;
}
);
}else{
navigatorKey.currentState?.pushReplacement(
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) => screenClasses[name]?.widget,
transitionDuration: Duration(seconds: 0),
),
);
}
}
}