@@ -8,6 +8,7 @@ import 'package:languagetool_textfield/src/domain/mistake.dart';
88import 'package:languagetool_textfield/src/domain/typedefs.dart' ;
99import 'package:languagetool_textfield/src/utils/extensions/string_extension.dart' ;
1010import 'package:languagetool_textfield/src/utils/popup_overlay_renderer.dart' ;
11+ import 'package:pointer_interceptor/pointer_interceptor.dart' ;
1112
1213/// Builder class that uses specified [popupRenderer] and [mistakeBuilder]
1314/// to create mistake popup
@@ -112,129 +113,131 @@ class LanguageToolMistakePopup extends StatelessWidget {
112113
113114 final availableSpace = _calculateAvailableSpace (context);
114115
115- return ConstrainedBox (
116- constraints: BoxConstraints (
117- maxWidth: maxWidth,
118- maxHeight: availableSpace,
119- ),
120- child: Container (
121- margin: EdgeInsets .symmetric (
122- horizontal: horizontalMargin,
123- vertical: verticalMargin,
124- ),
125- decoration: BoxDecoration (
126- color: const Color .fromRGBO (241 , 243 , 248 , 1.0 ),
127- borderRadius: BorderRadius .circular (_borderRadius),
128- boxShadow: const [BoxShadow (color: Colors .grey, blurRadius: 8 )],
116+ return PointerInterceptor (
117+ child: ConstrainedBox (
118+ constraints: BoxConstraints (
119+ maxWidth: maxWidth,
120+ maxHeight: availableSpace,
129121 ),
130- padding: const EdgeInsets .only (
131- top: 8 ,
132- bottom: 4 ,
133- left: 4 ,
134- right: 4 ,
135- ),
136- child: SingleChildScrollView (
137- child: Column (
138- mainAxisSize: MainAxisSize .min,
139- crossAxisAlignment: CrossAxisAlignment .start,
140- children: [
141- Padding (
142- padding: const EdgeInsets .only (left: 4 ),
143- child: Row (
144- children: [
145- Expanded (
146- child: Row (
147- children: [
148- Padding (
149- padding: const EdgeInsets .only (right: 5.0 ),
150- child: Image .asset (
151- LangToolImages .logo,
152- width: _iconSize,
153- height: _iconSize,
154- package: 'languagetool_textfield' ,
122+ child: Container (
123+ margin: EdgeInsets .symmetric (
124+ horizontal: horizontalMargin,
125+ vertical: verticalMargin,
126+ ),
127+ decoration: BoxDecoration (
128+ color: const Color .fromRGBO (241 , 243 , 248 , 1.0 ),
129+ borderRadius: BorderRadius .circular (_borderRadius),
130+ boxShadow: const [BoxShadow (color: Colors .grey, blurRadius: 8 )],
131+ ),
132+ padding: const EdgeInsets .only (
133+ top: 8 ,
134+ bottom: 4 ,
135+ left: 4 ,
136+ right: 4 ,
137+ ),
138+ child: SingleChildScrollView (
139+ child: Column (
140+ mainAxisSize: MainAxisSize .min,
141+ crossAxisAlignment: CrossAxisAlignment .start,
142+ children: [
143+ Padding (
144+ padding: const EdgeInsets .only (left: 4 ),
145+ child: Row (
146+ children: [
147+ Expanded (
148+ child: Row (
149+ children: [
150+ Padding (
151+ padding: const EdgeInsets .only (right: 5.0 ),
152+ child: Image .asset (
153+ LangToolImages .logo,
154+ width: _iconSize,
155+ height: _iconSize,
156+ package: 'languagetool_textfield' ,
157+ ),
155158 ),
156- ),
157- const Text ( 'Correct' ) ,
158- ] ,
159+ const Text ( 'Correct' ),
160+ ] ,
161+ ) ,
159162 ),
160- ),
161- IconButton (
162- icon: const Icon (
163- Icons .close,
164- size: 12 ,
163+ IconButton (
164+ icon: const Icon (
165+ Icons .close,
166+ size: 12 ,
167+ ),
168+ constraints: const BoxConstraints (),
169+ padding: EdgeInsets .zero,
170+ splashRadius: _dismissSplashRadius,
171+ onPressed: () {
172+ _dismissDialog ();
173+ controller.onClosePopup ();
174+ },
165175 ),
166- constraints: const BoxConstraints (),
167- padding: EdgeInsets .zero,
168- splashRadius: _dismissSplashRadius,
169- onPressed: () {
170- _dismissDialog ();
171- controller.onClosePopup ();
172- },
173- ),
174- ],
175- ),
176- ),
177- Container (
178- margin: const EdgeInsets .only (top: 8 ),
179- padding: const EdgeInsets .all (padding),
180- decoration: BoxDecoration (
181- color: Colors .white,
182- borderRadius: BorderRadius .circular (_borderRadius),
176+ ],
177+ ),
183178 ),
184- child: SingleChildScrollView (
185- child: Column (
186- crossAxisAlignment: CrossAxisAlignment .stretch,
187- children: [
188- Padding (
189- padding: const EdgeInsets .only (
190- bottom: _paddingBetweenTitle,
191- ),
192- child: Text (
193- mistake.type.name.capitalize (),
194- style: TextStyle (
195- color: Colors .grey.shade700,
196- fontSize: _mistakeNameFontSize,
197- fontWeight: FontWeight .w600,
198- letterSpacing: _titleLetterSpacing,
179+ Container (
180+ margin: const EdgeInsets .only (top: 8 ),
181+ padding: const EdgeInsets .all (padding),
182+ decoration: BoxDecoration (
183+ color: Colors .white,
184+ borderRadius: BorderRadius .circular (_borderRadius),
185+ ),
186+ child: SingleChildScrollView (
187+ child: Column (
188+ crossAxisAlignment: CrossAxisAlignment .stretch,
189+ children: [
190+ Padding (
191+ padding: const EdgeInsets .only (
192+ bottom: _paddingBetweenTitle,
193+ ),
194+ child: Text (
195+ mistake.type.name.capitalize (),
196+ style: TextStyle (
197+ color: Colors .grey.shade700,
198+ fontSize: _mistakeNameFontSize,
199+ fontWeight: FontWeight .w600,
200+ letterSpacing: _titleLetterSpacing,
201+ ),
199202 ),
200203 ),
201- ),
202- Padding (
203- padding : const EdgeInsets . only (bottom : padding),
204- child : Text (
205- mistake.message,
206- style : const TextStyle (
207- fontSize : _mistakeMessageFontSize ,
204+ Padding (
205+ padding : const EdgeInsets . only (bottom : padding),
206+ child : Text (
207+ mistake.message,
208+ style : const TextStyle (
209+ fontSize : _mistakeMessageFontSize,
210+ ) ,
208211 ),
209212 ),
210- ),
211- Wrap (
212- spacing : _replacementButtonsSpacing,
213- runSpacing : kIsWeb
214- ? _replacementButtonsSpacing
215- : _replacementButtonsSpacingMobile,
216- children : mistake.replacements
217- . map (
218- (replacement ) => ElevatedButton (
219- onPressed : () => _fixTheMistake (replacement),
220- style : mistakeStyle ??
221- ElevatedButton . styleFrom (
222- elevation : 0 ,
223- minimumSize : const Size ( 40 , 36 ),
224- padding : const EdgeInsets . symmetric (
225- horizontal : 8 ,
213+ Wrap (
214+ spacing : _replacementButtonsSpacing,
215+ runSpacing : kIsWeb
216+ ? _replacementButtonsSpacing
217+ : _replacementButtonsSpacingMobile,
218+ children : mistake.replacements
219+ . map (
220+ (replacement) => ElevatedButton (
221+ onPressed : ( ) => _fixTheMistake (replacement),
222+ style : mistakeStyle ??
223+ ElevatedButton . styleFrom (
224+ elevation : 0 ,
225+ minimumSize : const Size ( 40 , 36 ) ,
226+ padding : const EdgeInsets . symmetric (
227+ horizontal : 8 ,
228+ ) ,
226229 ),
227- ),
228- child : Text (replacement ),
229- ),
230- )
231- . toList ( ),
232- ) ,
233- ] ,
230+ child : Text (replacement ),
231+ ),
232+ )
233+ . toList (),
234+ ),
235+ ] ,
236+ ) ,
234237 ),
235238 ),
236- ) ,
237- ] ,
239+ ] ,
240+ ) ,
238241 ),
239242 ),
240243 ),
0 commit comments