Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit e506a560 authored by dleurs's avatar dleurs
Browse files

Every thing working

parent d50f8b0a
No related branches found
No related tags found
No related merge requests found
Showing
with 592 additions and 112 deletions
# internalisation
# Internalisation
A new Flutter project.
Localisation requires the Flutter Intl plugin (available on VSCode and IntelliJ marketplaces)
Needs to be installed to properly add and manage new supported locales
## Getting Started
- Flutter Intl on Android Studio (IntelliJ)
- Flutter Intl on VSCode
This project is a starting point for a Flutter application.
![Demo App](/assets/demo-app.gif)
A few resources to get you started if this is your first Flutter project:
Check this URL for information :<br/>
https://marketplace.visualstudio.com/items?itemName=localizely.flutter-intl
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
- Initialise, cmd-vscode : Flutter Intl: Initialize
- ios/Runner/Info.plist add
```bash
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>fr_FR</string>
...
</array>
```
- Add language, cmd-vscode : Flutter Intl: Add locale
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
To check plural :<br/>
https://pub.dev/documentation/intl/latest/intl/Intl/plural.html
To check gender : <br/>
https://pub.dev/documentation/intl/latest/intl/Intl/gender.html
Other demo :<br/>
https://github.com/localizely/flutter-intl-plugin-sample-app
Youtube video :<br/>
https://www.youtube.com/watch?v=MQo32dQxxjg
Localizely :<br/>
https://localizely.com/flutter-localization-workflow/<br/>
Connecting with Localizely ID project and Key did not work. Import / export arb
Localise has got a good interface for translation <br/>
![ScreenshotLocalizely](/assets/ScreenshotLocalizely.png)
\ No newline at end of file
assets/Screenshot 2020-10-14 at 17.30.52.png

302 KiB

assets/Screenshot 2020-10-14 at 17.33.54.png

346 KiB

assets/Screenshot 2020-10-14 at 17.34.00.png

249 KiB

assets/Screenshot 2020-10-14 at 17.34.05.png

224 KiB

assets/ScreenshotLocalizely.png

302 KiB

assets/demo-app.gif

4.9 MiB

