Dialog Service in Flutter | Show Dialog Without Context

  Рет қаралды 16,896

FilledStacks

FilledStacks

Күн бұрын

Пікірлер: 95
@raykoster3562
@raykoster3562 4 жыл бұрын
Hi Dane, i follow your Videos since mid June 2019. You brought so much Value to Flutter, its really unbelievable. Your Packages are stunning and deal with really important architectural questions. You have a brilliant MVVM Approach. Your Widgets and Videos are easy to understand. With every new Video from you, my App gets better structured and even cleaner and i have definitely less Boiler Plate. You taught me so much and i just wanted to say thank you dane! Keep up the good work and only the best. Cheers, Ray
@raykoster3562
@raykoster3562 4 жыл бұрын
But one thing you have to tell me. How the hell can i implement a validation to my FormField. i created a custom FormWidget (extends HookWidget), but where to put the key to validate? I cant even use a custom Validator logic in my Model, because the Dialog is already closed, when i get the text back.
@FilledStacks
@FilledStacks 4 жыл бұрын
Hi Ray. Thank you so much for your kind words, i really appreciate them. It means a lot knowing that I've helped you produce something that's better in any way after using some of my input / opinions on the code.
@FilledStacks
@FilledStacks 4 жыл бұрын
I don't use the key for validation. I either do it real time, using the onChanged function to update the value in the viewmodel. Or I check when the form is submitted allowing me to simply do it before I try to submit the form. I've never found the key useful so I've never actually used it for form submission.
@tony-mburu
@tony-mburu 4 жыл бұрын
I have been waiting for this for some time now. Good stuff @FilledStacks
@FilledStacks
@FilledStacks 4 жыл бұрын
Awesome! Happy that I could make it.
@isaacadariku
@isaacadariku 4 жыл бұрын
I have not watch but can't imagine the next knowledge to get from @FilledStack 🙇🏽‍♂️
@FilledStacks
@FilledStacks 4 жыл бұрын
haha, awesome. I hope it's useful.
@YTarikKalyoncu
@YTarikKalyoncu 4 жыл бұрын
Big help when you use API service on your app. Dialog without context is like almost magic 😌
@FilledStacks
@FilledStacks 4 жыл бұрын
Agreed. It's very useful when using it there.
@YTarikKalyoncu
@YTarikKalyoncu 4 жыл бұрын
@@FilledStacks One question why responseData is a List? Why it isn't simply dynamic?
@FilledStacks
@FilledStacks 4 жыл бұрын
@@YTarikKalyoncu I fixed that in the latest release.
@markdioneeb8997
@markdioneeb8997 2 жыл бұрын
Correct me if I wrong, If I want to add more custom dialog aside from "Basic" & "Form", I'll just need to modify the enums right? and add DialogType.ProductForm etc. Awesome package as always.
@FilledStacks
@FilledStacks 2 жыл бұрын
Yes, you would register a new enum and a new ui for the dialog then you can call it.
@markdioneeb8997
@markdioneeb8997 2 жыл бұрын
Aside from Dialog & SnackBar, we also have bottom sheet, can dialog service accommodate that? I'm using modal_bottom_sheet package
@FilledStacks
@FilledStacks 2 жыл бұрын
Yes. I actually built our bottom sheet service using modal dialog sheet package 😍 so you'll have the same functionality 🤩
@marlostrin
@marlostrin 3 жыл бұрын
Hello, how are you? that way I can trigger the dialog in the background? when does a push notification arrive when the dialog overlaps other apps?
@FilledStacks
@FilledStacks 3 жыл бұрын
Hey hey, no. You can't draw over a different app unless you're a system application. You can only draw on the UI thread that belongs to you while your app is in the foreground
@theforestapp
@theforestapp 4 жыл бұрын
i believe im encountering a bug. using the registerCustomDialogBuilder isnt working, even though im calling it from the main() function after the setupLocator - i had to switch back to the old, deprecated method to get it to work. E/flutter (16889): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: 'package:stacked_services/src/dialog/dialog_service.dart': Failed assertion: line 165 pos 7: 'customDialogUI != null': You have to call registerCustomDialogBuilder to use this function. Look at the custom dialog UI section in the stacked_services readme. E/flutter (16889): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) E/flutter (16889): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5) E/flutter (16889): #2 DialogService.showCustomDialog (package:stacked_services/src/dialog/dialog_service.dart:165:7) just wanted to let you know. on the latest StackedServices version as well
@FilledStacks
@FilledStacks 4 жыл бұрын
And the function you registered is formatted correctly? I'm using this everyday in our code bases and it's working fine, latest and older versions.
@kanegomolema7357
@kanegomolema7357 4 жыл бұрын
Can you please do a tutorial on how to add google play and apple store payment integration using Stacked or payfast for us locals.
@FilledStacks
@FilledStacks 4 жыл бұрын
that requires quite a lot of setup and would require me to make a series about it. I've done it once so i know the steps, I'll probably be able to do that in a month or two from now. Will see what else is planned and slot it in there.
@DonetsA
@DonetsA 4 жыл бұрын
привет подскажи как сделать профиль по этой основе, а то я уже неделю голову ломаю спасибо
@FilledStacks
@FilledStacks 4 жыл бұрын
Hi, I have a video in my firebase series called user profiles and startup logic. In there I show how I handle user profiles in my apps.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
So i've tried linking the responsedata so I could save it. But why does it say that it's a list, when it's obviously only 1 textfield String... Or is this a list because you could potentially have multiple InputFields?
@FilledStacks
@FilledStacks 4 жыл бұрын
It's dynamic at the moment so you can cast it to whatever you'd like at the end. It use to be a list of dynamics, but now it's dynamic only so you can have the freedom to cast to any type.
@wickedgummybear3104
@wickedgummybear3104 4 жыл бұрын
@@FilledStacks I forgot I asked this hahaha.. Yea I solved getting the value already. Making it dynamic was the right choice indeed.
@chinmayagarnaik6458
@chinmayagarnaik6458 4 жыл бұрын
Actually I want to know is their any way to show user random posts.i know how to show followers posts but I need suggested post. In firebase function. I know comments doesn't relented to video but I was just wondering if you can help me or make a course on firebase function node.js.
@FilledStacks
@FilledStacks 4 жыл бұрын
Yep, you can keep a list of public posts in a seperate collection, get them then return random id's from that list to your user.
@routadu
@routadu 4 жыл бұрын
I'm using your stacked package How could I add a listener to one of the properties of viewmodel so that it would rebuild the UI to show custom progress states ? Is there any existing solution or should I just change it using a function and then call notifyListeners()
@FilledStacks
@FilledStacks 4 жыл бұрын
There is no solution yet for that functionality. I am planning to build that at some point so as soon as I get some time I will implement that using the Selector functionality provided by provider.
@markdioneeb8997
@markdioneeb8997 2 жыл бұрын
@@FilledStacks any update to this? thanks!!
@FilledStacks
@FilledStacks 2 жыл бұрын
@@markdioneeb8997 No, we haven't found this to be a requirement in any of the high performant 6 apps we've built so we don't think it's a required feature for any other apps either.
@dev.faizan
@dev.faizan 3 жыл бұрын
How to show dialogue without pressing button I mean when app open it automatically show dialogue on home screen
@FilledStacks
@FilledStacks 3 жыл бұрын
In the onModelReady function of your HomeView call a function in the Viewmodel that shows the dialog you want to show.
@dev.faizan
@dev.faizan 3 жыл бұрын
@@FilledStacks thanks
@yerassylospanov1142
@yerassylospanov1142 4 жыл бұрын
Hi, actually it's great! But i have a question =) How it affects to performance in Flutter to use this in app
@FilledStacks
@FilledStacks 4 жыл бұрын
it doesn't. A package is just code, so whether you write it yourself or you use code someone else wrote it makes no difference.
@gideonmuiru5808
@gideonmuiru5808 4 жыл бұрын
Thank you! Thank you! Thank you!
@FilledStacks
@FilledStacks 4 жыл бұрын
You're very welcome :)
@mars3142
@mars3142 4 жыл бұрын
Why don't you inject the dependencies with function/method parameters? This will be the better solution, if you want to unit test your code, because you can inject different dependencies without changing anything for the injectable generated code.
@FilledStacks
@FilledStacks 4 жыл бұрын
i don't like the dependency and maintenance it creates when changing signatures. and if you watch my unit test video I can still do the same thing by registering a I want to use in the setup.
@kevinmathew1309
@kevinmathew1309 4 жыл бұрын
Suppose if I want user data in all the screens and if i have option to edit profile how could i notify those changes through out the app ? I am following your provider architecture and my base viewmodel has the get current user function.
@FilledStacks
@FilledStacks 4 жыл бұрын
I'd simply update the user service and call notifyListeners in the service. Make it reactive. That way any viewmodel that's listening to it will update itself if they're still alive.
@kevinmathew1309
@kevinmathew1309 4 жыл бұрын
@@FilledStacks is there any of your tutorial handle such a scenario, so i can refer ?
@FilledStacks
@FilledStacks 4 жыл бұрын
@@kevinmathew1309 yes, part 2 of the new series shows how to use reactive services.
@kevinmathew1309
@kevinmathew1309 4 жыл бұрын
@@FilledStacks thanks. Is it there in youtube or in filled stacks website? Can you share a link.
@kevinmathew1309
@kevinmathew1309 4 жыл бұрын
Got it. In the second part of stacked package tutorial. Thanks
@GJJ2019
@GJJ2019 4 жыл бұрын
Or u could just use awesome get package for routes , navigation, DI, and state management
@FilledStacks
@FilledStacks 4 жыл бұрын
I am using that :) for navigation, dialogs and snackbar.
@GJJ2019
@GJJ2019 4 жыл бұрын
@@FilledStacks get package deserve separate video don't u think ? And ur videos r awesome as always 👌
@FilledStacks
@FilledStacks 4 жыл бұрын
@@GJJ2019 i don't use it in production on its own so i don't have the knowledge to make a video about it at this point. the most I use it is as I've shown in these videos.
@abhishekkhanal7791
@abhishekkhanal7791 4 жыл бұрын
Please make a video on how to implement caching and save something like posts on local database
@FilledStacks
@FilledStacks 4 жыл бұрын
I am planning on doing a sqlite tutorial where I'll save some stuff locally.
@beyondbuks4828
@beyondbuks4828 4 жыл бұрын
Please make a video on managing in-App purchases especially subscriptions
@FilledStacks
@FilledStacks 4 жыл бұрын
@fireship has a great few videos on it and a full course :)
@hendrickmanenga9213
@hendrickmanenga9213 4 жыл бұрын
Thank you .Pleas how to show Dialog with a textField?
@FilledStacks
@FilledStacks 4 жыл бұрын
You're welcome. You do it like I show at the end of the video :)
@maherbanhusentech
@maherbanhusentech 4 жыл бұрын
Pdf file upload and retrieve in firebase video send please
@FilledStacks
@FilledStacks 4 жыл бұрын
Hey, I don't do that in production so I probably won't make a video on it.
@zeorjvistr6245
@zeorjvistr6245 4 жыл бұрын
Bro I love your every video but when you will upload a new video
@FilledStacks
@FilledStacks 4 жыл бұрын
Thanks man! I appreciate the support. I just uploaded a new one 20 minutes ago :D :)D :D
@bm830810
@bm830810 4 жыл бұрын
Isn't a dialog some kind of view, so maybe it shouldn't be in viewmodel
@FilledStacks
@FilledStacks 4 жыл бұрын
The viewmodel is not showing it, but you can request it to be shown from the viewmodel
@bm830810
@bm830810 4 жыл бұрын
@@FilledStacks it's not about showing but about knowing about, changing view should not change viewmodel, by definition all your views should reside in view, and all your logic should be in viewmodel
@FilledStacks
@FilledStacks 4 жыл бұрын
@@bm830810 That's absolutely true. The viewmodel knows absolutely nothing about the UI. There's no import of material, there's no imports of any UI related code. It's all based on an interface created by us outside of the UI. The viewmodel is simply interactive with a service class and providing the commands it wants it to do. The same could be said for an api call which is wrapped behind a service. A viewmodel should be handling business logic, not making api requests. But that's not how it's seen, and I think that's not how using any class should be seen. the service is doing the work. The viewmodel simply asks the service to do that work for them. Imagine having to let your viewmodel know about callbacks from the UI that then have to pass back to viewmodel what the results are causing multi directional dependencies. i don't like those kind of dependencies and I've found the best way to break them is through a simple service class that abstracts away any UI code.
@bm830810
@bm830810 4 жыл бұрын
​@@FilledStacks well, in your proposal if you want to change the dialog's text(which is a view), you should change your viewmodel. also testing the viewmodel becomes more complicated (what if you want to accept some dialogs and reject others, what if you have other inputs on the dialog as well and want to return their information, how to mock dialogs information) I've been following your pattern and got stuck exactly here, finally I went with the callback method that you mentioned, although it may be harder to understand at first, but it is easier to test and more aligned with pattern's philosophy.
@FilledStacks
@FilledStacks 4 жыл бұрын
​@@bm830810 That's weird. I find the testing much easier than using a callback method. you just register a mock using mockito and indicate what you want it to return. I have a video about it. Testing is very great for us. Unit testing is a first priority for us so I wouldn't sacrifice that for anything. I guess we differ on where responsibility should lie or what should be carrying the responsibility. i think the view should exist only to display the UI for that view. Since a dialog is a completely new view (as treated by the navigator where you have to call navigator.pop to remove it) i don't think it's the responsibility of the view to show it. Therefore it should be accessible in the business logic so that the view doesn't carry that responsibility. But as I've found discussions around opinions and preferences leads in circles. This is the most maintainable, readable and easiest approach that I've found during development. So far I think you're the only person I've encountered that got the problem you mention since I know how easy it is to mock with mockito.
@prn-ice
@prn-ice 4 жыл бұрын
I have loads of different dialogs so I use a custom DialogService, My switch statement has like 12 different cases, XD.
@FilledStacks
@FilledStacks 4 жыл бұрын
hahaha, awesome! I have an issue that someone created proposing a different way of registering dialogs which I like so I think that'll become a bit easier to manage in the next few updates to the package.
@prn-ice
@prn-ice 4 жыл бұрын
@@FilledStacks Can't wait.
@jfish3576
@jfish3576 4 жыл бұрын
@@FilledStacks Great! Are you planning on updating your written tutorial to match the documentation on pub?
@FilledStacks
@FilledStacks 3 жыл бұрын
@@jfish3576 At the moment I am not planning on doing that. I don't even find time to make new content, i doubt I'll be able to find time to update old content.
@jfish3576
@jfish3576 3 жыл бұрын
@@FilledStacks i understand! thank you so much for your investment! it helps a lot!
@woop8706
@woop8706 4 жыл бұрын
What is with people not implementing context and looking for ways to bypass it?
@FilledStacks
@FilledStacks 4 жыл бұрын
1. Separating your Business Logic and state management from your UI will remove the context from the code your business logic has access to. 2. Easier for unit testing 3. Clear separation between uI and business logic and all the benefits of that.
@oris4358
@oris4358 4 жыл бұрын
Exactly my thoughts. The author's explanation doesn't justify it. Using get_it doesn't justify it. A context is an inherent part of Flutter, use it.
@1879heikkisorsa
@1879heikkisorsa 4 жыл бұрын
@@oris4358 So explain why context is indispensable. In the end you will work with whatever makes you build quality apps the fastest. The whole stacked architecture is one of the best why to achieve this in my opinion. But hey, whatever floats your boat man.
@oris4358
@oris4358 4 жыл бұрын
You lost me after "the fastest" 😉
@el7284
@el7284 4 жыл бұрын
Depending on your architecture, you might want to abstract certain components, components which demand contexts
@yourasa1213
@yourasa1213 3 жыл бұрын
This is too difficult to follow. Besides it changed all the Flutter infrastructure model. I think I am not gonna waste my time for this. Thank you anyway.
@FilledStacks
@FilledStacks 3 жыл бұрын
You're welcome. And yes, this channel is made specifically to help developers avoid wasting time by writing maintainable code upfront instead of struggling to decouple later on. So you're in the right mind with not wasting time on this, you probably don't need it yet. I Don't agree with flutter infrastructure model. Abstracting something so that it's easier to unit test is not an infrastructure change, it just means you're not directly dependent on it. But you're still using it :D Good luck
Flutter Theme Manager for Multiple Themes
8:55
FilledStacks
Рет қаралды 21 М.
What are Services and How to use them in Flutter
16:27
FilledStacks
Рет қаралды 26 М.
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 120 МЛН
"كان عليّ أكل بقايا الطعام قبل هذا اليوم 🥹"
00:40
Holly Wolly Bow Arabic
Рет қаралды 14 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 34 МЛН
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 10 МЛН
Why I Do NOT Use Flutter for Mobile App Development
8:24
Aivars Meijers
Рет қаралды 254 М.
Synchronous BuildContexts | Decoding Flutter
6:15
Flutter
Рет қаралды 46 М.
Complete Flutter Architecture using Provider and Stacked
22:59
FilledStacks
Рет қаралды 91 М.
Bottom Nav Bar in Flutter using Stacked
10:56
FilledStacks
Рет қаралды 20 М.
Top 12 Flutter Tips & Tricks
9:32
Fireship
Рет қаралды 269 М.
Listas y comparación de rendimiento en Flutter
7:03
diegoveloper
Рет қаралды 5 М.
Dart DevTools
25:19
Flutter
Рет қаралды 70 М.
Top 10 Widgets every Flutter Developer should know!
17:17
RetroPortal Studio
Рет қаралды 282 М.
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 120 МЛН