smart_localize 0.0.9 copy "smart_localize: ^0.0.9" to clipboard
smart_localize: ^0.0.9 copied to clipboard

is a Flutter localization package that efficiently handles translations by dynamically loading language resources based on the app's locale, with robust fallback support.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:smart_localize/smart_localize.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      supportedLocales: const [
        Locale('en'),
        Locale('ar'),
      ],
      locale: const Locale('ar'),
      localeResolutionCallback: (locale, supportedLocales) =>
          supportedLocales.contains(locale) ? locale : const Locale('en'),
      localizationsDelegates: context.smartLocalizeDelegates,
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(SmartLocalize.home),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              SmartLocalize.company,
              style: const TextStyle(fontSize: 14),
            ),
            Text(
              SmartLocalizeValidation.passwordLowercase,
              style: const TextStyle(fontSize: 14),
            ),
            Text(
              SmartLocalizeConfirmation.addToCart,
              style: const TextStyle(fontSize: 14),
            ),
            Text(
              SmartLocalizePlaceholder.enterEmail,
              style: const TextStyle(fontSize: 14),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
0
points
471
downloads

Publisher

verified publisherabdelrahman.ghanem.eg

Weekly Downloads

is a Flutter localization package that efficiently handles translations by dynamically loading language resources based on the app's locale, with robust fallback support.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_localizations

More

Packages that depend on smart_localize