-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-3260 Load & Display App Grid Linagora Ecosystem
- Loading branch information
Showing
49 changed files
with
857 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
class Constant { | ||
static const acceptHeaderDefault = 'application/json'; | ||
static const contentTypeHeaderDefault = 'application/json'; | ||
static const pdfMimeType = 'application/pdf'; | ||
static const base64Charset = 'base64'; | ||
static const textHtmlMimeType = 'text/html'; | ||
static const octetStreamMimeType = 'application/octet-stream'; | ||
static const pdfExtension = '.pdf'; | ||
static const imageType = 'image'; | ||
static const textVCardMimeType = 'text/x-vcard'; | ||
static const textPlainMimeType = 'text/plain'; | ||
static const String acceptHeaderDefault = 'application/json'; | ||
static const String contentTypeHeaderDefault = 'application/json'; | ||
static const String pdfMimeType = 'application/pdf'; | ||
static const String base64Charset = 'base64'; | ||
static const String textHtmlMimeType = 'text/html'; | ||
static const String octetStreamMimeType = 'application/octet-stream'; | ||
static const String pdfExtension = '.pdf'; | ||
static const String imageType = 'image'; | ||
static const String textVCardMimeType = 'text/x-vcard'; | ||
static const String textPlainMimeType = 'text/plain'; | ||
static const String slashCharacter = '/'; | ||
static const String andCharacter = '&'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
import 'package:core/presentation/extensions/color_extension.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
|
||
mixin ImageLoaderMixin { | ||
|
||
Widget buildImage({ | ||
required String imagePath, | ||
double? imageSize | ||
}) { | ||
if (isImageNetworkLink(imagePath)) { | ||
return Image.network( | ||
imagePath, | ||
fit: BoxFit.fill, | ||
width: imageSize ?? 150, | ||
height: imageSize ?? 150, | ||
errorBuilder: (_, __, ___) { | ||
return Container( | ||
width: imageSize ?? 150, | ||
height: imageSize ?? 150, | ||
color: AppColor.textFieldHintColor, | ||
); | ||
}, | ||
); | ||
} else if (isImageSVG(imagePath)) { | ||
return SvgPicture.asset( | ||
imagePath, | ||
width: imageSize ?? 150, | ||
height: imageSize ?? 150, | ||
); | ||
} else { | ||
return Image.asset( | ||
imagePath, | ||
fit: BoxFit.fill, | ||
width: imageSize ?? 150, | ||
height: imageSize ?? 150, | ||
); | ||
} | ||
} | ||
|
||
bool isImageNetworkLink(String imagePath) { | ||
return imagePath.startsWith('http') == true || | ||
imagePath.startsWith('https') == true; | ||
} | ||
|
||
bool isImageSVG(String imagePath) => imagePath.endsWith('svg') == true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
class StringConvert { | ||
static String? writeEmptyToNull(String text) { | ||
static String? writeEmptyToNull(String text) { | ||
if (text.isEmpty) return null; | ||
return text; | ||
} | ||
|
||
static String writeNullToEmpty(String? text) { | ||
static String writeNullToEmpty(String? text) { | ||
return text ?? ''; | ||
} | ||
|
||
static String toUrlScheme(String hotScheme) { | ||
return '$hotScheme://'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
import 'package:core/utils/platform_info.dart'; | ||
import 'package:core/utils/string_convert.dart'; | ||
import 'package:external_app_launcher/external_app_launcher.dart'; | ||
import 'package:url_launcher/url_launcher.dart' as launcher; | ||
|
||
mixin LauncherApplicationMixin { | ||
|
||
Future<void> launchApplication({ | ||
String? androidPackageId, | ||
String? iosScheme, | ||
String? iosStoreLink, | ||
Uri? uri, | ||
}) async { | ||
if (PlatformInfo.isWeb && uri != null) { | ||
await openWebApplication(uri); | ||
} else if (PlatformInfo.isAndroid && androidPackageId != null) { | ||
await openAndroidApplication(androidPackageId); | ||
} else if (PlatformInfo.isIOS && | ||
(iosScheme != null || iosStoreLink != null)) { | ||
await openIOSApplication( | ||
iosScheme, | ||
iosStoreLink, | ||
); | ||
} else if (uri != null) { | ||
await openOtherApplication(uri); | ||
} | ||
} | ||
|
||
Future<void> openAndroidApplication(String androidPackageId) async { | ||
await LaunchApp.openApp(androidPackageName: androidPackageId); | ||
} | ||
|
||
Future<void> openIOSApplication(String? iosScheme, String? iosStoreLink) async { | ||
await LaunchApp.openApp( | ||
iosUrlScheme: iosScheme != null | ||
? StringConvert.toUrlScheme(iosScheme) | ||
: null, | ||
appStoreLink: iosStoreLink, | ||
); | ||
} | ||
|
||
Future<void> openWebApplication(Uri uri) async { | ||
await launcher.launchUrl(uri); | ||
} | ||
|
||
Future<void> openOtherApplication(Uri uri) async { | ||
await launcher.launchUrl( | ||
uri, | ||
mode: launcher.LaunchMode.externalApplication, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.