Skip to content

Commit

Permalink
Add qr code screen
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHanafy725 committed Sep 26, 2024
1 parent f1323e3 commit 312ac0b
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 25 deletions.
59 changes: 59 additions & 0 deletions app/lib/screens/qr_code_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* QR.Flutter
* Copyright (c) 2019 the QR.Flutter authors.
* See LICENSE for distribution and usage details.
*/

import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:screen_brightness/screen_brightness.dart';
import 'package:threebotlogin/widgets/custom_dialog.dart';

/// This is the screen that you'll see when the app starts
class GenerateQRCodeScreen extends StatefulWidget {
const GenerateQRCodeScreen({
super.key,
required this.message,
});

final String message;

@override
State<GenerateQRCodeScreen> createState() => _GenerateQRCodeScreenState();
}

class _GenerateQRCodeScreenState extends State<GenerateQRCodeScreen> {
@override
void initState() {
ScreenBrightness().setScreenBrightness(1);
super.initState();
}

@override
Widget build(BuildContext context) {
return CustomDialog(
title: 'Scan QR code',
image: Icons.qr_code,
widgetDescription: Center(
child: Container(
color: Colors.white,
width: 280,
child: QrImageView(
data: widget.message,
version: QrVersions.auto,
),
),
),
actions: [
TextButton(
child: const Text('Close'),
onPressed: () {
ScreenBrightness().resetScreenBrightness();
Navigator.pop(context);
setState(() {});
},
),
],
);
}
}
110 changes: 85 additions & 25 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,11 @@ packages:
flutter_pkid:
dependency: "direct main"
description:
path: "/sandbox/code/github/threefoldtech/threefold_connect_flutter_pkid_client"
relative: false
source: path
path: "."
ref: master
resolved-ref: "48123e66597f6fb448edb14183935b0b243163a6"
url: "https://github.com/threefoldtech/threefold_connect_flutter_pkid_client"
source: git
version: "0.0.1"
flutter_plugin_android_lifecycle:
dependency: transitive
Expand Down Expand Up @@ -474,11 +476,9 @@ packages:
gridproxy_client:
dependency: "direct main"
description:
path: "packages/gridproxy_client"
ref: tfchain_graphql_hotfix
resolved-ref: "314f46728e43cb86f430cda6ba756d4be3fb6e07"
url: "https://github.com/codescalers/tfgrid-sdk-dart"
source: git
path: "../../../codescalers/tfgrid-sdk-dart/packages/gridproxy_client"
relative: true
source: path
version: "1.0.0"
hashlib:
dependency: transitive
Expand Down Expand Up @@ -724,10 +724,10 @@ packages:
dependency: transitive
description:
name: path_provider_foundation
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
url: "https://pub.dev"
source: hosted
version: "2.4.0"
version: "2.3.2"
path_provider_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -904,6 +904,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
qr:
dependency: transitive
description:
name: qr
sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
qr_code_scanner:
dependency: "direct main"
description:
Expand All @@ -912,6 +920,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.1"
qr_flutter:
dependency: "direct main"
description:
name: qr_flutter
sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
quiver:
dependency: transitive
description:
Expand Down Expand Up @@ -968,6 +984,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.27.7"
screen_brightness:
dependency: "direct main"
description:
name: screen_brightness
sha256: "7d4ac84ae26b37c01d6f5db7123a72db7933e1f2a2a8c369a51e08f81b3178d8"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_android:
dependency: transitive
description:
name: screen_brightness_android
sha256: "8c69d3ac475e4d625e7fa682a3a51a69ff59abe5b4a9e57f6ec7d830a6c69bd6"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_ios:
dependency: transitive
description:
name: screen_brightness_ios
sha256: f08f70ca1ac3e30719764b5cfb8b3fe1e28163065018a41b3e6f243ab146c2f1
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_macos:
dependency: transitive
description:
name: screen_brightness_macos
sha256: "70c2efa4534e22b927e82693488f127dd4a0f008469fccf4f0eefe9061bbdd6a"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_platform_interface:
dependency: transitive
description:
name: screen_brightness_platform_interface
sha256: "9f3ebf7f22d5487e7676fe9ddaf3fc55b6ff8057707cf6dc0121c7dfda346a16"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_windows:
dependency: transitive
description:
name: screen_brightness_windows
sha256: c8e12a91cf6dd912a48bd41fcf749282a51afa17f536c3460d8d05702fb89ffa
url: "https://pub.dev"
source: hosted
version: "1.0.1"
secp256k1_ecdsa:
dependency: transitive
description:
Expand Down Expand Up @@ -996,10 +1060,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "671e7a931f55a08aa45be2a13fe7247f2a41237897df434b30d2012388191833"
sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
version: "2.3.5"
shared_preferences_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -1153,11 +1217,9 @@ packages:
stellar_client:
dependency: "direct main"
description:
path: "packages/stellar_client"
ref: tfchain_graphql_hotfix
resolved-ref: "314f46728e43cb86f430cda6ba756d4be3fb6e07"
url: "https://github.com/codescalers/tfgrid-sdk-dart"
source: git
path: "../../../codescalers/tfgrid-sdk-dart/packages/stellar_client"
relative: true
source: path
version: "0.1.0"
stellar_flutter_sdk:
dependency: transitive
Expand Down Expand Up @@ -1242,11 +1304,9 @@ packages:
tfchain_client:
dependency: "direct main"
description:
path: "packages/tfchain_client"
ref: tfchain_graphql_hotfix
resolved-ref: "314f46728e43cb86f430cda6ba756d4be3fb6e07"
url: "https://github.com/codescalers/tfgrid-sdk-dart"
source: git
path: "../../../codescalers/tfgrid-sdk-dart/packages/tfchain_client"
relative: true
source: path
version: "0.1.0"
timing:
dependency: transitive
Expand Down Expand Up @@ -1348,10 +1408,10 @@ packages:
dependency: transitive
description:
name: url_launcher_ios
sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e
sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03"
url: "https://pub.dev"
source: hosted
version: "6.3.1"
version: "6.2.4"
url_launcher_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -1514,4 +1574,4 @@ packages:
version: "1.1.4+10"
sdks:
dart: ">=3.2.3 <4.0.0"
flutter: ">=3.16.6"
flutter: ">=3.16.0"
2 changes: 2 additions & 0 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ dependencies:
pinenacl: ^0.5.1
pinput: 3.0.1
build_runner: ^2.4.9
qr_flutter: ^4.1.0
screen_brightness: ^1.0.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 312ac0b

Please sign in to comment.