Skip to content

Commit

Permalink
implemented qr code scanner in event_hub_screen.dart
Browse files Browse the repository at this point in the history
implemented qr code generator in host_view_ticket_preview.dart

digital signature certificate key pair generation on qrcode and validation is left to implement on scanning
  • Loading branch information
Raviramnani1 committed Aug 11, 2024
1 parent 9449118 commit ebdf418
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 16 deletions.
91 changes: 76 additions & 15 deletions evently/lib/screens/event_hub/event_hub_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:focus_detector/focus_detector.dart';
import 'package:provider/provider.dart';
import 'package:shimmer_animation/shimmer_animation.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';

class EventHubScreen extends StatefulWidget {
const EventHubScreen({super.key});
Expand Down Expand Up @@ -240,21 +241,46 @@ class _EventHubContentState extends State<EventHubContent> {
}

Widget getCreateEventWidget() {
return Padding(
padding: EdgeInsets.only(bottom: 20.h),
child: ClippedButton(
title: LocaleKeys.create_event.tr(),
bgColor: EventlyAppTheme.kBlue,
textColor: EventlyAppTheme.kWhite,
onPressed: () {
Navigator.of(context).pushNamed(RouteUtil.kCreateEvent);
},
cuttingHeight: 15.h,
clipperType: ClipperType.bottomLeftTopRight,
isShadow: false,
fontWeight: FontWeight.w700,
fontSize: 14,
),
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(bottom: 20.h), // Adjust the padding as needed
child: ClippedButton(
title: 'Scan Ticket!', // Add your localized title here if needed
bgColor: EventlyAppTheme.kBlue,
textColor: EventlyAppTheme.kWhite,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => QRViewExample()),
);
// Add your QR code scanning logic here
},
cuttingHeight: 15.h,
clipperType: ClipperType.bottomLeftTopRight,
isShadow: false,
fontWeight: FontWeight.w700,
fontSize: 14,
),
),
Padding(
padding: EdgeInsets.only(bottom: 20.h),
child: ClippedButton(
title: LocaleKeys.create_event.tr(),
bgColor: EventlyAppTheme.kBlue,
textColor: EventlyAppTheme.kWhite,
onPressed: () {
Navigator.of(context).pushNamed(RouteUtil.kCreateEvent);
},
cuttingHeight: 15.h,
clipperType: ClipperType.bottomLeftTopRight,
isShadow: false,
fontWeight: FontWeight.w700,
fontSize: 14,
),
),
],
);
}
}
Expand Down Expand Up @@ -453,3 +479,38 @@ class BuildGridView extends StatelessWidget {
);
}
}

class QRViewExample extends StatefulWidget {
@override
State<StatefulWidget> createState() => _QRViewExampleState();
}

class _QRViewExampleState extends State<QRViewExample> {
late QRViewController controller;
final GlobalKey qrKey = GlobalKey();

@override
void dispose() {
controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: QRView(
key: qrKey,
onQRViewCreated: _onQRViewCreated,
),
);
}

void _onQRViewCreated(QRViewController newController) {
this.controller = newController;
controller.scannedDataStream.listen((scanData) {
// Handle the scanned QR code data here
print(scanData.code);
// Implement dsc validation
});
}
}
13 changes: 12 additions & 1 deletion evently/lib/screens/host_view_ticket_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:pylons_sdk/pylons_sdk.dart';
import 'package:qr_flutter/qr_flutter.dart';

class HostTicketPreview extends StatefulWidget {
const HostTicketPreview({super.key});
Expand Down Expand Up @@ -204,8 +205,18 @@ class _HostTicketPreviewState extends State<HostTicketPreview> {
],
),
),
VerticalSpace(30.h),
VerticalSpace(22.h),
Image.asset(PngUtils.kDottedLine),
//implement digital certificate in qrcode
//currently for demo location of event is set in qr code

QrImageView(
data: provider.location,
version: QrVersions.auto,
size: 180.0,
foregroundColor: Colors.white,
),

],
),
],
Expand Down

0 comments on commit ebdf418

Please sign in to comment.