How to open default Set Wallpaper View from Flutter app for android device?

64 views Asked by At

In my flutter app i want to open android default set wallpaper view from app. Like when user want any set wallpaper, user click on button and default android wallpaper set view open by default and when they set wallpaper, then after user will redirect to app. I expect the open default set wallpaper view from flutter app.

1

There are 1 answers

1
Shejan Mahamud On

Try this code:

// set wallpaper button
        Container(
          height: MediaQuery.of(context).size.height,
          width: MediaQuery.of(context).size.width,
          alignment: Alignment.bottomCenter,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              GestureDetector(
                onTap: () {
                  // save image to photos directory
                  _save();

                },
                child: Stack(
                  children: [
                    Container(
                      height: 50,
                      decoration: BoxDecoration(
                          color: Color(0xff1C1B1B).withOpacity(0.8),
                          borderRadius: BorderRadius.circular(30)
                      ),
                      width: MediaQuery.of(context).size.width/2,
                    ),
                    Container(
                      height: 50,
                      width: MediaQuery.of(context).size.width/2,
                      padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
                      decoration: BoxDecoration(
                          border: Border.all(color: Colors.white54, width: 1),
                          borderRadius: BorderRadius.circular(30),
                          gradient: LinearGradient(
                              colors: [
                                Color(0x36FFFFFF),
                                Color(0x0FFFFFFF)
                              ]
                          )
                      ),
                      child: Column(children: <Widget> [
                        Text("Set As Wallpaper", style: TextStyle(fontSize: 16, color: Colors.white70),),
                        Text("Image Will be Save at Galery", style: TextStyle(
                          fontSize: 10,
                          color: Colors.white70,
                        ),)
                      ],),
                    )
                  ],
                ),
              ),
              SizedBox(height: 16,),
            // cancel vutton handler
            GestureDetector(
              onTap: () {
                Navigator.pop(context);
              },
                child: Text("Cancel", style: TextStyle(color: Colors.white),)),
              SizedBox(height: 50,)
          ],),
        )

      ],),
    );
  }

}

More details here: https://ferilukmansyah.medium.com/how-to-build-wallpaper-app-using-flutter-90a2b23d1d97