Tuesday, April 9, 2024

Packages Need to Build a Simple E-Commerce Flutter App

Hey dear readers, welcome back on 1GB Developer plateform. Now we are going to explore packages which really help in building a ecommerce website using flutter technology.

1. flutter_otp_text_field:


This package provide interface for otp verification. You can adjust the count of digit like 5 or 6 or more than it. when someone pass the digit after filling all boxes it will return string of digit. You can install from here :




2. flutter_rating_bar



This package provide interface for showing start icon. You can adjust the count of start like 5 or 6 or more than it. Also you can prefered to recieve half star rating. You can install from here :





3. flutter_svg


This package render image.svg file simelessely on flutter screen because sometime default image widget and provider does not work properly that why we use flutter_svg.


4. flutter_widget_from_html:


This package allow to render html template on flutter screen. For example if you are geting html codes from backend then you can use this to render that html code.


5. gap:


This package automatic consider width and height according to parent widget you have to pass only numerical value like below:

Column(
children:[
Gap(10)
]
)

in this case Gap(10) is equavalent to Sizedbox(height:10)

6. get:


This package will manage state of application and provide contextless routing. This package work on based on variable reactiveness.
If we declare any variable reactive then particular UI part will be update when value of that variable will changes.


7. get_storage:



this package is similar to shared_preferences but you can read and write without specific type, I mean to say you can only put value in box.write(value) either it is bool, string or int it will save it in local storage.


8. google_fonts:


google_fonts package provide all fonts which is available on this website : click here

9. http:


http package is like axios which is use in javascript framwork. click here


10. image_picker:


This package allow several method to pick image and videos from device. for this package you have to use user-permission in your androidMenifest.xml file.


<uses-feature
        android:name="android.hardware.camera"
        android:required="false" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

    <!-- Permissions options for the `camera` group -->
    <uses-permission android:name="android.permission.CAMERA"/>


If you want any type of package comment or message me.
Happy flutter ๐Ÿ˜ƒ

Sunday, April 7, 2024

How to Implement Multi-Language Support in Flutter app (Localization)

Hey dear readers, welcome back in our blog 1GB Developer. Now we are going to implement the feature which is responsible for supporting multi-language in your device. For example if you dont like english then change the app language into hindi.

So let start our coding for multi-language  support in flutter application :


Step 1. 

create two file named a) app_en.arb and b)app_hi.arb in lib/l10n :


a) app_hi.arb which contain data like this:

{

  "signup_welcome_desc": "เคถुเคฐू เค•เคฐเคจे เค•े เคฒिเค เคซॉเคฐ्เคฎ เคญเคฐें",

  "welcome_back": "เคตाเคชเคธी เคชเคฐ เคธ्เคตाเค—เคค เคนै!",

  "login_welcome_desc": "เค…เคชเคจे เค–ाเคคा เค•ो เคช्เคฐเคฌंเคงिเคค เค•เคฐเคจे เค•े เคฒिเค เคฒॉเค—िเคจ เค•เคฐें",

  "mobile_no": "เคฎोเคฌाเค‡เคฒ เคจंเคฌเคฐ",

  "email_address": "เคˆเคฎेเคฒ เคชเคคा",

  "mobile_no_email":"เคฎोเคฌाเค‡เคฒ เคจंเคฌเคฐ/เคˆเคฎेเคฒ",

  "forgot_password":"เคชाเคธเคตเคฐ्เคก เคญूเคฒ เค—เค?",

  "password": "เคชाเคธเคตเคฐ्เคก",

  "confirm_password": "เคชाเคธเคตเคฐ्เคก เค•ी เคชुเคท्เคŸि เค•เคฐें",

  "name":"เคจाเคฎ",

  "referral":"เคฐेเคซ़เคฐเคฒ เคฆเคฐ्เคœ เค•เคฐें (เคตैเค•เคฒ्เคชिเค•)",

  "get_started": "เคถुเคฐू เคนो เคœाเค“",

  "have_an_account": "{prefix} เคเค• เค–ाเคคा เคนै",

  "login": "เคฒॉเค—िเคจ",

  "sign_up": "เคธाเค‡เคจ เค…เคช",

  "trending_products": "เคšเคฐ्เคšिเคค เค‰เคค्เคชाเคฆ",

  "popular_products": "เคฒोเค•เคช्เคฐिเคฏ เค‰เคค्เคชाเคฆ",

  "new_products": "เคจเค เค‰เคค्เคชाเคฆ",

  "known_products": "เคช्เคฐเคธिเคฆ्เคง เค‰เคค्เคชाเคฆ",

  "signup_for_newsletter": "เคธเคฎाเคšाเคฐ เคชเคค्เคฐिเค•ा เค•े เคฒिเค เคธाเค‡เคจ เค…เคช เค•เคฐें",

  "contact_info": "เคธंเคชเคฐ्เค• เคœाเคจเค•ाเคฐी",

  "rupee":"₹. {value}",

  "edit_profile": "เคช्เคฐोเคซ़ाเค‡เคฒ เคธंเคชाเคฆिเคค เค•เคฐें",

  "wallet": "เคฌเคŸुเค†",

  "manage_address": "เคชเคคे เค•ा เคช्เคฐเคฌंเคงเคจ",

  "language": "เคญाเคทा",

  "setting": "เคธेเคŸिंเค—्เคธ",

  "privacy": "เค—ोเคชเคจीเคฏเคคा",

  "sign_out": "เคธाเค‡เคจ เค†เค‰เคŸ",

  "your_orders": "เค†เคชเค•े เค†เคฆेเคถ",

  "buy_again": "เคซिเคฐ เคธे เค–เคฐीเคฆें",

  "your_account": "เค†เคชเค•ा เค–ाเคคा",

  "your_lists": "เค†เคชเค•ी เคธूเคšिเคฏाँ",

  "term_and_condition": "เคจिเคฏเคฎ เค”เคฐ เคถเคฐ्เคคें",

  "search": "เค–ोเคœें",

  "add_to_cart": "เค•ाเคฐ्เคŸ เคฎें เคกाเคฒें",

  "add_to_wishlist": "เค‡เคš्เค›ा เคธूเคšी เคฎें เคœोเคก़ें",

  "added_to_wishlist": "เค‡เคš्เค›ा เคธूเคšी เคฎें เคœोเคก़ा เค—เคฏा",

  "percent_discount": "{value}% เค›ूเคŸ",

  "compare": "เคคुเคฒเคจा เค•เคฐें",

  "color": "เคฐंเค—",

  "delivery": "เคกिเคฒीเคตเคฐी",

  "product_description": "เค‰เคค्เคชाเคฆ เคตिเคตเคฐเคฃ",

  "available_offers": "เค‰เคชเคฒเคฌ्เคง เค‘เคซ़เคฐ",

  "quantity": "เคฎाเคค्เคฐा",

  "go_to_cart": "เค•ाเคฐ्เคŸ เคชเคฐ เคœाเคं",

  "checkout": "เคšेเค•เค†เค‰เคŸ",

  "save_for_later": "เคฌाเคฆ เคฎें เคธเคนेเคœें",

  "delete": "เคนเคŸाเคं",

  "proceed_with_defaul_address": "เคกिเคซ़ॉเคฒ्เคŸ เคชเคคे เค•े เคธाเคฅ เค†เค—े เคฌเคข़ें",

  "proceed": "เค†เค—े เคฌเคข़ें",

  "pay_online": "เค‘เคจเคฒाเค‡เคจ เคญुเค—เคคाเคจ เค•เคฐें",

  "cash_on_delivery": "เค•ैเคถ เค‘เคจ เคกिเคฒीเคตเคฐी"

}