......@@ -4,6 +4,12 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>fr</string>
<string>ru</string>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that looks up messages for specific locales by
// delegating to the appropriate library.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:implementation_imports, file_names, unnecessary_new
// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
// ignore_for_file:argument_type_not_assignable, invalid_assignment
// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
// ignore_for_file:comment_references
import 'dart:async';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
import 'messages_en.dart' as messages_en;
import 'messages_fr.dart' as messages_fr;
import 'messages_ru.dart' as messages_ru;
typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new Future.value(null),
'fr': () => new Future.value(null),
'ru': () => new Future.value(null),
};
MessageLookupByLibrary _findExact(String localeName) {
switch (localeName) {
case 'en':
return messages_en.messages;
case 'fr':
return messages_fr.messages;
case 'ru':
return messages_ru.messages;
default:
return null;
}
}
/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
await (lib == null ? new Future.value(false) : lib());
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new Future.value(true);
}
bool _messagesExistFor(String locale) {
try {
return _findExact(locale) != null;
} catch (e) {
return false;
}
}
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a en locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';
static m0(counter) => "${Intl.plural(counter, zero: 'You have never pushed the button.', one: 'You have pushed this button one time.', other: 'You have pushed this button ${counter} times.')}";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"appTitle" : MessageLookupByLibrary.simpleMessage("Internalisation App"),
"counterText" : m0,
"yourLanguageCodeIs" : MessageLookupByLibrary.simpleMessage("Your language code is :")
};
}
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a fr locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'fr';
static m0(counter) => "${Intl.plural(counter, zero: 'Vous n\'avez jamais appuyé sur le bouton.', one: 'Vous avez appuyé une fois sur ce bouton.', other: 'Vous avez appuyé sur ce bouton ${counter} fois.')}";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"appTitle" : MessageLookupByLibrary.simpleMessage("Application d\'internalisation"),
"counterText" : m0,
"yourLanguageCodeIs" : MessageLookupByLibrary.simpleMessage("Votre code de langue est:")
};
}
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a ru locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'ru';
static m0(counter) => "${Intl.plural(counter, zero: 'Вы никогда не нажимали на кнопку.', one: 'Вы нажали эту кнопку ${counter} раз.', few: 'Вы нажимали эту кнопку ${counter} раз.', many: 'Вы нажимали эту кнопку ${counter} раз.', other: 'Вы нажимали эту кнопку ${counter} раз.')}";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"appTitle" : MessageLookupByLibrary.simpleMessage("Приложение для интернализации"),
"counterText" : m0,
"yourLanguageCodeIs" : MessageLookupByLibrary.simpleMessage("Ваш языковой код:")
};
}
// GENERATED CODE - DO NOT MODIFY BY HAND
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'intl/messages_all.dart';
// **************************************************************************
// Generator: Flutter Intl IDE plugin
// Made by Localizely
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars
class S {
S();
static S current;
static const AppLocalizationDelegate delegate =
AppLocalizationDelegate();
static Future<S> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false) ? locale.languageCode : locale.toString();
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
S.current = S();
return S.current;
});
}
static S of(BuildContext context) {
return Localizations.of<S>(context, S);
}
/// `Internalisation App`
String get appTitle {
return Intl.message(
'Internalisation App',
name: 'appTitle',
desc: '',
args: [],
);
}
/// `{counter, plural, zero{You have never pushed the button.} one{You have pushed this button one time.} other{You have pushed this button {counter} times.}}`
String counterText(num counter) {
return Intl.plural(
counter,
zero: 'You have never pushed the button.',
one: 'You have pushed this button one time.',
other: 'You have pushed this button $counter times.',
name: 'counterText',
desc: '',
args: [counter],
);
}
/// `Your language code is :`
String get yourLanguageCodeIs {
return Intl.message(
'Your language code is :',
name: 'yourLanguageCodeIs',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
const AppLocalizationDelegate();
List<Locale> get supportedLocales {
return const <Locale>[
Locale.fromSubtags(languageCode: 'en'),
Locale.fromSubtags(languageCode: 'fr'),
Locale.fromSubtags(languageCode: 'ru'),
];
}
@override
bool isSupported(Locale locale) => _isSupported(locale);
@override
Future<S> load(Locale locale) => S.load(locale);
@override
bool shouldReload(AppLocalizationDelegate old) => false;
bool _isSupported(Locale locale) {
if (locale != null) {
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) {
return true;
}
}
}
return false;
}
}
\ No newline at end of file
{
"@@locale": "en",
"appTitle": "Internalisation App",
"@appTitle": {},
"counterText": "{counter, plural, zero{You have never pushed the button.} one{You have pushed this button one time.} other{You have pushed this button {counter} times.}}",
"@counterText": {},
"yourLanguageCodeIs": "Your language code is :",
"@yourLanguageCodeIs": {}
}
\ No newline at end of file
{
"@@locale": "fr",
"appTitle": "Application d'internalisation",
"@appTitle": {},
"counterText": "{counter, plural, zero{Vous n'avez jamais appuyé sur le bouton.} one{Vous avez appuyé une fois sur ce bouton.} other{Vous avez appuyé sur ce bouton {counter} fois.}}",
"@counterText": {},
"yourLanguageCodeIs": "Votre code de langue est:",
"@yourLanguageCodeIs": {}
}
\ No newline at end of file
{
"@@locale": "ru",
"appTitle": "Приложение для интернализации",
"@appTitle": {},
"counterText": "{counter, plural, zero{Вы никогда не нажимали на кнопку.} one{Вы нажали эту кнопку {counter} раз.} few{Вы нажимали эту кнопку {counter} раз.} many{Вы нажимали эту кнопку {counter} раз.} other{Вы нажимали эту кнопку {counter} раз.}}",
"@counterText": {},
"yourLanguageCodeIs": "Ваш языковой код:",
"@yourLanguageCodeIs": {}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:internalisation/generated/l10n.dart';
import 'package:intl/intl.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',
title:
"Flutter App", // S.of(context).appTitle not working. Too high in the tree
localizationsDelegates: [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
......@@ -54,51 +41,63 @@ class _MyHomePageState extends State<MyHomePage> {
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
void _decrementCounter() {
setState(() {
_counter--;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
title: Text(S.of(context).appTitle),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
S.of(context).yourLanguageCodeIs + " " + Intl.getCurrentLocale(),
style: Theme.of(context).textTheme.headline5,
),
SizedBox(height: 25),
ButtonBar(
alignment: MainAxisAlignment.center,
children: [
RaisedButton(
onPressed: () {
setState(() {
S.load(Locale("en"));
});
},
child: Text("To English"),
),
RaisedButton(
onPressed: () {
setState(() {
S.load(Locale("fr"));
});
},
child: Text("En français"),
),
RaisedButton(
onPressed: () {
setState(() {
S.load(Locale("ru"));
});
},
child: Text("На русском"),
)
],
),
SizedBox(height: 25),
Text(
S.of(context).counterText(_counter),
),
Text(
'$_counter',
......@@ -107,11 +106,26 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FloatingActionButton(
heroTag: 'IncrementButton',
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
SizedBox(
height: 10,
),
FloatingActionButton(
heroTag: 'DecrementButton',
onPressed: _decrementCounter,
tooltip: 'Decrement',
child: Icon(Icons.remove),
),
],
),
);
}
}
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.39.17"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
......@@ -29,6 +57,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
clock:
dependency: transitive
description:
......@@ -43,6 +78,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.3"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.2"
cupertino_icons:
dependency: "direct main"
description:
......@@ -50,6 +106,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.6"
fake_async:
dependency: transitive
description:
......@@ -62,11 +125,72 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0+4"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
intl_translation:
dependency: transitive
description:
name: intl_translation
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.10"
intl_utils:
dependency: "direct main"
description:
name: intl_utils
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.2"
matcher:
dependency: transitive
description:
......@@ -81,6 +205,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
path:
dependency: transitive
description:
......@@ -88,6 +233,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
sky_engine:
dependency: transitive
description: flutter
......@@ -149,5 +315,19 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+15"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.10.0-110 <2.11.0"
......@@ -23,11 +23,11 @@ environment:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.0
intl: ^0.16.1
intl_utils: ^1.8.0
dev_dependencies:
flutter_test:
......@@ -35,7 +35,6 @@ dev_dependencies:
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
......@@ -43,18 +42,14 @@ flutter:
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
......@@ -74,3 +69,5 @@ flutter:
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
flutter_intl:
enabled: true
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:internalisation/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment