Skip to content

refactor(card_templates): reorganize folder structure and implement m…#347

Open
yashmanjunath-74 wants to merge 1 commit intofossasia:mainfrom
yashmanjunath-74:feature/implement-missing-card-templates
Open

refactor(card_templates): reorganize folder structure and implement m…#347
yashmanjunath-74 wants to merge 1 commit intofossasia:mainfrom
yashmanjunath-74:feature/implement-missing-card-templates

Conversation

@yashmanjunath-74
Copy link
Copy Markdown

Title

feat: Implement Event Badge and Entry Pass Tag templates with folder reorganization

Description

This PR resolves GitHub issue #346 by implementing two previously non-functional card templates: Event Badge and Entry Pass Tag. Additionally, the card_templates folder structure has been reorganized for better maintainability and scalability.

Changes Made

1. New Templates Implemented

Event Badge Template

  • Enables creation of event badges and name tags for conferences and professional events
  • Fields: Event Name, Attendee Name, Role, Organization, Ticket ID, Profile Photo, QR Code
  • File structure:
    • lib/card_templates/event_badge/event_badge_model.dart
    • lib/card_templates/event_badge/event_badge_card_widget.dart
    • lib/card_templates/event_badge/event_badge_form.dart

Entry Pass Tag Template

  • Enables generation of visitor passes and access control tags
  • Fields: Venue Name, Visitor Name, Pass Type, Valid Date, Pass ID, Profile Photo, QR Code
  • Field naming: Changed from "hostName" to "venueName" for semantic accuracy
  • File structure:
    • lib/card_templates/entry_pass_tag/entry_pass_tag_model.dart
    • lib/card_templates/entry_pass_tag/entry_pass_tag_card_widget.dart
    • lib/card_templates/entry_pass_tag/entry_pass_tag_form.dart

2. Folder Reorganization

Restructured lib/card_templates/ for better organization:
lib/card_templates/
├── common/
│ └── template_model.dart
├── employee_id/
│ ├── employee_id_model.dart
│ ├── employee_id_card_widget.dart
│ └── employee_id_form.dart
├── price_tag/
│ ├── price_tag_model.dart
│ ├── price_tag_card_widget.dart
│ └── price_tag_form.dart
├── event_badge/
│ ├── event_badge_model.dart
│ ├── event_badge_card_widget.dart
│ └── event_badge_form.dart
├── entry_pass_tag/
│ ├── entry_pass_tag_model.dart
│ ├── entry_pass_tag_card_widget.dart
│ └── entry_pass_tag_form.dart
├── util/
│ └── responsive_layout_util.dart
└── card_template_selection_view.dart

3. Updated Files

  • lib/card_templates/card_template_selection_view.dart

    • Updated imports to reflect new folder structure
    • Enabled all templates (removed "Coming Soon" status)
    • Added navigation routes for Event Badge and Entry Pass Tag
  • lib/l10n/app_en.arb

    • Added 45+ new localization strings for both templates
    • Event Badge strings: eventName, attendeeName, role, organization, ticketId
    • Entry Pass Tag strings: venueName, enterVenueName, visitorName, passType, validDate, passId

Features

✅ QR code generation for both templates
✅ Photo picker integration for visitor/attendee images
✅ Responsive layout support (416x240, 320x240, etc.)
✅ Form validation and data synchronization with preview cards
✅ Localization support (English)
✅ Consistent UI/UX with existing templates

Testing Checklist

  • Event Badge form creates valid QR codes
  • Entry Pass Tag form creates valid QR codes
  • Photo picker works on Android and iOS
  • Responsive layout displays correctly on all screen sizes
  • Import statements work across all platforms
  • Localization strings display correctly
  • No compilation warnings or errors

Related Issue

Fixes #346

Branch

feature/implement-missing-card-templates

Files Changed

  • Added: 6 new files (2 templates × 3 files each)
  • Modified: 2 files (card_template_selection_view.dart, app_en.arb)
  • Reorganized: 7 files (employee_id, price_tag, common templates)
image image image

