Skip to content

Commit 52e5539

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!20
1 parent 1043de4 commit 52e5539

3 files changed

Lines changed: 172 additions & 135 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.5-dev
1+
## 8.1.6-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: 170 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -110,190 +110,227 @@ class _OSAMDialogState extends State<OSAMDialog> {
110110
}
111111

112112
return Dialog(
113+
insetPadding: const EdgeInsets.symmetric(horizontal: 40, vertical: 24),
113114
backgroundColor: backgroundColor,
114115
shape: RoundedRectangleBorder(
115116
borderRadius: BorderRadius.circular(20),
116117
),
117-
child: SingleChildScrollView(
118-
child: Padding(
119-
padding: const EdgeInsets.fromLTRB(24, 16, 24, 24),
120-
child: Column(
121-
mainAxisSize: MainAxisSize.min,
122-
children: [
123-
if (widget.showClose)
124-
Align(
125-
alignment: Alignment.topRight,
126-
child: IconButton(
127-
padding: EdgeInsets.zero,
128-
constraints: const BoxConstraints(),
129-
icon: Icon(
130-
Icons.close,
131-
color: closeIconColor,
132-
size: 24,
133-
),
134-
onPressed: () => Navigator.of(context).pop(
135-
VersionControlResult(
136-
response: VersionControlResponse.CANCELLED,
137-
isCheckBoxChecked: _dontShowAgain,
118+
child: ConstrainedBox(
119+
constraints: const BoxConstraints(
120+
minWidth: 300,
121+
maxWidth: 450,
122+
),
123+
child: SingleChildScrollView(
124+
child: Padding(
125+
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,
139+
),
140+
onPressed: () => Navigator.of(context).pop(
141+
VersionControlResult(
142+
response: VersionControlResponse.CANCELLED,
143+
isCheckBoxChecked: _dontShowAgain,
144+
),
138145
),
139146
),
140147
),
141-
),
142-
if (widget.appIcon != null)
148+
if (widget.appIcon != null)
149+
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,
155+
),
156+
),
143157
Padding(
144-
padding: const EdgeInsets.only(top: 8.0),
145-
child: SizedBox(
146-
width: 72,
147-
height: 72,
148-
child: widget.appIcon,
158+
padding: const EdgeInsets.only(top: 16.0),
159+
child: Semantics(
160+
header: true,
161+
child: Text(
162+
widget.version.title.localize(widget.language),
163+
style: TextStyle(
164+
fontSize: 22,
165+
fontWeight: FontWeight.w700,
166+
color: textColor,
167+
height: 1.2,
168+
),
169+
textAlign: TextAlign.center,
170+
),
149171
),
150172
),
151-
Padding(
152-
padding: const EdgeInsets.only(top: 16.0),
153-
child: Semantics(
154-
header: true,
173+
Padding(
174+
padding: const EdgeInsets.only(top: 16.0),
155175
child: Text(
156-
widget.version.title.localize(widget.language),
176+
widget.version.message.localize(widget.language),
157177
style: TextStyle(
158-
fontSize: 22,
159-
fontWeight: FontWeight.w600,
178+
fontSize: 16,
160179
color: textColor,
180+
height: 1.4,
161181
),
162182
textAlign: TextAlign.center,
163183
),
164184
),
165-
),
166-
Padding(
167-
padding: const EdgeInsets.only(top: 12.0),
168-
child: Text(
169-
widget.version.message.localize(widget.language),
170-
style: TextStyle(
171-
fontSize: 16,
172-
color: textColor,
173-
height: 1.1,
174-
),
175-
textAlign: TextAlign.center,
176-
),
177-
),
178-
if (widget.showCheckBox &&
179-
widget.version.checkBoxDontShowAgain.isCheckBoxVisible)
180-
Padding(
181-
padding: const EdgeInsets.only(top: 16.0),
182-
child: Row(
183-
mainAxisAlignment: MainAxisAlignment.center,
184-
children: [
185-
Theme(
186-
data: ThemeData(
187-
unselectedWidgetColor: UIHelper.mediumLightGrey,
188-
),
189-
child: Checkbox(
190-
value: _dontShowAgain,
191-
activeColor: checkboxActiveColor,
192-
checkColor: checkboxCheckColor,
193-
onChanged: (value) {
194-
setState(() {
195-
_dontShowAgain = value ?? false;
196-
});
197-
},
198-
),
199-
),
200-
Flexible(
201-
child: Text(
202-
widget.version.checkBoxDontShowAgain.text
203-
.localize(widget.language),
204-
style: TextStyle(color: textColor),
205-
),
206-
),
207-
],
208-
),
209-
),
210-
Padding(
211-
padding: const EdgeInsets.only(top: 20.0),
212-
child: SizedBox(
213-
width: double.infinity,
214-
height: 48,
215-
child: widget.applyComModStyles
216-
? ElevatedButton(
217-
onPressed: () => Navigator.of(context).pop(
218-
VersionControlResult(
219-
response: VersionControlResponse.ACCEPTED,
220-
isCheckBoxChecked: _dontShowAgain,
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,
221201
),
222-
),
223-
style: ElevatedButton.styleFrom(
224-
backgroundColor: primaryButtonColor,
225-
foregroundColor: primaryButtonTextColor,
226-
shape: RoundedRectangleBorder(
227-
borderRadius: BorderRadius.circular(28),
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+
},
216+
),
228217
),
229-
elevation: 0,
230-
),
231-
child: Text(
232-
widget.version.ok.localize(widget.language),
233-
style: const TextStyle(fontSize: 16),
234218
),
235-
)
236-
: TextButton(
237-
onPressed: () => Navigator.of(context).pop(
238-
VersionControlResult(
239-
response: VersionControlResponse.ACCEPTED,
240-
isCheckBoxChecked: _dontShowAgain,
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+
),
241228
),
242229
),
243-
style: TextButton.styleFrom(
244-
foregroundColor: primaryButtonTextColor,
245-
),
246-
child: Text(
247-
widget.version.ok.localize(widget.language),
248-
style: const TextStyle(fontSize: 16),
249-
),
250-
),
251-
),
252-
),
253-
if (widget.showNegative)
230+
],
231+
),
232+
),
233+
),
254234
Padding(
255-
padding: const EdgeInsets.only(top: 12.0),
235+
padding: const EdgeInsets.only(top: 24.0),
256236
child: SizedBox(
257237
width: double.infinity,
258-
height: 48,
238+
height: 52,
259239
child: widget.applyComModStyles
260-
? OutlinedButton(
240+
? ElevatedButton(
261241
onPressed: () => Navigator.of(context).pop(
262242
VersionControlResult(
263-
response: VersionControlResponse.CANCELLED,
243+
response: VersionControlResponse.ACCEPTED,
264244
isCheckBoxChecked: _dontShowAgain,
265245
),
266246
),
267-
style: OutlinedButton.styleFrom(
268-
side: secondaryButtonBorder,
247+
style: ElevatedButton.styleFrom(
248+
backgroundColor: primaryButtonColor,
249+
foregroundColor: primaryButtonTextColor,
269250
shape: RoundedRectangleBorder(
270251
borderRadius: BorderRadius.circular(28),
271252
),
272-
foregroundColor: secondaryButtonTextColor,
253+
elevation: 0,
273254
),
274255
child: Text(
275-
widget.version.cancel.localize(widget.language),
276-
style: const TextStyle(fontSize: 16),
256+
widget.version.ok.localize(widget.language),
257+
style: const TextStyle(
258+
fontSize: 16,
259+
fontWeight: FontWeight.w600,
260+
),
277261
),
278262
)
279263
: TextButton(
280264
onPressed: () => Navigator.of(context).pop(
281265
VersionControlResult(
282-
response: VersionControlResponse.CANCELLED,
266+
response: VersionControlResponse.ACCEPTED,
283267
isCheckBoxChecked: _dontShowAgain,
284268
),
285269
),
286270
style: TextButton.styleFrom(
287-
foregroundColor: secondaryButtonTextColor,
271+
foregroundColor: primaryButtonTextColor,
288272
),
289273
child: Text(
290-
widget.version.cancel.localize(widget.language),
291-
style: const TextStyle(fontSize: 16),
274+
widget.version.ok.localize(widget.language),
275+
style: const TextStyle(
276+
fontSize: 16,
277+
fontWeight: FontWeight.w700,
278+
),
292279
),
293280
),
294281
),
295282
),
296-
],
283+
if (widget.showNegative)
284+
Padding(
285+
padding: const EdgeInsets.only(top: 12.0),
286+
child: SizedBox(
287+
width: double.infinity,
288+
height: 52,
289+
child: widget.applyComModStyles
290+
? OutlinedButton(
291+
onPressed: () => Navigator.of(context).pop(
292+
VersionControlResult(
293+
response: VersionControlResponse.CANCELLED,
294+
isCheckBoxChecked: _dontShowAgain,
295+
),
296+
),
297+
style: OutlinedButton.styleFrom(
298+
side: secondaryButtonBorder,
299+
shape: RoundedRectangleBorder(
300+
borderRadius: BorderRadius.circular(28),
301+
),
302+
foregroundColor: secondaryButtonTextColor,
303+
),
304+
child: Text(
305+
widget.version.cancel.localize(widget.language),
306+
style: const TextStyle(
307+
fontSize: 16,
308+
fontWeight: FontWeight.w600,
309+
),
310+
),
311+
)
312+
: TextButton(
313+
onPressed: () => Navigator.of(context).pop(
314+
VersionControlResult(
315+
response: VersionControlResponse.CANCELLED,
316+
isCheckBoxChecked: _dontShowAgain,
317+
),
318+
),
319+
style: TextButton.styleFrom(
320+
foregroundColor: secondaryButtonTextColor,
321+
),
322+
child: Text(
323+
widget.version.cancel.localize(widget.language),
324+
style: const TextStyle(
325+
fontSize: 16,
326+
fontWeight: FontWeight.w600,
327+
),
328+
),
329+
),
330+
),
331+
),
332+
],
333+
),
297334
),
298335
),
299336
),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: osam_common_module_flutter
22
description: OSAM's Flutter common module
3-
version: 8.1.5-dev
3+
version: 8.1.6-dev
44
homepage: 'https://ajuntament.barcelona.cat/imi/ca/oficina-de-serveis-al-mobil'
55
issue_tracker: 'https://github.com/AjuntamentdeBarcelona/modul_comu_osam_flutter/issues'
66
repository: 'https://github.com/AjuntamentdeBarcelona/modul_comu_osam_flutter'

0 commit comments

Comments
 (0)