create user interface for QR-Code scanner scan qr codes

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
rodolfobacuinjr 2022-12-06 11:10:34 +08:00
parent a2d7da5435
commit 7b880a08bd
4 changed files with 196 additions and 1 deletions

View File

@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import '../../../../../theme-data.dart/colors.dart';
class SelectedState extends StatelessWidget {
final String title;
final String subtitle;
const SelectedState({Key? key,required this.subtitle, required this.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 80,
width: double.infinity,
padding: const EdgeInsets.all(10),
child: Wrap(
alignment: WrapAlignment.center,
runAlignment: WrapAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
title,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button!.copyWith(
color: third, fontWeight: FontWeight.bold, fontSize: 18),
),
Text(
subtitle,
style: Theme.of(context).textTheme.labelMedium,
),
const Divider(),
]),
],
),
);
}
}

View File

@ -0,0 +1,150 @@
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:fluttericon/entypo_icons.dart';
import 'package:unit2/utils/text_container.dart';
import '../../../../theme-data.dart/colors.dart';
import '../../../../utils/global.dart';
import 'components/save_settings.dart';
class QRCodeScanner extends StatelessWidget {
const QRCodeScanner({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(qrScannerTitle),
centerTitle: true,
backgroundColor: primary,
),
body: SizedBox(
height: screenHeight * 100,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(
height: 40,
),
GestureDetector(
onTap: () {},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 160,
child: Image.asset('assets/pngs/qr-scan.png')),
const SizedBox(
height: 8,
),
Text(
"TAP TO SCAN QR CODE",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.displayMedium!
.copyWith(
fontSize: 22,
color: primary,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 8,
),
//TODO add API data
"INCOMING" == "INCOMING"
? SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"INCOMING",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.displayMedium!
.copyWith(
fontSize: 20,
color: success2,
fontWeight: FontWeight.bold),
),
const Icon(
Entypo.down_bold,
color: success2,
)
],
),
)
: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
//TODO add API data
"INCOMING",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.displayMedium!
.copyWith(
fontSize: 20,
color: second,
fontWeight: FontWeight.bold),
),
const Icon(
Entypo.up_bold,
color: second,
)
],
),
)
],
),
),
Container(
padding: const EdgeInsets.only(top: 12),
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black38,
blurRadius: 30,
offset: Offset(-5, 0),
),
],
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15))),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: const [
SelectedState(
//TODO add api data
title: "Provincial Government of ADN",
subtitle: establishment,
),
Center(
child: SelectedState(
//TODO add api data
title: "Agusan Up",
subtitle: checkpointArea,
),
),
SelectedState(
//TODO add api data
title: "INCOMING",
subtitle: scanMode,
),
],
),
)
],
),
));
}
}

View File

@ -1,4 +1,5 @@
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:unit2/screen/unit2/roles/qr_code_scanner.dart/scan.dart';
import '../screen/sos/add_mobile.dart'; import '../screen/sos/add_mobile.dart';
import '../screen/sos/request_sos.dart'; import '../screen/sos/request_sos.dart';
import '../screen/unit2/login/login.dart'; import '../screen/unit2/login/login.dart';
@ -9,7 +10,7 @@ final GoRouter goRouter = GoRouter(routes: <GoRoute>[
GoRoute( GoRoute(
path: '/', path: '/',
name: 'login', name: 'login',
builder: (context, state) => const UniT2Login(), builder: (context, state) => const QRCodeScanner(),
routes: [ routes: [
GoRoute( GoRoute(
name: 'home', name: 'home',

View File

@ -22,3 +22,6 @@ const String loginViaQr = "Login via QR code";
const String emergencyReponseLabel = " Request Emergency Response "; const String emergencyReponseLabel = " Request Emergency Response ";
const String requestSOS = "Request SOS"; const String requestSOS = "Request SOS";
const String qrScannerTitle = "QR-Code Scanner"; const String qrScannerTitle = "QR-Code Scanner";
const String establishment = "Establishment";
const String checkpointArea = "Checkpoint Area";
const String scanMode = 'Scan Mode';