Copilot AI review requested due to automatic review settings April 15, 2026 22:20
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @yashmanjunath-74, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the previously disabled Event Badge and Entry Pass Tag card templates (issue #346) and reorganizes lib/card_templates/ into per-template subfolders with shared common/util code, plus associated localization additions.

Changes:

  • Added new template implementations for Event Badge and Entry Pass Tag (model, preview card widget, and form flow with QR + photo).
  • Reorganized existing templates (Employee ID, Price Tag) into a new folder structure and updated imports/usages accordingly.
  • Extended English localizations (app_en.arb) with new strings used by the new templates.

Reviewed changes

Copilot reviewed 13 out of 16 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
lib/l10n/app_en.arb Adds localization strings needed for the new templates and related UI text.
lib/card_templates/util/responsive_layout_util.dart Adds layout parameter helpers/types for Event Badge and Entry Pass Tag (reusing Employee ID base layouts).
lib/card_templates/common/template_model.dart Introduces shared TemplateItem model used by the template selection screen.
lib/card_templates/card_template_selection_view.dart Updates template list/navigation to enable and route to the two new templates; updates imports for new structure.
lib/card_templates/employee_id/employee_id_model.dart Adds Employee ID template model in the new folder structure.
lib/card_templates/employee_id/employee_id_form.dart Updates imports to match the new folder structure.
lib/card_templates/employee_id/employee_id_card_widget.dart Updates imports to match the new folder structure.
lib/card_templates/price_tag/price_tag_model.dart Adds Price Tag template model in the new folder structure.
lib/card_templates/price_tag/price_tag_form.dart Updates imports to match the new folder structure.
lib/card_templates/price_tag/price_tag_card_widget.dart Updates imports to match the new folder structure.
lib/card_templates/event_badge/event_badge_model.dart Adds Event Badge template model.
lib/card_templates/event_badge/event_badge_form.dart Adds Event Badge form + generation flow and preview wiring.
lib/card_templates/event_badge/event_badge_card_widget.dart Adds Event Badge preview card widget.
lib/card_templates/entry_pass_tag/entry_pass_tag_model.dart Adds Entry Pass Tag template model.
lib/card_templates/entry_pass_tag/entry_pass_tag_form.dart Adds Entry Pass Tag form + generation flow and preview wiring.
lib/card_templates/entry_pass_tag/entry_pass_tag_card_widget.dart Adds Entry Pass Tag preview card widget.
Comments suppressed due to low confidence (4)

lib/card_templates/employee_id/employee_id_form.dart:1

  • This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.
    lib/card_templates/price_tag/price_tag_form.dart:1
  • This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.
    lib/card_templates/price_tag/price_tag_card_widget.dart:1
  • This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.
    lib/card_templates/employee_id/employee_id_card_widget.dart:1
  • This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +193 to +207
if (_badgeData.qrData.isNotEmpty) {
layers.add(LayerSpec.widget(
widget: BarcodeWidget(
padding: const EdgeInsets.all(2),
backgroundColor: colorWhite,
barcode: Barcode.qrCode(),
data: _badgeData.qrData,
width: layoutParams.qrCodeSize.width,
height: layoutParams.qrCodeSize.height,
),
offset: layoutParams.qrCodeOffset,
scale: layoutParams.qrCodeScale,
));
}
final result = await Navigator.of(context).push<Uint8List>(
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is not dart format-ed (indentation/alignment) and will fail CI’s dart format --set-exit-if-changed check. Re-run dart format on this file before merging.

Copilot uses AI. Check for mistakes.
Comment on lines +193 to +207
if (_passData.qrData.isNotEmpty) {
layers.add(LayerSpec.widget(
widget: BarcodeWidget(
padding: const EdgeInsets.all(2),
backgroundColor: colorWhite,
barcode: Barcode.qrCode(),
data: _passData.qrData,
width: layoutParams.qrCodeSize.width,
height: layoutParams.qrCodeSize.height,
),
offset: layoutParams.qrCodeOffset,
scale: layoutParams.qrCodeScale,
));
}
final result = await Navigator.of(context).push<Uint8List>(
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is not dart format-ed (indentation/alignment) and will fail CI’s dart format --set-exit-if-changed check. Re-run dart format on this file before merging.

Copilot uses AI. Check for mistakes.
Comment on lines +104 to +141
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
color: data.qrData.isNotEmpty ? Colors.transparent : Colors.grey.shade100,
borderRadius: BorderRadius.circular(4),
border: data.qrData.isNotEmpty ? null : Border.all(color: Colors.grey.shade300),
),
child: data.qrData.isNotEmpty
? BarcodeWidget(
barcode: Barcode.qrCode(),
data: data.qrData,
width: 48,
height: 48,
padding: const EdgeInsets.all(2),
backgroundColor: Colors.white,
)
: Icon(
Icons.qr_code,
color: Colors.grey.shade400,
size: 24,
),
),
const SizedBox(height: 8),
const Divider(),
const SizedBox(height: 4),
Text(
data.eventName.isEmpty ? appLocalizations.eventName : data.eventName.toUpperCase(),
style: TextStyle(
fontSize: 11,
color: Colors.grey.shade800,
fontWeight: FontWeight.bold,
letterSpacing: 0.5,
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are not dart format-ed (indentation/alignment) and will fail CI’s dart format --set-exit-if-changed check. Re-run dart format on this file before merging.

Suggested change
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
color: data.qrData.isNotEmpty ? Colors.transparent : Colors.grey.shade100,
borderRadius: BorderRadius.circular(4),
border: data.qrData.isNotEmpty ? null : Border.all(color: Colors.grey.shade300),
),
child: data.qrData.isNotEmpty
? BarcodeWidget(
barcode: Barcode.qrCode(),
data: data.qrData,
width: 48,
height: 48,
padding: const EdgeInsets.all(2),
backgroundColor: Colors.white,
)
: Icon(
Icons.qr_code,
color: Colors.grey.shade400,
size: 24,
),
),
const SizedBox(height: 8),
const Divider(),
const SizedBox(height: 4),
Text(
data.eventName.isEmpty ? appLocalizations.eventName : data.eventName.toUpperCase(),
style: TextStyle(
fontSize: 11,
color: Colors.grey.shade800,
fontWeight: FontWeight.bold,
letterSpacing: 0.5,
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
color: data.qrData.isNotEmpty
? Colors.transparent
: Colors.grey.shade100,
borderRadius: BorderRadius.circular(4),
border: data.qrData.isNotEmpty
? null
: Border.all(color: Colors.grey.shade300),
),
child: data.qrData.isNotEmpty
? BarcodeWidget(
barcode: Barcode.qrCode(),
data: data.qrData,
width: 48,
height: 48,
padding: const EdgeInsets.all(2),
backgroundColor: Colors.white,
)
: Icon(
Icons.qr_code,
color: Colors.grey.shade400,
size: 24,
),
),
const SizedBox(height: 8),
const Divider(),
const SizedBox(height: 4),
Text(
data.eventName.isEmpty
? appLocalizations.eventName
: data.eventName.toUpperCase(),
style: TextStyle(
fontSize: 11,
color: Colors.grey.shade800,
fontWeight: FontWeight.bold,

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +35
final _formKey = GlobalKey<FormState>();
final _eventNameController = TextEditingController();
final _attendeeNameController = TextEditingController();
final _roleController = TextEditingController();
final _organizationController = TextEditingController();
final _ticketIdController = TextEditingController();
final _qrDataController = TextEditingController();
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_formKey is wired into the Form, but _submitForm never calls validate() and no validators are provided to the fields. Either implement validation (and call it before generating) or remove the unused form key/validator plumbing to avoid misleading “validation” behavior.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,22 @@
import 'dart:io';
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.

Suggested change
import 'dart:io';
import 'dart:io';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,210 @@
import 'dart:io';
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.

Suggested change
import 'dart:io';
import 'dart:io';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,22 @@
import 'dart:io';
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.

Suggested change
import 'dart:io';
import 'dart:io';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,648 @@
import 'dart:io';
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.

Suggested change
import 'dart:io';
import 'dart:io';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,649 @@
import 'dart:io';
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file begins with a UTF-8 BOM / zero-width character before the first import (visible as import). This commonly causes dart format --set-exit-if-changed to fail; please remove the BOM so formatting stays stable in CI.

Suggested change
import 'dart:io';
import 'dart:io';

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +36
final _formKey = GlobalKey<FormState>();
final _venueNameController = TextEditingController();
final _visitorNameController = TextEditingController();
final _passTypeController = TextEditingController();
final _validDateController = TextEditingController();
final _passIdController = TextEditingController();
final _qrDataController = TextEditingController();
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_formKey is wired into the Form, but _submitForm never calls validate() and no validators are provided to the fields. Either implement validation (and call it before generating) or remove the unused form key/validator plumbing to avoid misleading “validation” behavior.

Copilot uses AI. Check for mistakes.
@yashmanjunath-74 yashmanjunath-74 force-pushed the feature/implement-missing-card-templates branch from 1256f87 to 4f9122c Compare April 16, 2026 20:14
@Vishveshwara
Copy link
Copy Markdown
Contributor

@yashmanjunath-74 Please provide videos of the update, by submitting the form.

and also we don't need the blue borders around the card, it should be similar to the image we are getting after submitting the form.
image

@Vishveshwara Vishveshwara self-requested a review April 17, 2026 11:05
@yashmanjunath-74
Copy link
Copy Markdown
Author

@yashmanjunath-74 Please provide videos of the update, by submitting the form.

and also we don't need the blue borders around the card, it should be similar to the image we are getting after submitting the form. image

sure i will make change and give video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: Missing Functionality for Specific Card Templates

3 participants