than_pkg 2.4.3 copy "than_pkg: ^2.4.3" to clipboard
than_pkg: ^2.4.3 copied to clipboard

PlatformAndroid

android native plugin.it is my personal lib and you can use.this is my first lib.

Add Map Services #

//new
MapServices.getBool({}, ['name'])
MapServices.getInt({}, ['name'])
MapServices.getString({}, ['name'])
MapServices.getDouble({}, ['name'])
//old
MapServices.get<String>({}, ['name'], defaultValue: '');
MapServices.get<int>({}, ['num'], defaultValue: 1);
MapServices.get<double>({}, ['height'], defaultValue: 0.0);

Added Methods #

ThanPkg.appUtil.getParseMinutes(minutes);
ThanPkg.appUtil.copyText(text);
ThanPkg.appUtil.pasteText();
await ThanPkg.appUtil.clearImageCache();

Extensions #

// extension
DateTime.now().toParseTime();
DateTime.now().toTimeAgo();
//double
0.0.toFileSizeLabel();
//FileSystemEntityExtension
FileSystemEntityExtension.getName(withExt: false)

//PlatformExtension
PlatformExtension.isDesktop();
PlatformExtension.isMobile();

//StringExtension
"".toCaptalize();
"".getName();
"".getExt();
//TextEditingControllerExtension
TextEditingController().selectAll();

Thumbnil #

await ThanPkg.platform.genPdfThumbnail(pathList: [
SrcDistType(src: '$path/Download/1-50.pdf', dist: '$path/test.png'),
]);

await ThanPkg.platform.genVideoThumbnail(pathList: [
SrcDistType(
    src: '$path/Download/catch.mp4', dist: '$path/catch-video.png'),
]);

launch #

  • ThanPkg.linux.app.launch

  • ThanPkg.platform.launch

  • Ubuntu/Debian

sudo apt install xdg-utils
  • Arch
sudo pacman -S xdg-utils
  • Fedora
sudo dnf install xdg-utils

Android ScreenOrientation #

final type = await ThanPkg.android.app.getOrientation();
if (type == null) return;
if (type == ScreenOrientationTypes.Portrait) {
await ThanPkg.android.app
    .requestOrientation(type: ScreenOrientationTypes.Landscape);
await ThanPkg.android.app.showFullScreen();
} else {
ThanPkg.android.app
    .requestOrientation(type: ScreenOrientationTypes.Portrait);
await ThanPkg.android.app.hideFullScreen();
}

Added #

<application>
<provider
    android:name="than.plugin.than_pkg.TContentProvider"
    android:authorities="${applicationId}.provider"
    android:exported="false"
    android:grantUriPermissions="true" />

</application>
  • for above android xml code
Future<void> openPdfWithIntent({required String path})
Future<void> openVideoWithIntent({required String path})
Future<void> installApk({required String path})

Android Thumbnail #

  • ThanPkg.android.thumbnail
Future<void> genVideoThumbnailList
Future<String?> genVideoThumbnail
Future<void> genPdfCoverList
Future<String> genPdfImage
Future<int> getPdfPageCount

Android Camera #

final filePath = await ThanPkg.android.camera.openCamera();

Android Permission (All Version) #

if (!await ThanPkg.android.permission.isStoragePermissionGranted()) {
    await ThanPkg.android.permission.requestStoragePermission();
    return;
}
if (!await ThanPkg.android.permission.isCameraPermission()) {
    await ThanPkg.android.permission.requestCameraPermission();
    return;
}
  • ThanPkg.android.permission
Future<void> checkCanRequestPackageInstallsPermission
Future<bool> isPackageInstallPermission()
Future<bool> isStoragePermissionGranted()
Future<bool> isCameraPermission()
Future<bool> isLocationPermission()
Future<void> requestStoragePermission()
Future<void> requestPackageInstallPermission()
Future<void> requestCameraPermission()
Future<void> requestLocationPermission()

needed lib from linux #

sudo apt install net-tools  // wifi
sudo apt install poppler-utils //pdf thumbnail
sudo apt install ffmpeg //video thumbnail

Android && linux #

//old method
await ThanPkg.windowManagerensureInitialized();
await ThanPkg.platform.toggleFullScreen(isFullScreen: true);
await ThanPkg.platform.getAppRootPath();
await ThanPkg.platform.getAppExternalPath();
await ThanPkg.platform.getWifiAddressList();
await ThanPkg.platform.genPdfCover(outDirPath: '', pdfPathList: []);
await ThanPkg.platform.genVideoCover(outDirPath: '', videoPathList: []);

Android Permission #

//android any version can handle
await ThanPkg.platform.isStoragePermissionGranted();
await ThanPkg.platform.requestStoragePermission();
await ThanPkg.platform.checkAndRequestPackageInstallPermission();

Android only #

//old method
await ThanPkg.platform.getAppFilePath();
await ThanPkg.platform.isAppSystemThemeDarkMode();
await ThanPkg.platform.isAppInternetConnected();
await ThanPkg.platform.getAppBatteryLevel();
await ThanPkg.platform.getLastKnownLocation();
await ThanPkg.platform.getInstalledApps();
await ThanPkg.platform.checkScreenOrientation();
await ThanPkg.platform.requestScreenOrientation(type: ScreenOrientationTypes.Portrait);
//android device info <Map> type
await ThanPkg.platform.getAndroidDeviceInfo()
await ThanPkg.platform.openUrl(url: '');
await ThanPkg.platform.getPlatformVersion();
await ThanPkg.platform.getDeviceId();
await ThanPkg.platform.toggleKeepScreen(isKeep: false);
await ThanPkg.platform.toggleFullScreen(isFullScreen: !isFullScreen);
await ThanPkg.platform.getLocalIpAddress();
await ThanPkg.platform.getWifiAddress();

android AndroidManifest #

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

1
likes
140
points
1.25k
downloads

Publisher

unverified uploader

Weekly Downloads

android native plugin.it is my personal lib and you can use.this is my first lib.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, intl, mime, package_info_plus, plugin_platform_interface, timeago, window_manager

More

Packages that depend on than_pkg

Packages that implement than_pkg