Chaneg Tile to package and add dev scanner
This commit is contained in:
@@ -8,7 +8,9 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_swipe_detector/flutter_swipe_detector.dart';
|
import 'package:flutter_swipe_detector/flutter_swipe_detector.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:google_nav_bar/google_nav_bar.dart';
|
import 'package:google_nav_bar/google_nav_bar.dart';
|
||||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||||
|
// import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||||
|
// import 'package:mobile_scanner/mobile_scanner.dart';
|
||||||
// import 'package:simple_barcode_scanner/screens/web.dart';
|
// import 'package:simple_barcode_scanner/screens/web.dart';
|
||||||
// import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
// import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||||
import '../../main.dart';
|
import '../../main.dart';
|
||||||
@@ -84,9 +86,9 @@ class _MIHHomeState extends State<MIHHome> {
|
|||||||
String appSearch = "";
|
String appSearch = "";
|
||||||
int amount = 10;
|
int amount = 10;
|
||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
final baseAPI = AppEnviroment.baseApiUrl;
|
||||||
final MobileScannerController scannerController = MobileScannerController(
|
// final MobileScannerController scannerController = MobileScannerController(
|
||||||
// required options for the scanner
|
// // required options for the scanner
|
||||||
);
|
// );
|
||||||
|
|
||||||
void setAppsNewPersonal(List<MIHTile> tileList) {
|
void setAppsNewPersonal(List<MIHTile> tileList) {
|
||||||
ImageProvider logo = MzanziInnovationHub.of(context)!.theme.logoImage();
|
ImageProvider logo = MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||||
@@ -417,14 +419,6 @@ class _MIHHomeState extends State<MIHHome> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void foundCode(BarcodeCapture bcode) {
|
|
||||||
if (bcode.barcodes.first.rawValue != null) {
|
|
||||||
print(bcode.barcodes.first.rawValue);
|
|
||||||
scannerController.stop();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAppsDev(List<MIHTile> tileList) {
|
void setAppsDev(List<MIHTile> tileList) {
|
||||||
if (AppEnviroment.getEnv() == "Dev") {
|
if (AppEnviroment.getEnv() == "Dev") {
|
||||||
tileList.add(MIHTile(
|
tileList.add(MIHTile(
|
||||||
@@ -477,36 +471,37 @@ class _MIHHomeState extends State<MIHHome> {
|
|||||||
));
|
));
|
||||||
tileList.add(MIHTile(
|
tileList.add(MIHTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
showDialog(
|
if (MzanziInnovationHub.of(context)!.theme.getPlatform() == "Web") {
|
||||||
barrierDismissible: false,
|
print("================ Web ====================");
|
||||||
context: context,
|
print("here 1");
|
||||||
builder: (context) {
|
try {
|
||||||
// return const MIHErrorMessage(errorType: "Input Error");
|
String? res = await SimpleBarcodeScanner.scanBarcode(
|
||||||
// return const MIHErrorMessage(errorType: "Password Requirements");
|
context,
|
||||||
// return const MIHErrorMessage(errorType: "Invalid Username");
|
barcodeAppBar: const BarcodeAppBar(
|
||||||
// return const MIHErrorMessage(errorType: "Invalid Email");
|
appBarTitle: 'Scan Barcode',
|
||||||
// return const MIHErrorMessage(errorType: "User Exists");
|
centerTitle: true,
|
||||||
// return const MIHErrorMessage(errorType: "Password Match");
|
enableBackButton: true,
|
||||||
// return const MIHErrorMessage(errorType: "Invalid Credentials");
|
backButtonIcon: Icon(Icons.arrow_back),
|
||||||
return MIHWindow(
|
),
|
||||||
fullscreen: false,
|
isShowFlashIcon: true,
|
||||||
windowTitle: "Scanner",
|
delayMillis: 500,
|
||||||
windowBody: [
|
cameraFace: CameraFace.back,
|
||||||
SizedBox(
|
scanFormat: ScanFormat.ONLY_BARCODE,
|
||||||
height: 1000,
|
|
||||||
child: MobileScanner(
|
|
||||||
controller: scannerController,
|
|
||||||
onDetect: foundCode,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
windowTools: [],
|
|
||||||
onWindowTapClose: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
if (res != null) {
|
||||||
);
|
print(res);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
print(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TextEditingController cardNumberController =
|
||||||
|
TextEditingController();
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
'/scanner',
|
||||||
|
arguments: cardNumberController,
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tileName: "Scanner - Dev",
|
tileName: "Scanner - Dev",
|
||||||
tileIcon: Icon(
|
tileIcon: Icon(
|
||||||
@@ -954,7 +949,7 @@ class _MIHHomeState extends State<MIHHome> {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
child: MIHSearchField(
|
child: MIHSearchField(
|
||||||
controller: searchController,
|
controller: searchController,
|
||||||
hintText: "Search Mzansi Tiles",
|
hintText: "Search Mzansi Packages",
|
||||||
required: false,
|
required: false,
|
||||||
editable: true,
|
editable: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
Reference in New Issue
Block a user