b) app_hi.arb which contain data like this:


{

  "signup_welcome_desc":"Fill out the form to get started",

  "welcome_back":"Sign in",

  "login_welcome_desc":"Login to manage your account",

  "mobile_no_email":"Mobile No./Email",

  "mobile_no":"Mobile No.",

  "forgot_password":"Forgot Password?",

  "email_address":"Email address",

  "password":"Password",

  "confirm_password":"Confirm Password",

  "name":"Name",

  "referral":"Enter Referral (optional)",

  "get_started":"Get Started",

  "have_an_account":"{prefix} have an account.",

  "login":"Login",

  "sign_up":"Sign Up",

  "trending_products": "Trending Products",

  "popular_products":"Popular Products",

  "new_products":"New Products",

  "known_products":"Known Products",

  "signup_for_newsletter":"Sign up for Newsletter",

  "contact_info":"Contact Info",

  "rupee":"Rs. {value}",

  "edit_profile":"Edit Profile",

  "wallet":"Wallet",

  "manage_address":"Manage Address",

  "language":"Language",

  "setting":"Setting",

  "privacy":"Privacy",

  "sign_out":"Sign Out",

  "your_orders":"Your Orders",

  "buy_again":"Buy Again",

  "your_account":"Your Account",

  "your_lists":"Your Lists",

  "term_and_condition":"Term and conditions",

  "search":"Search",

  "add_to_cart":"Add to cart",

  "add_to_wishlist":"Add to wishlist",

  "added_to_wishlist":"Added to wishlist",

  "percent_discount":"{value}% off",

  "compare":"Compare",

  "color":"Color",

  "delivery":"Delivery",

  "product_description":"Product Description",

  "available_offers":"Available Offers",

  "quantity":"Quantity",

  "go_to_cart":"Go to Kart",

  "checkout":"Checkout",

  "save_for_later":"Save for Later",

  "delete":"Delete",

  "proceed_with_defaul_address":"Proceed with default address",

  "proceed":"Proceed",

  "pay_online":"Pay Online",

  "cash_on_delivery":"Cash On Delivery"


}


step 2.  

In root directory where pubs.yaml file is present create new file with name l10n.yaml and put this code inside:


arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart


Step 3. 

Go to main.dart file and put this code :



import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
@override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Localizations Sample App',
      debugShowCheckedModeBanner: false,
      locale: Locale('hi'),
      localizationsDelegates: const [
        AppLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const [
        Locale('en'),
        Locale('hi'),
      ],



Now this path will generated later when you build the code:

import 'package:flutter_gen/gen_l10n/app_localizations.dart';

Also dont forget to add this line in your pubs.yaml file:

# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
  generate: true

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/
  #   - images/a_dot_ham.jpeg
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware
  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages
  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For

This generate:true will generate the file for localization.

also install this package: intl:^0.18.1


Thank you. Happy flutter  ๐Ÿ˜ƒ

๐Ÿ’˜ Constructors & Destructors in C++ – Jab GF-BF Ke Life Me Entry Aur Breakup Hota ๐Ÿ’”๐Ÿฅน

Constructors & Destructors in C++ – GF-BF Format ๐Ÿ’ก "Constructor tab call hota jab relationship start hoyi ...