Flutter: Handle Back Button Pressed | WillPopScope Widget

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ก.ย. 2024
  • In this video, I will explain how to handle back button press on android.
    Please give stars for this project on git and like the video.
    Flutter UI Kit - goo.gl/N2RxBf
    Flutter Example Apps - goo.gl/8hZQkq
    Instagram - / codepur_ka_superhero
    FB Group - goo.gl/hwnX2F
    Be sure to ask for help in the comments if you need any. Suggestions for future Flutter tutorials are also very welcome! :)
    Flutter is an SDK owned by Google to create applications for Android and iOS using a single codebase. Flutter uses the Dart programming language (also owned by Google). Flutter was in beta when I released this video, so things might still change a bit. But the SDK is already mature enough to write some cool production apps!
    Please Subscribe my channel to motivate me.
    Subscribe Our Channel: goo.gl/BlFui4
    For Fun - www.youtube.co....
    Connect with us on social media:
    Facebook: / mtechviral
    Pawan Kumar - / imthepk
    Ask Pawan Kumar - / thepawankumaar
    Instagram - / codepur_ka_superhero
    Twitter: / imthepk
    LIKE | SHARE | SUBSCRIBE FOR MORE VIDEOS LIKE THIS
    THANKS FOR WATCHING!

ความคิดเห็น • 45

  • @hossainabeer
    @hossainabeer 3 ปีที่แล้ว +1

    Just what a noob needs, an explanatory tutorial not the music filled one. Keep up the good work

  • @JAGANNATHSAHOOtheraw
    @JAGANNATHSAHOOtheraw 6 ปีที่แล้ว +11

    Please make a tutorial on background process in flutter

  • @kamalkkvelly1170
    @kamalkkvelly1170 3 ปีที่แล้ว +1

    thanks sir g i love you in future if i will earn or do something in programming ... i wuold like to share with ... great thanks again

  • @shahadathossain6005
    @shahadathossain6005 3 ปีที่แล้ว

    I want that feature in my Webview flutter. Already using WillPopScope for backward and forward feature (true false) bt cant do the exit feature. any help plz?

  • @risingrocksfarm
    @risingrocksfarm 3 ปีที่แล้ว +2

    Massive thumbs up. Thanks

  • @mohammedsolyman3891
    @mohammedsolyman3891 ปีที่แล้ว

    thank you very much

  • @mockingbird3809
    @mockingbird3809 5 ปีที่แล้ว +4

    Thank You SO Much for this Video.

  • @Sanjay54251
    @Sanjay54251 3 ปีที่แล้ว

    hi sir i want to press back arrow and send some data at the same time how will i do i use getx for statemamagnent i use for local storage get_storage i
    i want to refresh my previous screen when i back press icon on top left
    what will i do

  • @kishorenani2574
    @kishorenani2574 6 ปีที่แล้ว +1

    When I was using willpopscope again it was going to main page pls could you help to solve the issue

  • @ashokchandra4911
    @ashokchandra4911 ปีที่แล้ว

    Perfect ❤❤

  • @michaeltolsma7717
    @michaeltolsma7717 4 ปีที่แล้ว

    The function only works once. When you press "Yes" then go back in the app and do it again, the alert doesn't pop up.

  • @vinceramcesoliveros6739
    @vinceramcesoliveros6739 6 ปีที่แล้ว +2

    Nice and simple tutorial.

  • @shwetalukka529
    @shwetalukka529 3 ปีที่แล้ว

    Hello sir i referred ur 2 hrs tutorial fully its very much simple and just great. May i get help for the modules of my app which i m developing?

  • @rahul2
    @rahul2 5 ปีที่แล้ว +2

    Sir can you explain how to use this code with WebViewScaffold ? instead of scaffold

    • @Aqibfareex
      @Aqibfareex 5 ปีที่แล้ว

      Just wrap webviewscaffold instead of scaffold

  • @RajeshZmoke
    @RajeshZmoke 6 ปีที่แล้ว +1

    If u can explain the class implementation of the will pop scope that'll be great

  • @AhmedAshraf-tu6xl
    @AhmedAshraf-tu6xl 3 ปีที่แล้ว

    Really thanks

  • @dholakiyaparth
    @dholakiyaparth 5 ปีที่แล้ว

    Thanks for such nice tutorial

  • @pistomgeral9436
    @pistomgeral9436 3 ปีที่แล้ว

    Thank you

  • @PadillaJosh
    @PadillaJosh 6 ปีที่แล้ว

    What theme are you using? I really like the colors.

  • @aseemsrivastava3995
    @aseemsrivastava3995 6 ปีที่แล้ว +1

    How to close my app on back press?

  • @swapnilcodes
    @swapnilcodes 2 ปีที่แล้ว

    Wonderful !😍

  • @user-uk3yl1ii6v
    @user-uk3yl1ii6v 4 ปีที่แล้ว

    Thanks!

  • @teddyt5231
    @teddyt5231 4 ปีที่แล้ว

    Thanks bro

  • @Nobody-ky7sl
    @Nobody-ky7sl 6 ปีที่แล้ว

    Wow this videos are awesome

  • @mtux
    @mtux 6 ปีที่แล้ว

    very thanks!!

  • @bharath9628
    @bharath9628 5 ปีที่แล้ว +1

    i can't log in my live API app after using this

  • @Pabliuscf
    @Pabliuscf 4 ปีที่แล้ว

    Thanks for the vídeo

  • @chethanpoojary4570
    @chethanpoojary4570 4 ปีที่แล้ว

    Subscribed...

  • @letsdo6024
    @letsdo6024 5 ปีที่แล้ว

    how to use willpopscope as a child of another willpopscope widget?

  • @krishnakumarramachandran5888
    @krishnakumarramachandran5888 5 ปีที่แล้ว

    WillPopScope can use only inside Stateful widget?

  • @jaeseon
    @jaeseon 4 ปีที่แล้ว

    Thanks, MTECHVIRAL

  • @lattelover7186
    @lattelover7186 6 ปีที่แล้ว

    Nice, The OnWillPop event works good, it's successfully prevent app from hidden. Unfortunately the dialog does not show up. Is this bug or expected behaviours since i'm using WillPopScope on home property of MaterialApp.
    return MaterialApp(
    home: WillPopScope(
    onWillPop: _onBackPressed,
    child: Scaffold( ....

  • @musaesin5163
    @musaesin5163 4 ปีที่แล้ว

    Theme?

  • @gordinmitya
    @gordinmitya 5 ปีที่แล้ว +1

    usually it's done by double tap on back button

    • @Aqibfareex
      @Aqibfareex 5 ปีที่แล้ว

      You can do that this way:
      DateTime currentBackPressTime;
      Future onWillPop() { DateTime now = DateTime.now(); if (currentBackPressTime == null || now.difference(currentBackPressTime) > Duration(seconds: 2)) { currentBackPressTime = now; Fluttertoast.showToast(msg: exit_warning); return Future.value(false); } return Future.value(true); }

    • @jajasaria
      @jajasaria 5 ปีที่แล้ว

      @@Aqibfareex already tried this but when comes to fast double tap. the function not response quite will.

    • @Aqibfareex
      @Aqibfareex 5 ปีที่แล้ว

      @@jajasaria nope. It works fine with even i double tap faster

    • @jajasaria
      @jajasaria 5 ปีที่แล้ว

      @@Aqibfareex sorry. the problem is my toast package. Thanks for this tutorial

    • @Aqibfareex
      @Aqibfareex 5 ปีที่แล้ว

      @@jajasaria no problem ^-^

  • @Anvesh2013
    @Anvesh2013 5 ปีที่แล้ว

    Always, always, always, always
    post it on github

  • @AndrewProjectos
    @AndrewProjectos 4 ปีที่แล้ว

    less talk, do more, go to the point...by the way, does not work

  • @dinukakulathunga5798
    @dinukakulathunga5798 3 ปีที่แล้ว +1

    Thank you so much..

  • @isaacbarros88
    @isaacbarros88 5 ปีที่แล้ว

    Thanks!