multi_language_json 1.1.0+1 copy "multi_language_json: ^1.1.0+1" to clipboard
multi_language_json: ^1.1.0+1 copied to clipboard

outdated

A simple way to support your Flutter application with multiple languages!

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Multi Language - Example',
        home: Home(),
        supportedLocales: [
          const Locale('en', 'US'),
          const Locale('pt', 'BR')
        ]
    );
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final language = MultiLanguageBloc(
      initialLanguage: 'pt_BR',
      defaultLanguage: 'pt_BR',
      commonRoute: 'common',
      supportedLanguages: [
        'en_US', 'pt_BR'
      ]
  );
  
  @override
  Widget build(BuildContext context) {

    return MultiLanguageStart(
      future: language.init(), 
      builder: (c) => MultiStreamLanguage(
        screenRoute: ['home'],
        builder: (c, d) => Scaffold(
          appBar: AppBar(
            title: Text(d.getValue(route: ['title'])),
          ),
          body: Center(
            child: RaisedButton(
              child: Text(d.getValue(route: ['btn'])),
              onPressed: () => language.showAlertChangeLanguage(
                context: context,
                title: d.getValue(
                    route: ['dialog', 'title'],
                    inRoute: false
                ),
                btnNegative: d.getValue(
                    route: ['dialog', 'btn_negative'],
                    inRoute: false
                )
              ),
            ),
          ),
        )
      )
    );
  }
}
22
likes
0
pub points
75%
popularity

Publisher

verified publishercleancode.dev

A simple way to support your Flutter application with multiple languages!

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

country_pickers, flutter, rxdart

More

Packages that depend on multi_language_json