Skip to content

Commit

Permalink
#26: Align URL button and QRCode vertically in event details
Browse files Browse the repository at this point in the history
  • Loading branch information
hjtappe committed Dec 12, 2024
1 parent 9cafc5f commit 0e6910a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 21 deletions.
63 changes: 45 additions & 18 deletions lib/components/url_button.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import 'package:flutter/material.dart';
import 'package:iccm_eu_app/pages/share_page.dart';
import 'package:iccm_eu_app/utils/url_functions.dart';

class UrlButton extends StatelessWidget {
final String? url;
final String title;
final bool? withQrCode;

const UrlButton({
super.key,
required this.url,
required this.title,
this.withQrCode = false,
});

@override
Expand All @@ -20,27 +23,51 @@ class UrlButton extends StatelessWidget {
const SizedBox(height: 16.0),
Center(
child: FractionallySizedBox(
widthFactor: 0.9, // 90% of parent width
child: ElevatedButton(
style: ElevatedButton.styleFrom(
side: BorderSide(
color: Colors.green,
width: 2.0,
style: BorderStyle.solid,
strokeAlign: BorderSide.strokeAlignInside,
widthFactor: 0.9,
child: Row( // Use Row to arrange ElevatedButton and IconButton
mainAxisAlignment: MainAxisAlignment.spaceBetween,
// Space between items
children: [
Expanded( // Allow ElevatedButton to take available space
child: ElevatedButton(
style: ElevatedButton.styleFrom(
side: BorderSide(
color: Colors.green,
width: 2.0,
style: BorderStyle.solid,
strokeAlign: BorderSide.strokeAlignInside,
),
),
onPressed: () => UrlFunctions.launch(url!),
child: Text(
title,
style: const TextStyle(fontSize: 20.0),
),
),
),
),
onPressed: () => UrlFunctions.launch(url!),
child: Text(
title,
style: const TextStyle(
fontSize: 20.0,
),
),
const SizedBox(width: 16.0),
// Add spacing between ElevatedButton and IconButton
(withQrCode ?? false)
? IconButton(
icon: Icon(
Icons.share,
color: Colors.grey[700],
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SharePage(url: url!),
fullscreenDialog: true,
),
);
},
)
: const SizedBox.shrink(),
],
),
),
)
,
),
],
);
} else {
Expand Down
12 changes: 9 additions & 3 deletions lib/pages/event_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,15 @@ class EventDetailsPage extends StatelessWidget {
const SizedBox(height: 8),
if (item.surveyUrl != null &&
item.surveyUrl!.startsWith('https://'))
UrlButton(
title: 'Survey URL',
url: item.surveyUrl,
Column(
children: [
UrlButton(
title: 'Survey URL',
url: item.surveyUrl,
withQrCode: true,
),

]
)
else
SizedBox.shrink(),
Expand Down

0 comments on commit 0e6910a

Please sign in to comment.