Skip to content

Commit

Permalink
Modifies the snackbar shown after save button is used
Browse files Browse the repository at this point in the history
  • Loading branch information
SriramPatibanda authored and nayakastha committed Sep 14, 2021
1 parent 263b7cd commit 81a1975
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions aptiche/lib/services/net/authservice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AuthService extends GetxController {
void signOut() {
FirebaseAuth.instance.signOut();
GetStorage('User').erase();
Get.offAll<dynamic>(() => const SplashScreen());
Get.offAll<SplashScreen>(() => const SplashScreen());
}

Future<void> signInwithOTP(String smsCode, String verId) async {
Expand All @@ -45,7 +45,7 @@ class AuthService extends GetxController {
);
await FirebaseAuth.instance.signInWithCredential(authCredential);

await Get.to<dynamic>(() => const DataEntryScreen());
await Get.to<DataEntryScreen>(() => const DataEntryScreen());
} catch (error) {
CustomLoaders().customSnackBar(
'Authentication Error - WRONG OTP',
Expand Down
4 changes: 2 additions & 2 deletions aptiche/lib/views/home/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class HomeController extends GetxController {
List<Quiz>? desiredList;

@override
void onReady() {
getQuizzes();
void onReady() async {
await getQuizzes();
super.onInit();
}

Expand Down
6 changes: 5 additions & 1 deletion aptiche/lib/views/quiz/quiz_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:aptiche/widgets/quiz/choices_list_view.dart';
import 'package:aptiche/widgets/quiz/quiz_question.dart';
import 'package:aptiche/widgets/quiz/quiz_timer.dart';
import 'package:aptiche/widgets/quiz/quiz_top_bar.dart';
import 'package:aptiche/widgets/snackbar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

Expand Down Expand Up @@ -113,7 +114,10 @@ class QuizView extends GetView<QuizController> {
text: 'Save',
onTap: () {
controller.saveAndNext();
Get.snackbar<dynamic>('Saved', ' ');

CustomLoaders().customSnackBar(
'Saved', 'Your choice has been saved',
duration: const Duration(seconds: 1));
},
),
],
Expand Down
14 changes: 9 additions & 5 deletions aptiche/lib/widgets/snackbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';

class CustomLoaders {
Widget customSnackBar(String title, String subject) {
Get.snackbar<dynamic>(title, subject,
backgroundColor: kSnackColour.withOpacity(0.5),
snackStyle: SnackStyle.FLOATING,
colorText: Colors.black87);
Widget customSnackBar(String title, String subject, {Duration? duration}) {
Get.snackbar<Widget>(
title,
subject,
backgroundColor: kSnackColour.withOpacity(0.5),
snackStyle: SnackStyle.FLOATING,
duration: duration,
colorText: Colors.black87,
);
return Container();
}
}

0 comments on commit 81a1975

Please sign in to comment.