@@ -140,7 +140,7 @@ class _ReplyBarWrapperState extends State<ReplyBar> {
140140 onTapCallback = showEditor;
141141 }
142142
143- return BlocListener <ReplyBloc , ReplyState >(
143+ return BlocConsumer <ReplyBloc , ReplyState >(
144144 listener: (_, state) {
145145 // Clear the outer controller text.
146146 if (state.status == ReplyStatus .success) {
@@ -149,22 +149,27 @@ class _ReplyBarWrapperState extends State<ReplyBar> {
149149 widget.controller._replyAction = null ;
150150 }
151151 },
152- child: ColoredBox (
153- color: Theme .of (context).colorScheme.surfaceContainerLow,
154- child: Padding (
155- padding: edgeInsetsL12T12R12B12,
156- child: TextField (
157- controller: controller,
158- readOnly: true ,
159- enabled: onTapCallback != null ,
160- decoration: InputDecoration (
161- hintText: context.t.threadPage.sendReplyHint,
162- border: const UnderlineInputBorder (),
152+ buildWhen: (prev, curr) => prev.status != curr.status,
153+ builder: (context, state) {
154+ final loading = state.status == ReplyStatus .loading;
155+ return ColoredBox (
156+ color: Theme .of (context).colorScheme.surfaceContainerLow,
157+ child: Padding (
158+ padding: edgeInsetsL12T12R12B12,
159+ child: TextField (
160+ controller: controller,
161+ readOnly: true ,
162+ enabled: onTapCallback != null ,
163+ decoration: InputDecoration (
164+ hintText: context.t.threadPage.sendReplyHint,
165+ border: const UnderlineInputBorder (),
166+ suffix: loading ? sizedCircularProgressIndicator : null ,
167+ ),
168+ onTap: onTapCallback,
163169 ),
164- onTap: onTapCallback,
165170 ),
166- ),
167- ) ,
171+ );
172+ } ,
168173 );
169174 }
170175}
0 commit comments