tp_package 1.0.10
tp_package: ^1.0.10 copied to clipboard
tp package
Features #
- Load banner ad faster.
- Optimize load interstitial ad singleton.
- Make utils toast, connectivity, alert dialog, text field, tile row.
- Make flutter share, send mail, compose call in a single package.
- Get external storage directory.
Getting started #
dependencies:
tp_package: ^latest_version
Usage #
Init ad in main function before implement show ad:
const testDeviceIds = <String>['iOS device id to show ads'];
TpAdManager.init(testDeviceIds)
Show banner ad:
TpBannerAd('banner ad unit id')
Load interstitial ad:
TpInterstitialAd.load('interstitial ad unit id');
Show interstitial ad:
TpInterstitialAd.show(onDismissAd: yourFunction);
Dispose interstitial ad:
TpInterstitialAd.dispose();
Get External storage:
iOS #
Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:
NSPhotoLibraryUsageDescription- describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
Android #
android.permission.WRITE_EXTERNAL_STORAGE- Permission for usage of external storage
Future<StorageStatus> TpUtils.getStorageDirectory(context);
Share file:
TpUtils.shareFile(String title, String filePath);
Open url:
TpUtils.composeOpenUrl(String url);
Send mail:
TpUtils.composeSendMail(String address, String subject, String body);
Send sms:
TpUtils.composeSendSms(String phone);
Toast utils:
TpToast.success(String message);
TpToast.updated(String message);
TpToast.deleted(String message);
TpToast.failed(String message);
Network connectivity:
TpConnectivity.isOnline();
TpConnectivity.onConnectChanged(Function(TpConnectResult) callback);
TpConnectivity.cancel();
Alert dialog:
TpAlertDialog({
required this.title,
required this.message,
required this.cancelText,
required this.onOkButton,
this.color = Colors.blue,
Key? key,
});
Init material app with responsive for tablet, pc:
MaterialApp(
builder: TpMaterialApp.builder,
);