Skip to content

Commit c804284

Browse files
author
Alberto Aguilar Garcia WORDLINE
committed
Merge branch 'OSAM-21579_version_control_popup_flexibility' into 'feat/OSAM_april_2026'
OSAM-21579_version_control_popup_flexibility See merge request osam/common_module_flutter!21
1 parent 52e5539 commit c804284

3 files changed

Lines changed: 167 additions & 156 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 8.1.6-dev
1+
## 8.1.7-dev
22

33
* IMPLEMENTED STYLES FLEXIBILITY FOR CUSTOM POPUPS
44
* Added a parameter when building the version control popup for adding foreign styles or keeping their own.

lib/src/ui/ui_helper.dart

Lines changed: 165 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -110,199 +110,158 @@ class _OSAMDialogState extends State<OSAMDialog> {
110110
}
111111

112112
return Dialog(
113-
insetPadding: const EdgeInsets.symmetric(horizontal: 40, vertical: 24),
113+
alignment: Alignment.center,
114+
insetPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
114115
backgroundColor: backgroundColor,
115116
shape: RoundedRectangleBorder(
116117
borderRadius: BorderRadius.circular(20),
117118
),
118119
child: ConstrainedBox(
119-
constraints: const BoxConstraints(
120-
minWidth: 300,
121-
maxWidth: 450,
120+
constraints: BoxConstraints(
121+
minWidth: 280,
122+
maxWidth: MediaQuery.of(context).size.width * 0.9,
122123
),
123124
child: SingleChildScrollView(
124125
child: Padding(
125126
padding: const EdgeInsets.fromLTRB(24, 24, 24, 24),
126-
child: Column(
127-
mainAxisSize: MainAxisSize.min,
128-
children: [
129-
if (widget.showClose)
130-
Align(
131-
alignment: Alignment.topRight,
132-
child: IconButton(
133-
padding: EdgeInsets.zero,
134-
constraints: const BoxConstraints(),
135-
icon: Icon(
136-
Icons.close,
137-
color: closeIconColor,
138-
size: 24,
127+
child: Container(
128+
constraints: BoxConstraints(
129+
minHeight: MediaQuery.of(context).size.height * 0.4,
130+
),
131+
child: Column(
132+
mainAxisSize: MainAxisSize.min,
133+
crossAxisAlignment: CrossAxisAlignment.stretch,
134+
children: [
135+
if (widget.showClose)
136+
Align(
137+
alignment: Alignment.topRight,
138+
child: IconButton(
139+
padding: EdgeInsets.zero,
140+
constraints: const BoxConstraints(),
141+
icon: Icon(
142+
Icons.close,
143+
color: closeIconColor,
144+
size: 24,
145+
),
146+
onPressed: () => Navigator.of(context).pop(
147+
VersionControlResult(
148+
response: VersionControlResponse.CANCELLED,
149+
isCheckBoxChecked: _dontShowAgain,
150+
),
151+
),
139152
),
140-
onPressed: () => Navigator.of(context).pop(
141-
VersionControlResult(
142-
response: VersionControlResponse.CANCELLED,
143-
isCheckBoxChecked: _dontShowAgain,
153+
),
154+
if (widget.appIcon != null)
155+
Center(
156+
child: Padding(
157+
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
158+
child: SizedBox(
159+
width: 80,
160+
height: 80,
161+
child: widget.appIcon,
144162
),
145163
),
146164
),
147-
),
148-
if (widget.appIcon != null)
149165
Padding(
150-
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
151-
child: SizedBox(
152-
width: 80,
153-
height: 80,
154-
child: widget.appIcon,
166+
padding: const EdgeInsets.only(top: 16.0),
167+
child: Semantics(
168+
header: true,
169+
child: Text(
170+
widget.version.title.localize(widget.language),
171+
style: TextStyle(
172+
fontSize: 22,
173+
fontWeight: FontWeight.w700,
174+
color: textColor,
175+
height: 1.2,
176+
),
177+
textAlign: TextAlign.center,
178+
),
155179
),
156180
),
157-
Padding(
158-
padding: const EdgeInsets.only(top: 16.0),
159-
child: Semantics(
160-
header: true,
181+
Padding(
182+
padding: const EdgeInsets.only(top: 16.0),
161183
child: Text(
162-
widget.version.title.localize(widget.language),
184+
widget.version.message.localize(widget.language),
163185
style: TextStyle(
164-
fontSize: 22,
165-
fontWeight: FontWeight.w700,
186+
fontSize: 16,
166187
color: textColor,
167-
height: 1.2,
188+
height: 1.4,
168189
),
169190
textAlign: TextAlign.center,
170191
),
171192
),
172-
),
173-
Padding(
174-
padding: const EdgeInsets.only(top: 16.0),
175-
child: Text(
176-
widget.version.message.localize(widget.language),
177-
style: TextStyle(
178-
fontSize: 16,
179-
color: textColor,
180-
height: 1.4,
181-
),
182-
textAlign: TextAlign.center,
183-
),
184-
),
185-
if (widget.showCheckBox &&
186-
widget.version.checkBoxDontShowAgain.isCheckBoxVisible)
187-
Padding(
188-
padding: const EdgeInsets.only(top: 20.0),
189-
child: InkWell(
190-
onTap: () {
191-
setState(() {
192-
_dontShowAgain = !_dontShowAgain;
193-
});
194-
},
195-
child: Row(
196-
mainAxisAlignment: MainAxisAlignment.center,
197-
children: [
198-
Theme(
199-
data: ThemeData(
200-
unselectedWidgetColor: UIHelper.mediumLightGrey,
201-
),
202-
child: SizedBox(
203-
width: 24,
204-
height: 24,
205-
child: Checkbox(
206-
value: _dontShowAgain,
207-
activeColor: checkboxActiveColor,
208-
checkColor: checkboxCheckColor,
209-
materialTapTargetSize:
210-
MaterialTapTargetSize.shrinkWrap,
211-
onChanged: (value) {
212-
setState(() {
213-
_dontShowAgain = value ?? false;
214-
});
215-
},
193+
if (widget.showCheckBox &&
194+
widget.version.checkBoxDontShowAgain.isCheckBoxVisible)
195+
Padding(
196+
padding: const EdgeInsets.only(top: 20.0),
197+
child: InkWell(
198+
onTap: () {
199+
setState(() {
200+
_dontShowAgain = !_dontShowAgain;
201+
});
202+
},
203+
child: Row(
204+
mainAxisAlignment: MainAxisAlignment.center,
205+
children: [
206+
Theme(
207+
data: ThemeData(
208+
unselectedWidgetColor: UIHelper.mediumLightGrey,
209+
),
210+
child: SizedBox(
211+
width: 24,
212+
height: 24,
213+
child: Checkbox(
214+
value: _dontShowAgain,
215+
activeColor: checkboxActiveColor,
216+
checkColor: checkboxCheckColor,
217+
materialTapTargetSize:
218+
MaterialTapTargetSize.shrinkWrap,
219+
onChanged: (value) {
220+
setState(() {
221+
_dontShowAgain = value ?? false;
222+
});
223+
},
224+
),
216225
),
217226
),
218-
),
219-
const SizedBox(width: 8),
220-
Flexible(
221-
child: Text(
222-
widget.version.checkBoxDontShowAgain.text
223-
.localize(widget.language),
224-
style: TextStyle(
225-
color: textColor,
226-
fontSize: 14,
227+
const SizedBox(width: 8),
228+
Flexible(
229+
child: Text(
230+
widget.version.checkBoxDontShowAgain.text
231+
.localize(widget.language),
232+
style: TextStyle(
233+
color: textColor,
234+
fontSize: 14,
235+
),
227236
),
228237
),
229-
),
230-
],
238+
],
239+
),
231240
),
232241
),
233-
),
234-
Padding(
235-
padding: const EdgeInsets.only(top: 24.0),
236-
child: SizedBox(
237-
width: double.infinity,
238-
height: 52,
239-
child: widget.applyComModStyles
240-
? ElevatedButton(
241-
onPressed: () => Navigator.of(context).pop(
242-
VersionControlResult(
243-
response: VersionControlResponse.ACCEPTED,
244-
isCheckBoxChecked: _dontShowAgain,
245-
),
246-
),
247-
style: ElevatedButton.styleFrom(
248-
backgroundColor: primaryButtonColor,
249-
foregroundColor: primaryButtonTextColor,
250-
shape: RoundedRectangleBorder(
251-
borderRadius: BorderRadius.circular(28),
252-
),
253-
elevation: 0,
254-
),
255-
child: Text(
256-
widget.version.ok.localize(widget.language),
257-
style: const TextStyle(
258-
fontSize: 16,
259-
fontWeight: FontWeight.w600,
260-
),
261-
),
262-
)
263-
: TextButton(
264-
onPressed: () => Navigator.of(context).pop(
265-
VersionControlResult(
266-
response: VersionControlResponse.ACCEPTED,
267-
isCheckBoxChecked: _dontShowAgain,
268-
),
269-
),
270-
style: TextButton.styleFrom(
271-
foregroundColor: primaryButtonTextColor,
272-
),
273-
child: Text(
274-
widget.version.ok.localize(widget.language),
275-
style: const TextStyle(
276-
fontSize: 16,
277-
fontWeight: FontWeight.w700,
278-
),
279-
),
280-
),
281-
),
282-
),
283-
if (widget.showNegative)
284242
Padding(
285-
padding: const EdgeInsets.only(top: 12.0),
243+
padding: const EdgeInsets.only(top: 24.0),
286244
child: SizedBox(
287245
width: double.infinity,
288246
height: 52,
289247
child: widget.applyComModStyles
290-
? OutlinedButton(
248+
? ElevatedButton(
291249
onPressed: () => Navigator.of(context).pop(
292250
VersionControlResult(
293-
response: VersionControlResponse.CANCELLED,
251+
response: VersionControlResponse.ACCEPTED,
294252
isCheckBoxChecked: _dontShowAgain,
295253
),
296254
),
297-
style: OutlinedButton.styleFrom(
298-
side: secondaryButtonBorder,
255+
style: ElevatedButton.styleFrom(
256+
backgroundColor: primaryButtonColor,
257+
foregroundColor: primaryButtonTextColor,
299258
shape: RoundedRectangleBorder(
300259
borderRadius: BorderRadius.circular(28),
301260
),
302-
foregroundColor: secondaryButtonTextColor,
261+
elevation: 0,
303262
),
304263
child: Text(
305-
widget.version.cancel.localize(widget.language),
264+
widget.version.ok.localize(widget.language),
306265
style: const TextStyle(
307266
fontSize: 16,
308267
fontWeight: FontWeight.w600,
@@ -312,24 +271,76 @@ class _OSAMDialogState extends State<OSAMDialog> {
312271
: TextButton(
313272
onPressed: () => Navigator.of(context).pop(
314273
VersionControlResult(
315-
response: VersionControlResponse.CANCELLED,
274+
response: VersionControlResponse.ACCEPTED,
316275
isCheckBoxChecked: _dontShowAgain,
317276
),
318277
),
319278
style: TextButton.styleFrom(
320-
foregroundColor: secondaryButtonTextColor,
279+
foregroundColor: primaryButtonTextColor,
321280
),
322281
child: Text(
323-
widget.version.cancel.localize(widget.language),
282+
widget.version.ok.localize(widget.language),
324283
style: const TextStyle(
325284
fontSize: 16,
326-
fontWeight: FontWeight.w600,
285+
fontWeight: FontWeight.w700,
327286
),
328287
),
329288
),
330289
),
331290
),
332-
],
291+
if (widget.showNegative)
292+
Padding(
293+
padding: const EdgeInsets.only(top: 12.0),
294+
child: SizedBox(
295+
width: double.infinity,
296+
height: 52,
297+
child: widget.applyComModStyles
298+
? OutlinedButton(
299+
onPressed: () => Navigator.of(context).pop(
300+
VersionControlResult(
301+
response: VersionControlResponse.CANCELLED,
302+
isCheckBoxChecked: _dontShowAgain,
303+
),
304+
),
305+
style: OutlinedButton.styleFrom(
306+
side: secondaryButtonBorder,
307+
shape: RoundedRectangleBorder(
308+
borderRadius: BorderRadius.circular(28),
309+
),
310+
foregroundColor: secondaryButtonTextColor,
311+
),
312+
child: Text(
313+
widget.version.cancel
314+
.localize(widget.language),
315+
style: const TextStyle(
316+
fontSize: 16,
317+
fontWeight: FontWeight.w600,
318+
),
319+
),
320+
)
321+
: TextButton(
322+
onPressed: () => Navigator.of(context).pop(
323+
VersionControlResult(
324+
response: VersionControlResponse.CANCELLED,
325+
isCheckBoxChecked: _dontShowAgain,
326+
),
327+
),
328+
style: TextButton.styleFrom(
329+
foregroundColor: secondaryButtonTextColor,
330+
),
331+
child: Text(
332+
widget.version.cancel
333+
.localize(widget.language),
334+
style: const TextStyle(
335+
fontSize: 16,
336+
fontWeight: FontWeight.w600,
337+
),
338+
),
339+
),
340+
),
341+
),
342+
],
343+
),
333344
),
334345
),
335346
),

0 commit comments

Comments
 (0)