locationpicker icon indicating copy to clipboard operation
locationpicker copied to clipboard

Back button request

Open Tpow99 opened this issue 3 years ago • 4 comments

Hey! Super minor and hopefully trivial request, but a back or cancel button would be amazing!

Tpow99 avatar Dec 05 '22 00:12 Tpow99

I am here for the same request. if you edit the package you can get the back button, but when you update the package it is lost so I wish if this was provided as boolean option.

Below line will decide on back button

https://github.com/blackmann/locationpicker/blob/71cd5e6040e769a185b68b0ce1f13d5ba106ac25/lib/widgets/place_picker.dart#L149

rajesh-h avatar Dec 08 '22 17:12 rajesh-h

I am here for the same request. Kindly have a look at it, users are stuck on the location_picker screen and there's no way to go back on iOS. Thanks.

blewis-1 avatar Jan 17 '23 07:01 blewis-1

I am here for the same request. if you edit the package you can get the back button, but when you update the package it is lost so I wish if this was provided as boolean option.

Below line will decide on back button

https://github.com/blackmann/locationpicker/blob/71cd5e6040e769a185b68b0ce1f13d5ba106ac25/lib/widgets/place_picker.dart#L149

Working, thanks!

dharambudh1 avatar Feb 06 '23 10:02 dharambudh1

Maybe some of you still wondering how to implement Back Button. Above answer is still not obvious how it should be implemented. Below are the path you should follow to get it.

  1. You need to get the package from github not pub.dev. I used pull request #85 to be my reference.

Note: one of the bad things is whenever the pull request get updated, will be immediately reflected in you application so you might create fork it and modify the changes and refer to your repo.

  1. Refer to github repo instead of pub.dev in your pubspec.yml file
  place_picker:
    git:
      url: https://github.com/Lzyct/locationpicker.git
      # ref: branch_name # if branch not the master
      # rev: commit_hash # if you want to get specific commit
  1. In your code
LocationResult? result = await Navigator.of(context).push(MaterialPageRoute(
    builder: (context) => PlacePicker(
        "API_KEY",
        // important to be added
        appBarOptions: AppBarOptions(showBackButton: true),
        ),
    ),
);

mutairibassam avatar Sep 03 '23 00:09 mutairibassam