Complete Guide for Creating Home Widgets with Flutter for Android & iOS

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 2024
  • In this video, I'm your guide as we dive deep into the world of home widgets with flutter.
    📌 Are you tired of the same old app layouts? Want to create eye-catching and functional home widgets for Android and iOS? Look no further! In this comprehensive guide, I'll walk you through every step of the process.
    📋 Here's what we'll cover in this video:
    🛠️ Setup and Configuration: We'll start by setting up our Flutter environment and configuring it for both Android and iOS development. No need for native code-Flutter's got your back!
    🚀 Implementation: We'll dive into the nitty-gritty of implementing your home widgets, ensuring they work seamlessly on both Android and iOS devices.
    🔥 Ready to take your app development skills to the next level?
    Join me on this Flutter adventure, and together, we'll create custom home widgets that users will love.
    📱Source Code: github.com/YashMakan/home_wid...
    Don't forget to hit that "Subscribe" button, like this video, and ring the notification bell to stay updated with more exciting Flutter content. Let's build amazing apps together! 🚀📱💡
    Video Chapters:
    0:00 - Demo
    0:48 - Intro
    2:02 - What are Home Widgets?
    2:47 - No Native UI but Flutter UI
    3:46 - Flutter Code
    12:45 - Android Configuration
    17:54 - iOS Congiguration
    25:25 - Outro
    #yashmakan #flutter #MobileAppDevelopment #HomeWidgets
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @amirvelasquez7874
    @amirvelasquez7874 2 หลายเดือนก่อน

    This video is gold, thank you!

  • @mikemeetstec
    @mikemeetstec 10 หลายเดือนก่อน

    Epic video! Thanks.

  • @yrbediting5718
    @yrbediting5718 6 หลายเดือนก่อน

    Thank you so much for this amazing video

  • @habeelhashmi2198
    @habeelhashmi2198 หลายเดือนก่อน +1

    i am facing an issue in IOS, on simulator it works perfectly but when i try on real device it just shows a widget with grey background please help. 😭

  • @anandkrishna926
    @anandkrishna926 8 หลายเดือนก่อน

    This video was very helpful. Thanks. Please consider making a video that when we tap widget or a button in the widget we want to update data.

  • @mr_.a
    @mr_.a 6 หลายเดือนก่อน

    Great video, very helpful!
    Tell me, do you know if it is possible to somehow implement customization of the colors of the home_widget?
    For example, on my home_widget there is text and an icon, everything is white, and the background is blue. I would like the user to be able to edit the background to a different color or change the text color.

  • @MikeJones3
    @MikeJones3 3 หลายเดือนก่อน

    Awesome video. WOundering if you could point me in the correct directin on if I want the user to manually pick a location when they add the widget to the homescreen?

  • @putinstop5940
    @putinstop5940 9 หลายเดือนก่อน

    *Thank you*

  • @cdassaha5802
    @cdassaha5802 5 หลายเดือนก่อน

    Hi,
    I have followed almost all the steps you showed. Now the app is running successfully but can't find the app name in the widgets list (long pressed on home screen, then hit + at the top-left and searched). Can you help me what can be done or what's the issue?
    Also, I cloned your github project and didn't find the app name in the widgets list

  • @robin-co6nr
    @robin-co6nr 6 หลายเดือนก่อน

    Hey, nice video, but i have a question. When i update the widget, the widget has a small screenshot of the content implemented in "home_widget_config.dart". The rest of the widget gets filled up with black color. When I cover th whole widget with for ex. red in the "home_widget.dart"-Class, a small red screen appears on the home screen widget. Do you have a solution for this issue?

    • @YashMakan
      @YashMakan  6 หลายเดือนก่อน +1

      So try to use expanded widget while creating the home widget so when screenshot is taken the widget can be filled without the background or you can try to capture x, y size screenshot using davinci and use same dimensions for the widget. Hope you'll find the solution.

  • @AbdullahGad95
    @AbdullahGad95 7 หลายเดือนก่อน +2

    Thanks, bro,
    just one note, you don't have to use daviinci package
    home widget plugin has an internal method to transform a widget into an image
    final filePath = await HomeWidget.renderFlutterWidget(widget,
    key: 'filename', pixelRatio: 4, logicalSize: const Size(160, 320));
    Also, I have a question, is there a way to add the widget directly to the mobile home screen without user intervention?

    • @YashMakan
      @YashMakan  7 หลายเดือนก่อน +2

      Thanks for the tip, I wasn't aware about renderFlutterWidget and after checking the CHANGELOG of the projects, it seems this method was added 5 months back to the package that is 3 months prior of the video. Thanks for adding the information here! Also, I don't think there's a way to programatically add widgets to home screen directly without manually adding for both android and ios but feel free to dig further and if you find anything regarding this then feel free to share here as it might help others! Thanks for watching the video...

    • @begula_real
      @begula_real 2 หลายเดือนก่อน

      @@YashMakan the code in home_widget_config.dart should be like this:
      class HomeWidgetConfig {
      static Future update(context, Widget widget) async {
      // Capture the widget using home_widget's rendering capabilities
      // Render the widget and capture the image data
      String imageData = await HomeWidget.renderFlutterWidget(
      widget, // hover on .renderFlutterWidget to see documentation
      key: 'filename',
      pixelRatio: 4.0, // Adjust pixel ratio for desired image quality
      logicalSize: const Size(160, 320), // Set desired size for the widget
      );
      // Update the home screen widget using home_widget
      // await HomeWidget.saveWidgetData('filename', tempFile.path);
      await HomeWidget.saveWidgetData('filename', imageData);
      await HomeWidget.updateWidget(
      iOSName: iosWidget, androidName: androidWidget);
      }
      static Future initialize() async {
      await HomeWidget.setAppGroupId(groupId);
      }
      }
      and then we can just remove davinci and path_provider package. i tried it, using your source code. and its working. your sorce code is really cool, thank you very much!

    • @begula_real
      @begula_real 2 หลายเดือนก่อน

      @@YashMakan i think you can pin this comment, or you can create your own comment about this then pin it. i found this comment from @AbdullahGad95 kinda useful for me

  • @moaudalmousa
    @moaudalmousa 6 หลายเดือนก่อน

    when I click on the widget (android device) nothing happened ,it should open the app like at 0:20 of your video right ?

    • @moaudalmousa
      @moaudalmousa 6 หลายเดือนก่อน

      update :
      I found a solution
      add this lines at the top of your CustomHomeView.kt file
      import android.app.PendingIntent;
      import android.content.Intent
      then add this line inside the for loop and before the appWidgetManager.updateAppWidget
      views.setOnClickPendingIntent(R.id.widget_image,
      PendingIntent.getActivity(context, 0, Intent(context, MainActivity::class.java), PendingIntent.FLAG_IMMUTABLE))

  • @FLstudioProjectfiles
    @FLstudioProjectfiles 8 หลายเดือนก่อน

    Can I add Buttons that can be pressed from the home_widgets ?

    • @YashMakan
      @YashMakan  8 หลายเดือนก่อน

      buttons have to be part of the native code instead so operation can be performed on clicking. If button is added in flutter code, it would not be possible to detect which button is clicked as whole image is transferred as the home widget. Thanks for watching 😊

  • @tsaidarius3786
    @tsaidarius3786 9 หลายเดือนก่อน

    if i want my widgets update automatically , should i add the workmanager to execute the background task?

    • @YashMakan
      @YashMakan  9 หลายเดือนก่อน +1

      Yes adding a background tasks executor like work manager will definitely help for updating the image. You can check out home widget repository on GitHub. There's a section of using work manager with home widget package.

    • @ibrahimkhalilshakir2414
      @ibrahimkhalilshakir2414 6 หลายเดือนก่อน

      Not getting workmanager in the repo😢

  • @tsaidarius3786
    @tsaidarius3786 9 หลายเดือนก่อน

    damn bro such a good idea that using davinci . Never thought of this !

    • @YashMakan
      @YashMakan  9 หลายเดือนก่อน

      Thanks, it would be amazing if you could subscribe as well as I am uploading content like this consistently which you might find interesting. Anyways, glad you enjoyed this one. 😊

    • @tsaidarius3786
      @tsaidarius3786 9 หลายเดือนก่อน

      @@YashMakan ok imma do it

    • @begula_real
      @begula_real 2 หลายเดือนก่อน

      @@tsaidarius3786 see another comment, theres a new method from HomeWidget class so you dont really need davinci package --also path_provider package. maybe that method isnt famous yet when this video was made

    • @begula_real
      @begula_real 2 หลายเดือนก่อน

      @@YashMakan i did it just a second ago. nice video and works!

  • @mahirsehgal2003
    @mahirsehgal2003 10 หลายเดือนก่อน