stream_language 0.1.2 copy "stream_language: ^0.1.2" to clipboard
stream_language: ^0.1.2 copied to clipboard

outdated

A simple way to support your Flutter application, which from firebase with realtime database supports multiple languages!

example/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final language = LanguageBloc(
      child: 'languages',
      defaultLanguage: 'pt_BR',
      defaultRoute: 'default'
  );

  @override
  Widget build(BuildContext context) {
    return FirstLanguageStart(
      future: language.init(),
      builder: (c){
        return StreamLanguage(
          screenRoute: ['screen-1'],
          builder: (data, route, def) => Scaffold(
            appBar: AppBar(
              title: Text(route['title']),
            ),
            body: Center(
              child: RaisedButton(
                  child: Text(route['btn']),
                  onPressed: () => language.showAlertChangeLanguage(
                      context: context,
                      title: def['change-language']['title'],
                      btnNegative: def['change-language']['btn-negative']
                  )
              ),
            ), // This trailing comma makes auto-formatting nicer for build methods.
          ),
        );
      },
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

verified publishercleancode.dev

A simple way to support your Flutter application, which from firebase with realtime database supports multiple languages!

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

bloc_pattern, country_pickers, devicelocale, firebase_database, flutter, rxdart

More

Packages that depend on stream_language