fastor_app_ui_widget 0.0.40 copy "fastor_app_ui_widget: ^0.0.40" to clipboard
fastor_app_ui_widget: ^0.0.40 copied to clipboard

outdated

Coding Faster By Build Fast UI Widget

Features #

  • Helping make coding faster.
  • Rapid, scalable development and clean design.
  • Increase reliable.
  • Enables developer to build, organize, deliver, and modify different content of generic items.

Get Start #

1- import dependence in yaml file:

fastor_app_ui_widget:

2- at any class must import

import 'package:fastor_app_ui_widget/fastor_app_ui_widget.dart';

3- must use libaray of localication text, called "easy_localization" and so that must create empty files in path 'assets/translations' and also create two language mandatory for left and right direction ar-EG.json en-US.json

  • not forget write assets path
  assets:
  - assets/translations/en-US.json
  - assets/translations/ar-EG.json

4- configure firebase project see https://firebase.flutter.dev/docs/overview

5- create simple class "SplashPage.dart" class extends StateFullWidget

6- main.dart file replace "main()" by this code :

import 'package:fastor_app_ui_widget/fastor_app_ui_widget.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'firebase_options.dart';
import 'package:flutter/material.dart'  if (dart.library.html)   'dart:html';
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:universal_io/io.dart';
import 'package:firebase_analytics/firebase_analytics.dart';

 void  main()   async  {
   //webview
   await WidgetsFlutterBinding.ensureInitialized();


   //translation
   await EasyLocalization.ensureInitialized();

   //firebase
   await Firebase.initializeApp(
     options: DefaultFirebaseOptions.currentPlatform, //firebaseOptionsCurrentPlatform,
   );

  //webview
  await WidgetsFlutterBinding.ensureInitialized();

  //webview
  if (Platform.isAndroid) {
    await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);

    var swAvailable = await AndroidWebViewFeature.isFeatureSupported(
        AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE);
    var swInterceptAvailable = await AndroidWebViewFeature.isFeatureSupported(
        AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);

    if (swAvailable && swInterceptAvailable) {
      AndroidServiceWorkerController serviceWorkerController =
      AndroidServiceWorkerController.instance();

      serviceWorkerController.serviceWorkerClient = AndroidServiceWorkerClient(
        shouldInterceptRequest: (request) async {
          print(request);
          return null;
        },
      );
    }
  }

  //translation
  await EasyLocalization.ensureInitialized();

  //firebase
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform, //firebaseOptionsCurrentPlatform,
  );

  // //run
  runApp(

    EasyLocalization(
        supportedLocales:   LanguageTools.listLocal,
        path:  'assets/translations',// 'assets/translations',
        fallbackLocale:  LanguageTools.defaultLocal,
        child: AppTheme()
    ),
  );
}


//--------------------------------------------------------------------- app theme

class AppTheme extends StatelessWidget {

  late BuildContext context;

  @override
  Widget build(BuildContext context) {
    this.context = context;


    //theme
    return getMaterialApp();
  }

  /**
   * import 'package:firebase_analytics/firebase_analytics.dart';
   */
  static FirebaseAnalytics analytics = FirebaseAnalytics.instance;
  static FirebaseAnalyticsObserver observer = new FirebaseAnalyticsObserver(
      analytics: analytics);


  MaterialApp getMaterialApp() {
    return MaterialApp(

      //language translation
        locale: context.locale,
        supportedLocales: context.supportedLocales,
        localizationsDelegates: context.localizationDelegates,


        title: 'Scuba',

        navigatorObservers: <NavigatorObserver>[observer],
        // navigatorObservers: <RouteObserver<ModalRoute<void>>>[ routeObserver ],

        //
        color: Colors.black,
        debugShowCheckedModeBanner: false,


        //language direction RTL or LTR
        home: Directionality( // add this
          textDirection: LanguageTools.getTextDirection(context),
          // set this property
          child: nextPage(),
        )

    );
  }

}

//---------------------------------------------------------------------------- launch page

Widget nextPage() {


  return SplashPage();
}

License BSD 3 #

Copyright (c) 2022, Abdallah Mahmoud Ahmed Shehata
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
* Neither the name of fastor-app.com nor the names of its contributors
  may be used to endorse or promote products derived from this software
  without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.