flutter_easy

Last updated:

0 purchases

flutter_easy Image
flutter_easy Images
Add to Cart

Description:

flutter easy

flutter_easy #




A common Flutter package.
Example
Getting Started #
Additional arguments:
--dart-define=app-debug-flag=true
copied to clipboard
Run:
flutter run --release --dart-define=app-debug-flag=true
copied to clipboard
Example:
main.dart
void main() async {
await initEasyApp(
appBaseURLChangedCallback: () {
// Reload API
configAPI(null);
},
);
await initApp();
runApp(const MyApp());
if (isAndroid) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
// Set overlay style status bar. It must run after MyApp(), because MaterialApp may override it.
SystemUiOverlayStyle systemUiOverlayStyle =
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
}
copied to clipboard
app.dart
Future<void> initApp() async {
// Encrypt password
StorageUtil.setEncrypt("XxXxXxXxXxXxXxXxX");
// Load user info
await Get.putAsync(() => UserService().load());
// Load API
configAPI(null);
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return BaseApp(
initialRoute: Routes.splash,
getPages: Routes.routes,
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
LocaleNamesLocalizationsDelegate(),
],
supportedLocales: S.delegate.supportedLocales,
locale: Get.deviceLocale,
localeResolutionCallback:
(Locale? locale, Iterable<Locale> supportedLocales) {
logDebug("localeResolutionCallback: $locale");
if (locale == null || !S.delegate.isSupported(locale)) {
return null;
}
if (locale.languageCode == "zh") {
return const Locale("zh", "CN");
}
return locale;
},
);
}
}
copied to clipboard
routes.dart
class Routes {
static final String root = '/';
static final String splash = '/splash';

Routes._();

static final List<GetPage> routes = [
GetPage(
name: Routes.root,
page: () => RootPage(),
),
GetPage(
name: Routes.splash,
page: () => SplashPage(),
),
GetPage(
name: routesLoginNamed,
page: () => LoginPage(),
),
}
copied to clipboard
Installing #
Add flutter_easy to your pubspec.yaml file:
dependencies:
flutter_easy:
copied to clipboard
Import flutter_easy in files that it will be used:
import 'package:flutter_easy/flutter_easy.dart';
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.