Support linux version of MIH
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:file_saver/file_saver.dart';
|
||||
@@ -82,6 +84,19 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
||||
fileExtension: "png",
|
||||
mimeType: MimeType.png,
|
||||
);
|
||||
} else if (defaultTargetPlatform == TargetPlatform.linux ||
|
||||
defaultTargetPlatform == TargetPlatform.windows) {
|
||||
// Use File Picker to get a save path on Desktop
|
||||
String? outputFile = await FilePicker.platform.saveFile(
|
||||
dialogTitle: 'Please select where to save your QR Code:',
|
||||
fileName: filename,
|
||||
);
|
||||
|
||||
if (outputFile != null) {
|
||||
final file = File(outputFile);
|
||||
await file.writeAsBytes(imageBytes);
|
||||
KenLogger.success("Saved to $outputFile");
|
||||
}
|
||||
} else {
|
||||
await FileSaver.instance.saveAs(
|
||||
name: filename,
|
||||
@@ -95,14 +110,14 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
||||
Future<void> downloadQrCode() async {
|
||||
if (_isUserSignedIn) {
|
||||
await screenshotController.capture().then((image) {
|
||||
KenLogger.success("Image Captured: $image");
|
||||
// KenLogger.success("Image Captured: $image");
|
||||
setState(() {
|
||||
businessQRImageFile = image;
|
||||
});
|
||||
}).catchError((onError) {
|
||||
KenLogger.error(onError);
|
||||
});
|
||||
KenLogger.success("QR Code Image Captured : $businessQRImageFile");
|
||||
// KenLogger.success("QR Code Image Captured : $businessQRImageFile");
|
||||
saveImage(businessQRImageFile!);
|
||||
} else {
|
||||
showSignInRequiredAlert();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -545,7 +547,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
MihBannerAd()
|
||||
if (Platform.isAndroid || Platform.isIOS) MihBannerAd()
|
||||
// MihBannerAd(),
|
||||
],
|
||||
),
|
||||
@@ -572,7 +574,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
||||
}
|
||||
|
||||
Future<void> setScreenBrightness(double newBrightness) async {
|
||||
if (!kIsWeb) {
|
||||
if (!kIsWeb && !Platform.isLinux) {
|
||||
bool canChange =
|
||||
await ScreenBrightness.instance.canChangeSystemBrightness;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user