android_window 0.1.1 copy "android_window: ^0.1.1" to clipboard
android_window: ^0.1.1 copied to clipboard

outdated

A flutter plugin allows you to create native android floating window.

android_window pub-badge #

A flutter plugin allows you to create native android floating window.

Install #

flutter pub add android_window

MainActivity.kt:

class MainActivity : qiuxiang.android_window.AndroidWindowActivity()

Create MainApplication.kt:

package your_package // same as MainActivity.kt

class MainApplication : qiuxiang.android_window.AndroidWindowApplication()

Add android:name=".MainApplication" to AndroidManifest.xml <application>:

<application
  android:name=".MainApplication"
  ...
>

Example #

main.dart:

import 'package:android_window/main.dart' as android_window;
import 'package:flutter/material.dart';

import 'android_window.dart';

@pragma('vm:entry-point')
void androidWindow() {
  runApp(const AndroidWindowApp());
}

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(title: 'Flutter Demo', home: HomePage());
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () => android_window.open(size: const Size(300, 200)),
        child: const Icon(Icons.add),
      ),
    );
  }
}

android_window.dart:

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

class AndroidWindowApp extends StatelessWidget {
  const AndroidWindowApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: HomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return AndroidWindow(
      child: Scaffold(
        backgroundColor: Colors.lightGreen.withOpacity(0.9),
        body: const Padding(
          padding: EdgeInsets.all(8),
          child: Text('Hello android window'),
        ),
      ),
    );
  }
}

Screenshot:

More examples #

Build #

mkdir -p android/src/main/java/qiuxiang/android_window
flutter pub run pigeon --input lib/pigeon.dart
32
likes
0
pub points
77%
popularity

Publisher

unverified uploader

A flutter plugin allows you to create native android floating window.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on android_window