@@ -9,6 +9,7 @@ import 'package:appetizer/presentation/feedback/components/feedback_banner.dart'
9
9
import 'package:auto_route/auto_route.dart' ;
10
10
import 'package:flutter/material.dart' ;
11
11
import 'package:flutter_bloc/flutter_bloc.dart' ;
12
+ import 'package:fluttertoast/fluttertoast.dart' ;
12
13
13
14
@RoutePage ()
14
15
class FeedbackScreen extends StatelessWidget {
@@ -32,6 +33,27 @@ class FeedbackScreen extends StatelessWidget {
32
33
FeedbackPageBloc (repo: context.read <FeedbackRepository >()),
33
34
child: BlocBuilder <FeedbackPageBloc , FeedbackPageState >(
34
35
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
+ }
35
57
return Column (
36
58
children: [
37
59
const FeedbackBanner (),
@@ -101,14 +123,12 @@ class FeedbackScreen extends StatelessWidget {
101
123
Align (
102
124
alignment: Alignment .bottomRight,
103
125
child: BlackIconButton (
104
- // onTap: context.router.pop,
105
126
onTap: () {
106
127
context.read <FeedbackPageBloc >().add (
107
128
FeedbackPageSubmitEvent (
108
129
mealId: mealId,
109
130
rating: state.rating,
110
131
description: state.description));
111
- context.router.pop ();
112
132
},
113
133
title: "SUBMIT" ,
114
134
width: 102. toAutoScaledWidth,
0 commit comments