V_MainScreen function

void V_MainScreen(
  1. BuildContext context,
  2. String strfrm, {
  3. String title = "",
  4. String cp_name = "",
  5. String strparameter = "",
  6. bool showAppBar = false,
})

Implementation

void V_MainScreen(
  BuildContext context,
  String strfrm, {
  String title = "",
  // ignore: non_constant_identifier_names
  String cp_name = "",
  String strparameter = "",
  bool showAppBar = false,
}) {
  final screen = V_getScreen(
    strfrm,
    title,
    cp_name,
    strparameter,
    hideAppBar: !showAppBar,
    isMainScreen: true,
  );

  if (screen == null) {
    //debugPrint('⚠️ Không tìm thấy màn hình: $strfrm');
    return;
  }

  // Xóa toàn bộ navigation stack và chuyển sang màn hình mới
  Navigator.of(context).pushAndRemoveUntil(
    MaterialPageRoute(builder: (context) => screen),
    (route) => false, // ← false = XÓA TẤT CẢ
  );
}