than_pkg 1.6.3
than_pkg: ^1.6.3 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 '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 = '';
final TextEditingController textEditingController = TextEditingController();
@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: TextField(
controller: textEditingController,
decoration: InputDecoration(hintText: 'path'),
)),
floatingActionButton: FloatingActionButton(
onPressed: _test,
child: Icon(Icons.get_app),
),
),
);
}
}