base_lib_pub 3.7.2 copy "base_lib_pub: ^3.7.2" to clipboard
base_lib_pub: ^3.7.2 copied to clipboard

This is a basic library based on Getx. In order to build applications conveniently and quickly, you can quickly integrate the basic functions needed by general applications.

example/lib/main.dart

import 'package:base_lib_pub/base_lib_pub.dart';
import 'package:base_lib_pub_example/const/my_const.dart';
import 'package:base_lib_pub_example/main_logic.dart';
import 'package:base_lib_pub_example/route/routes.dart';
import 'package:base_lib_pub_example/theme/my_themes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'trans/translation.dart';

void main() {
  runMyApp(
    const MyApp(),
    enableLog: MyConst.isDebug || MyConst.isForceLog,
    initWeChat: true,
    beforeRun: () async {
      /// 初始化网络请求
      initGlobalDio(ignoreCertificate: true);
      Get.put(MainLogic(), permanent: true);
    },
  );
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();

    onBuildFinished((duration) {
      // 手动配置主题,重启时需要切换
      MyThemes.changeTheme();
    });
  }

  @override
  Widget build(BuildContext context) {
    return baseApp(
      // 路由
      initialRoute: Routes.init,
      getPages: Routes.getPages(),
      unPopRoutes: Routes.unPopRoutes,
      defaultTransition: Transition.cupertino,
      navigatorObservers: [
        // botToast
        toastObserver
      ],
      // 系统栏样式
      isStatusBarIconLight: false,
      isSysNavigationBarIconLight: false,
      // 主题
      // 手动配置主题,只初始化theme即可,切换即改变MyThemes.curThemeHolder
      theme: MyThemes.curThemeHolder.themeData,
      // 如果需要跟随系统主题变化,需要配置themeMode和darkTheme
      // themeMode: ThemeMode.light,
      // darkTheme: MyThemes.dark,
      // 国际化配置
      locale: MyTrans.locale,
      fallbackLocale: MyTrans.fallbackLocale,
      translations: MyTrans(),
      // botToast
      builder: toastBuilder,
    );
  }
}
copied to clipboard
4
likes
100
points
140
downloads

Publisher

verified publisherhomedot.space

Weekly Downloads

2024.07.06 - 2025.01.18

This is a basic library based on Getx. In order to build applications conveniently and quickly, you can quickly integrate the basic functions needed by general applications.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

bot_toast, date_format, device_info_plus, dio, encrypt, extended_image, flutter, flutter_image_compress, flutter_slidable, get, harmony_plugin, image_gallery_saver, package_info_plus, path, path_provider, permission_handler, share_plus, shared_preferences, simple_animations, uri_to_file, url_launcher, vibration, webview_flutter, wechat_assets_picker, wechat_camera_picker

More

Packages that depend on base_lib_pub