my_widgets 1.0.0 copy "my_widgets: ^1.0.0" to clipboard
my_widgets: ^1.0.0 copied to clipboard

MyWidgets provides a collection of reusable widgets, utilities, dialogs, and services for Flutter, simplifying common tasks and enabling powerful actions with minimal code

Flutter Package: My Widgets #

Overview #

This Flutter package, originally created by Bilal MurtaZa, offers a comprehensive set of reusable widgets, utility functions, dialogs, and services for Flutter development. The package is designed to simplify common tasks in Flutter apps and allows users to perform big actions with just a single line of code.

Features #

  • Reusable widgets such as Btn, Txt, Input,Dialogs, Dates and almost all commonly used widgets.
  • Custom dialogs like OverlayLoading and DialogForPage.
  • Utility functions for shared preferences (Pref), date formatting (Dates), and HTTP calls (HttpCalls).
  • Users can change colors for every app using built-in functions.

Getting Started #

To allow users to change colors for the entire app, you can set color schemes with ease. Users can also manage shared preferences and localize dates with simple function calls.

Usage #

Set Application Colors #

Users can set a color scheme for their app using the following code. It is preferable to use this before the main() function.

WidgetsFlutterBinding.ensureInitialized();

String prdBaseURL = 'https://xvz/api/'; // optional
String stgBaseURL = 'https://xvz/api/'; // optional
await pSetSettings(
    primaryColor: Colors.blueAccent,
    secondaryColor: Colors.white,
    defaultImage: 'assets/images/avatar.png',
    defImageIsAsset: true,
    baseUrlLive: prdBaseURL,
    baseUrlTest: stgBaseURL,
    isLive: false,
    defaultRadius: Siz.defaultRadius,
    defaultBtnHeight: Siz.defaultBtnHeight,
    txtInputHasBorder: true,
    txtInputHasLabel: true,
    txtInputHasLabelOnTop: true,
    txtInputHasLabelWithStar: false,
    txtInoutDefaultContentPadding: const EdgeInsets.symmetric(horizontal: 10),
    fontWeight: FontWeight.w600,
    defaultFontSize: Siz.body17,
    localization: 'ar',
    onHttpCallError: callHttpError
);
runApp(const MyApp());
runMain();

Use Shared Preferences #

If you want to use Shared Preferences in your app, make sure to call Pref.getPref() before pSetSettings.

await Pref.getPref();
pSetSettings();
runMain();

Localize Dates #

If you need to localize dates in your app, use the Dates.initializeDateFormat() method before pSetSettings.

await Dates.initializeDateFormat();
pSetSettings();
runMain();

Example #

await Pref.getPref();
await Dates.initializeDateFormat();
pSetSettings();
runMain();

Android and iOS Configuration #

URL Launcher Configuration #

To use pUrlLaunch for opening links or making calls/SMS, follow the platform-specific steps below:

Android

Add the following queries in your AndroidManifest.xml:

<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="sms" />
    </intent>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="tel" />
    </intent>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="http" />
    </intent>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
    </intent>
    <intent>
        <action android:name="android.intent.action.SEND" />
        <data android:mimeType="*/*" />
    </intent>
</queries>

iOS

In info.plist, add the following entries:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>sms</string>
    <string>tel</string>
    <string>http</string>
    <string>https</string>
</array>

Some other useful commands #

Uninstalling the Package #

To uninstall the package from your app, use the following adb command:

adb uninstall "com.domain.yourapp"

Finding SHA1 and SHA-256 #

To find the SHA1 and SHA-256 keys, navigate to your Android folder in the terminal and run:

./gradlew signingReport

Generating Android Certificates #

To create a certificate for Android from a MacBook, use the following command:

keytool -genkey -v -keystore ~/key-<flavor_name>.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key <flavor_name>
  • Flutter Error Handler: A comprehensive global error handler package for Flutter applications, designed to simplify error tracking and improve app stability. It captures both framework-level and asynchronous errors, ensuring no error goes unnoticed.

  • Flutter Loading Overlay: Provides a simple and flexible way to manage loading overlays in Flutter apps. It allows you to start and stop loading overlays effortlessly and customize their appearance with ease.

Additional Information #

If you encounter any issues, please contact us at bilal.faith@gmail.com.

8
likes
150
pub points
75%
popularity

Publisher

verified publisheresolutionsprovider.com

MyWidgets provides a collection of reusable widgets, utilities, dialogs, and services for Flutter, simplifying common tasks and enabling powerful actions with minimal code

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cached_network_image, flutter, flutter_dialogs, fluttertoast, get, http, intl, photo_view, shared_preferences, url_launcher

More

Packages that depend on my_widgets