feat: navigasi with param
This commit is contained in:
parent
effaa4cdd7
commit
6adcb2e471
|
@ -3,6 +3,15 @@ import 'package:get/get.dart';
|
||||||
class NavigationController extends GetxController {
|
class NavigationController extends GetxController {
|
||||||
RxInt selectedIndex = 0.obs;
|
RxInt selectedIndex = 0.obs;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
final args = Get.arguments;
|
||||||
|
if (args != null && args is int) {
|
||||||
|
selectedIndex.value = args;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void changePage(int page) {
|
void changePage(int page) {
|
||||||
selectedIndex.value = page;
|
selectedIndex.value = page;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class QuizPreviewController extends GetxController {
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
Get.snackbar('Sukses', 'Kuis berhasil disimpan!');
|
Get.snackbar('Sukses', 'Kuis berhasil disimpan!');
|
||||||
Get.offAllNamed(AppRoutes.mainPage);
|
Get.offAllNamed(AppRoutes.mainPage, arguments: 2);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logC.e(e);
|
logC.e(e);
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:quiz_app/app/app.dart';
|
import 'package:quiz_app/app/app.dart';
|
||||||
import 'package:quiz_app/core/utils/logger.dart';
|
import 'package:quiz_app/core/utils/logger.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runZonedGuarded(() {
|
runZonedGuarded(() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
await SystemChrome.setPreferredOrientations([
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
DeviceOrientation.portraitDown,
|
||||||
|
]);
|
||||||
|
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
}, (e, stackTrace) {
|
}, (e, stackTrace) {
|
||||||
logC.e("issue message $e || $stackTrace");
|
logC.e("issue message $e || $stackTrace");
|
||||||
|
|
Loading…
Reference in New Issue