@@ -44,9 +44,11 @@ class ErrorMessageBubble extends StatelessWidget {
4444 this .action,
4545 this .tailPosition = TailPosition .bottom,
4646 this .padding = const EdgeInsets .only (left: 72.0 ),
47+ this .width,
4748 });
4849
4950 final EdgeInsets padding;
51+ final double ? width;
5052
5153 final Widget errorMessage;
5254 final TextButton ? action;
@@ -65,10 +67,12 @@ class ErrorMessageBubble extends StatelessWidget {
6567 style: Theme .of (context).textTheme.bodyLarge! .copyWith (
6668 color: Theme .of (context).colorScheme.error,
6769 decorationColor: Theme .of (context).colorScheme.error,
70+ letterSpacing: 0 ,
6871 ),
6972 child: _MessageBubbleBody (
7073 errorMessage: errorMessage,
7174 action: action,
75+ width: width,
7276 ),
7377 );
7478
@@ -144,49 +148,55 @@ class _MessageBubbleBody extends StatelessWidget {
144148 const _MessageBubbleBody ({
145149 required this .errorMessage,
146150 required this .action,
151+ required this .width,
147152 });
148153
149154 final Widget errorMessage;
150155 final Widget ? action;
156+ final double ? width;
151157
152158 @override
153159 Widget build (BuildContext context) {
154160 final colorScheme = Theme .of (context).colorScheme;
155161 return Container (
162+ width: width,
156163 padding: const EdgeInsets .symmetric (horizontal: 21 , vertical: 13.5 ),
157164 decoration: BoxDecoration (
158165 borderRadius: BorderRadius .circular (16 ),
159166 color: colorScheme.errorContainer,
160167 ),
161- child: Row (
162- mainAxisAlignment: MainAxisAlignment .spaceBetween,
163- children: [
164- errorMessage,
165- TextButtonTheme (
166- data: TextButtonThemeData (
167- style: ButtonStyle (
168- backgroundColor: WidgetStateProperty .all (
169- Colors .transparent,
168+ child: action == null
169+ ? errorMessage
170+ : Row (
171+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
172+ children: [
173+ Flexible (child: errorMessage),
174+ TextButtonTheme (
175+ data: TextButtonThemeData (
176+ style: ButtonStyle (
177+ backgroundColor: WidgetStateProperty .all (
178+ Colors .transparent,
179+ ),
180+ overlayColor: WidgetStateProperty .all (
181+ Colors .transparent,
182+ ),
183+ elevation: WidgetStateProperty .all (0 ),
184+ foregroundColor: WidgetStateProperty .all (
185+ Theme .of (context).colorScheme.error,
186+ ),
187+ textStyle: WidgetStateProperty .all (
188+ DefaultTextStyle .of (context).style,
189+ ),
190+ padding: WidgetStateProperty .all (
191+ const EdgeInsets .symmetric (horizontal: 0 ),
192+ ),
193+ tapTargetSize: MaterialTapTargetSize .shrinkWrap,
194+ ),
170195 ),
171- overlayColor: WidgetStateProperty .all (
172- Colors .transparent,
173- ),
174- elevation: WidgetStateProperty .all (0 ),
175- foregroundColor: WidgetStateProperty .all (
176- Theme .of (context).colorScheme.error,
177- ),
178- textStyle: WidgetStateProperty .all (
179- DefaultTextStyle .of (context).style,
180- ),
181- padding: WidgetStateProperty .all (
182- const EdgeInsets .symmetric (horizontal: 0 ),
183- ),
184- tapTargetSize: MaterialTapTargetSize .shrinkWrap,
185- ),
186- ),
187- child: action ?? const SizedBox .shrink ())
188- ],
189- ),
196+ child: action! ,
197+ )
198+ ],
199+ ),
190200 );
191201 }
192202}
0 commit comments