Thursday, 17 January 2019

How to have widgets outside the app using flutter and kotlin?

I need a way to make a button or a container that can still be visible even when I close the app like so: https://i.stack.imgur.com/GTpOim.jpg. But this is just simply impossible in flutter. So what I've been doing is making a platform channel on my app and trying to make the container and button with native components. But I've been using kotlin and do not know much about this programming language. Is there a way for my code to be able to make such widgets?(I would thank you so much if you could edit my full code.)

Full Code:

Flutter:

class FloatingContainer extends StatelessWidget {

  static const platform = const MethodChannel('flutter.App.com.channel');

  @override
  Widget build(BuildContext context) {
    return Container ();
  }
  Future<Null> _showNativeView() async {}

}

Kotlin:

package com.example.swipe

import android.os.Bundle

import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.plugin.common.MethodChannel

class MainActivity() : FlutterActivity() {
    private val CHANNEL = "flutter.App.com.channel"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        GeneratedPluginRegistrant.registerWith(this)

        MethodChannel(flutterView, CHANNEL).setMethodCallHandler { call, result ->

        }
    }
}



from How to have widgets outside the app using flutter and kotlin?

No comments:

Post a Comment