simple_flutter_i18n 1.1.0+4 copy "simple_flutter_i18n: ^1.1.0+4" to clipboard
simple_flutter_i18n: ^1.1.0+4 copied to clipboard

outdated

a package that makes it easy to have multiple langauges in your application

example/main.dart

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

import '../lib/simple_flutter_i18n.dart';
import './screens/homeScreen.dart';

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

Map <String, dynamic> en = {
  'isRtl': false,
  'welcome': "Welcome"
};

class MyApp extends StatelessWidget {
  Widget _builder(context, child) {
    final isRtl = Provider.of<I18n>(context).isRtl;

    return Directionality(
      textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr,
      child: child,
    );
  }

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider.value(value:I18n(en))
      ],
      child: MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(),
        builder: _builder,
        home: HomeScreen(),
      ),
    );
  }
}
9
likes
0
pub points
0%
popularity

Publisher

unverified uploader

a package that makes it easy to have multiple langauges in your application

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cupertino_icons, flutter, shared_preferences

More

Packages that depend on simple_flutter_i18n