@morichan1 (mori chan)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

flutterでwidgetを画像化する際に背景を透過させる

現在flutterで画像編集アプリのようなものを作成しており、写真の上にStackでwidgetを重ねて表示しています。その重ねているwidgetのみを保存したく、かつ、その保存した画像が背景透過をできるようにしたいのですが、背景が白になってしまい、透過できません。

コード

InteractiveViewer(
                  child: Container(
                      width: MediaQuery.of(context).size.width,
                      height: 400,
                      child: WidgetsToImage(
                        controller: imageController,
                        child: Stack(
                          children: [
                            Image.network(
                              widget.s3,
                              width: MediaQuery.of(context).size.width,
                            ),
                            _bubble1(),
                            _bubble2(),
                            _bubble3(),
                            _text1(),
                            _text2(),
                            _text3(),


                          ],
                        ),
                      )),
                ),

ここで、以下のようにコードを変更しました。

InteractiveViewer(
                  child: Container(
                      width: MediaQuery.of(context).size.width,
                      height: 400,
                      child: WidgetsToImage(
                        controller: imageController,
                        child: Stack(
                          children: [
                            _bubble1(),
                            _bubble2(),
                            _bubble3(),
                            _text1(),
                            _text2(),
                            _text3(),


                          ],
                        ),
                      )),
                ),

そして画像を保存すると、以下のような画像が.jpegで保存されて、透過情報を持っていせんでした。
flutterでこのような層を保存するにはどのようにすれば良いか教えていただけると幸いです。
image.png

0 likes

No Answers yet.

Your answer might help someone💌