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

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

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:than_pkg/than_pkg.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await ThanPkg.windowManagerensureInitialized();

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool isFullScreen = false;
  String imageUri = '';

  @override
  void initState() {
    super.initState();
    init();
  }

  void init() async {
    await ThanPkg.android.app.toggleKeepScreenOn(isKeep: true);
  }

  void _test() async {
    try {
      if (!await ThanPkg.android.permission.isCameraPermission()) {
        await ThanPkg.android.permission.requestCameraPermission();
        return;
      }
    } catch (e) {
      debugPrint(e.toString());
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      // theme: ThemeData.dark(),
      home: Scaffold(
        appBar: isFullScreen
            ? null
            : AppBar(
                title: const Text('test lib'),
              ),
        body: Center(
          child: imageUri.isEmpty
              ? Text('Camera')
              : Image.file(
                  File(imageUri),
                ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _test,
          child: Icon(Icons.get_app),
        ),
      ),
    );
  }
}
1
likes
0
points
1.18k
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)
View/report issues

License

unknown (license)

Dependencies

flutter, package_info_plus, plugin_platform_interface, window_manager

More

Packages that depend on than_pkg

Packages that implement than_pkg