@@ -9,6 +9,7 @@ import 'package:appetizer/presentation/feedback/components/feedback_banner.dart'
99import 'package:auto_route/auto_route.dart' ;
1010import 'package:flutter/material.dart' ;
1111import 'package:flutter_bloc/flutter_bloc.dart' ;
12+ import 'package:fluttertoast/fluttertoast.dart' ;
1213
1314@RoutePage ()
1415class FeedbackScreen extends StatelessWidget {
@@ -32,6 +33,27 @@ class FeedbackScreen extends StatelessWidget {
3233 FeedbackPageBloc (repo: context.read <FeedbackRepository >()),
3334 child: BlocBuilder <FeedbackPageBloc , FeedbackPageState >(
3435 builder: (context, state) {
36+ if (state.error) {
37+ Fluttertoast .showToast (
38+ msg: "Unable to submit feedback!" ,
39+ toastLength: Toast .LENGTH_SHORT ,
40+ gravity: ToastGravity .BOTTOM ,
41+ timeInSecForIosWeb: 1 ,
42+ textColor: Colors .white,
43+ backgroundColor: AppTheme .red,
44+ fontSize: 16.0 );
45+ }
46+ if (state.submitted) {
47+ Fluttertoast .showToast (
48+ msg: "Feedback submitted successfully!" ,
49+ toastLength: Toast .LENGTH_SHORT ,
50+ gravity: ToastGravity .BOTTOM ,
51+ timeInSecForIosWeb: 1 ,
52+ textColor: Colors .white,
53+ backgroundColor: AppTheme .green,
54+ fontSize: 12. toAutoScaledFont);
55+ context.router.pop ();
56+ }
3557 return Column (
3658 children: [
3759 const FeedbackBanner (),
@@ -101,14 +123,12 @@ class FeedbackScreen extends StatelessWidget {
101123 Align (
102124 alignment: Alignment .bottomRight,
103125 child: BlackIconButton (
104- // onTap: context.router.pop,
105126 onTap: () {
106127 context.read <FeedbackPageBloc >().add (
107128 FeedbackPageSubmitEvent (
108129 mealId: mealId,
109130 rating: state.rating,
110131 description: state.description));
111- context.router.pop ();
112132 },
113133 title: "SUBMIT" ,
114134 width: 102. toAutoScaledWidth,
0 commit comments