Flutter - Display the SnackBar using the GlobalKey

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 มี.ค. 2018
  • In this video I cover displaying the snack bar using the global key.
    In this episode I cover:
    - Create an app with two tabs
    - Construct a GlobalKey for the Page Scaffold
    - Pass the GlobalKey to the tabs widgets
    - On change in tab will show the Snackbar
    Source code used in this episode:
    gist.github.com/branflake2267...
  • แนวปฏิบัติและการใช้ชีวิต

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

  • @cristianperesdelima7402
    @cristianperesdelima7402 4 ปีที่แล้ว +2

    incredible video, not even in the documentation is so clear. Thank you. Hi here from Brazil.

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

    Searched everywhere but the answer is here. Great explanation on global keys.

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

    great pace

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

    Great video, I from Brazil, how can i put validator in the fields implying that I move to the next screen?

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

    Please post a video how to efficiently use global keys

  • @kennethn.9960
    @kennethn.9960 4 ปีที่แล้ว

    Great tutorial.
    Thanks Brandon

  • @tomaszkuklis4357
    @tomaszkuklis4357 5 ปีที่แล้ว +6

    Brandon, thanks for the video. I'm just starting with flutter and wondering why we couldn't just use `Scaffold.of(context).showSnackBar()` here ? Best

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

      You can, however, you will need to use a Builder to wrap around the Scaffold and use the context given by the Builder => build: (context) to display the snackBar.
      stackoverflow.com/questions/51304568/scaffold-of-called-with-a-context-that-does-not-contain-a-scaffold