From a3e7568bca68e6ecf4f68363be4a855918caa61e Mon Sep 17 00:00:00 2001 From: piyush-shukla03_infosys Date: Mon, 15 May 2023 18:16:19 +0530 Subject: [PATCH] Integrated l18n files for internationalization --- l10n.yaml | 3 + lib/l10n/app_ar.arb | 29 +++++ lib/l10n/app_en.arb | 29 +++++ lib/l10n/app_fr.arb | 29 +++++ lib/login_page.dart | 105 +++++++++--------- lib/main.dart | 51 ++++++--- lib/provider/app_language.dart | 49 ++++++++ lib/test.dart | 41 ++++++- macos/Flutter/GeneratedPluginRegistrant.swift | 2 + pubspec.lock | 69 ++++++++++++ pubspec.yaml | 5 + test/widget_test.dart | 61 ++++++++-- 12 files changed, 396 insertions(+), 77 deletions(-) create mode 100644 l10n.yaml create mode 100644 lib/l10n/app_ar.arb create mode 100644 lib/l10n/app_en.arb create mode 100644 lib/l10n/app_fr.arb create mode 100644 lib/provider/app_language.dart diff --git a/l10n.yaml b/l10n.yaml new file mode 100644 index 000000000..4e6692e55 --- /dev/null +++ b/l10n.yaml @@ -0,0 +1,3 @@ +arb-dir: lib/l10n +template-arb-file: app_en.arb +output-localization-file: app_localizations.dart \ No newline at end of file diff --git a/lib/l10n/app_ar.arb b/lib/l10n/app_ar.arb new file mode 100644 index 000000000..a6d4b3dcc --- /dev/null +++ b/lib/l10n/app_ar.arb @@ -0,0 +1,29 @@ +{ + "english": "الإنكليزية", + "arabic": "العربية", + "french": "الفرنسية", + "locale": "ara", + "help": "تعليمات", + "mosip": "موسيب", + "welcome": "مرحبا بكم في", + "community_reg_text": "عميل تسجيل المجتمع!", + "info_text": "يرجى تسجيل الدخول للوصول إلى الميزات.", + "login_text": "تسجيل الدخول", + "language": "اللغة", + "username": "اسم المستخدم", + "enter_username": "أدخل اسم المستخدم", + "next_button": "مقبل", + "password": "شعار", + "enter_password": "أدخل كلمة المرور", + "forgot_password": "نسيت كلمة المرور", + "login_button": "تسجيل الدخول", + "back_button": "ظهر", + "login_failed": "فشل تسجيل الدخول.. حاول مرة أخرى!", + "user_validated": "تم التحقق من صحة المستخدم!", + "username_required": "اسم المستخدم مطلوب!", + "password_required": "كلمة المرور مطلوبة!", + "username_exceed": "يجب ألا يتجاوز اسم المستخدم 50 حرفا!", + "password_exceed": "يجب ألا تتجاوز كلمة المرور 50 حرفا!", + "username_incorrect": "لم يتم العثور على المستخدم!", + "password_incorrect": "كلمة المرور غير صحيحة!" +} \ No newline at end of file diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb new file mode 100644 index 000000000..d9b9f59a0 --- /dev/null +++ b/lib/l10n/app_en.arb @@ -0,0 +1,29 @@ +{ + "english": "English", + "arabic": "Arabic", + "french": "French", + "locale": "eng", + "help": "HELP", + "mosip": "MOSIP", + "welcome": "Welcome to", + "community_reg_text": "Community Registration Client!", + "info_text": "Please login to access the features.", + "login_text": "Login", + "language": "Language", + "username": "Username", + "enter_username": "Enter Username", + "next_button": "NEXT", + "password": "Password", + "enter_password": "Enter Password", + "forgot_password": "Forgot Password", + "login_button": "LOGIN", + "back_button": "BACK", + "login_failed": "Login Failed..Try Again!", + "user_validated": "User Validated!", + "username_required": "Username is required!", + "password_required": "Password is required!", + "username_exceed": "Username should not exceed 50 characters!", + "password_exceed": "Password should not exceed 50 characters!", + "username_incorrect": "User not found!", + "password_incorrect": "Password incorrect!" +} \ No newline at end of file diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb new file mode 100644 index 000000000..54d79cc33 --- /dev/null +++ b/lib/l10n/app_fr.arb @@ -0,0 +1,29 @@ +{ + "english": "English", + "arabic": "Arabic", + "french": "French", + "locale": "fre", + "help": "AIDE", + "mosip": "MOSIP", + "welcome": "Bienvenue à", + "community_reg_text": "Client d’inscription communautaire", + "info_text": "Veuillez vous connecter pour accéder aux fonctionnalités.", + "login_text": "Connectez-vous", + "language": "Langue", + "username": "Nom d’utilisateur", + "enter_username": "Entrez le nom d’utilisateur", + "next_button": "PROCHAINE", + "password": "Mot de passe", + "enter_password": "Entrez le mot de passe", + "forgot_password": "Mot de passe oublié", + "login_button": "CONNECTEZ-VOUS", + "back_button": "PRÉCÉDENT", + "login_failed": "Echec de la connexion.. Réessayez!", + "user_validated": "Utilisateur validé !", + "username_required": "Le nom d’utilisateur est requis!", + "password_required": "Le mot de passe est requis!", + "username_exceed": "Le nom d’utilisateur ne doit pas dépasser 50 caractères!", + "password_exceed": "Le mot de passe ne doit pas dépasser 50 caractères!", + "username_incorrect": "Utilisateur introuvable !", + "password_incorrect": "Mot de passe incorrect!" +} \ No newline at end of file diff --git a/lib/login_page.dart b/lib/login_page.dart index 7d7cc3cfd..0fd111aa8 100644 --- a/lib/login_page.dart +++ b/lib/login_page.dart @@ -8,12 +8,15 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:provider/provider.dart'; import 'package:registration_client/app_config.dart'; import 'package:registration_client/const/utils.dart'; import 'package:registration_client/credentials_page.dart'; import 'package:flutter/services.dart'; +import 'package:registration_client/provider/app_language.dart'; import 'package:registration_client/registration_client.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class LoginPage extends StatefulWidget { const LoginPage({super.key}); @@ -32,8 +35,8 @@ class _LoginPageState extends State { String username = ''; String password = ''; bool isUserValidated = false; - List _languages = ['English', 'Arabic', 'French']; - String _selectedLanguage = 'English'; + List _languages = ['eng', 'ara', 'fre']; + Map mp = {}; final _formKey = GlobalKey(); TextEditingController usernameController = TextEditingController(); TextEditingController passwordController = TextEditingController(); @@ -41,11 +44,13 @@ class _LoginPageState extends State { @override void initState() { super.initState(); + mp['eng'] = "English"; + mp['ara'] = "Arabic"; + mp['fre'] = "French"; } @override Widget build(BuildContext context) { - // ScreenUtil.init(context); isMobile = MediaQuery.of(context).orientation == Orientation.portrait; double h = ScreenUtil().screenHeight; double w = ScreenUtil().screenWidth; @@ -68,7 +73,7 @@ class _LoginPageState extends State { padding: EdgeInsets.symmetric( horizontal: isMobile ? 16.w : 80.w, ), - child: isMobile ? _mobileView() : _tabletView(), + child: _mobileView(), ), ], ), @@ -177,7 +182,7 @@ class _LoginPageState extends State { ), child: Center( child: Text( - 'HELP', + AppLocalizations.of(context)!.help, style: Utils.mobileHelpText, ), ), @@ -200,11 +205,11 @@ class _LoginPageState extends State { isMobile ? CrossAxisAlignment.center : CrossAxisAlignment.start, children: [ Text( - 'Welcome to', + AppLocalizations.of(context)!.welcome, style: Utils.mobileWelcomeText, ), Text( - 'Community Registration Client!', + AppLocalizations.of(context)!.community_reg_text, style: Utils.mobileCommunityRegClientText, ) ], @@ -219,7 +224,7 @@ class _LoginPageState extends State { horizontal: isMobile ? 52.w : 0, ), child: Text( - 'Please login to access all the features.', + AppLocalizations.of(context)!.info_text, style: Utils.mobileInfoText, ), ); @@ -266,7 +271,7 @@ class _LoginPageState extends State { Container( height: 34.h, child: Text( - 'Login', + AppLocalizations.of(context)!.login_text, style: Utils.mobileHeaderText, ), ), @@ -281,13 +286,14 @@ class _LoginPageState extends State { } Widget _usernameComponent() { + final appLanguage = Provider.of(context, listen: false); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: 17.h, child: Text( - 'Language', + AppLocalizations.of(context)!.language, style: Utils.mobileTextfieldHeader, ), ), @@ -315,13 +321,12 @@ class _LoginPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ DropdownButton( - value: _selectedLanguage, + value: context.watch().selectedLanguage, underline: const SizedBox.shrink(), icon: const SizedBox.shrink(), onChanged: (newValue) { - setState(() { - _selectedLanguage = newValue!; - }); + context.read().selectedLanguage = newValue!; + appLanguage.changeLanguage(Locale(newValue)); }, items: _languages.map((lang) { return DropdownMenuItem( @@ -330,7 +335,7 @@ class _LoginPageState extends State { height: 17.h, // width: 47.w, child: Text( - lang, + mp[lang]!, style: Utils.mobileDropdownText, ), ), @@ -352,7 +357,7 @@ class _LoginPageState extends State { Container( height: 17.h, child: Text( - 'Username', + AppLocalizations.of(context)!.username, style: Utils.mobileTextfieldHeader, ), ), @@ -362,8 +367,8 @@ class _LoginPageState extends State { Container( height: 52.h, alignment: Alignment.centerLeft, - padding: EdgeInsets.only( - left: 17.w, + padding: EdgeInsets.symmetric( + horizontal: 17.w, ), decoration: BoxDecoration( border: Border.all( @@ -377,7 +382,7 @@ class _LoginPageState extends State { child: TextField( controller: usernameController, decoration: InputDecoration( - hintText: 'Enter Username', + hintText: AppLocalizations.of(context)!.enter_username, hintStyle: Utils.mobileTextfieldHintText, border: InputBorder.none, ), @@ -392,9 +397,9 @@ class _LoginPageState extends State { username = usernameController.text; }); if (username.isEmpty) { - _showInSnackBar("Username is required!"); - } else if(username.length > 50) { - _showInSnackBar("Length of Username should not be greater than 50!"); + _showInSnackBar(AppLocalizations.of(context)!.username_required); + } else if (username.length > 50) { + _showInSnackBar(AppLocalizations.of(context)!.username_exceed); } else if (!isUserValidated) { _validateUsername().then((value) { _showInSnackBar(loginResponse); @@ -415,7 +420,7 @@ class _LoginPageState extends State { ), child: Center( child: Text( - 'NEXT', + AppLocalizations.of(context)!.next_button, style: Utils.mobileButtonText, ), ), @@ -432,7 +437,7 @@ class _LoginPageState extends State { Container( height: 17.h, child: Text( - 'Password', + AppLocalizations.of(context)!.password, style: Utils.mobileTextfieldHeader, ), ), @@ -463,7 +468,7 @@ class _LoginPageState extends State { }); }, decoration: InputDecoration( - hintText: 'Enter Password', + hintText: AppLocalizations.of(context)!.enter_password, hintStyle: Utils.mobileTextfieldHintText, border: InputBorder.none, ), @@ -478,7 +483,7 @@ class _LoginPageState extends State { height: 17.h, alignment: Alignment.centerRight, child: Text( - 'Forgot Password?', + AppLocalizations.of(context)!.forgot_password, style: Utils.mobileForgotPasswordText, ), ), @@ -489,11 +494,11 @@ class _LoginPageState extends State { InkWell( onTap: () { debugPrint('Username: $username and Password: $password'); - if(password.isEmpty) { - _showInSnackBar("Password is required!"); + if (password.isEmpty) { + _showInSnackBar(AppLocalizations.of(context)!.password_required); return; - } else if(password.length > 50) { - _showInSnackBar("Length of Password should not be greater than 50!"); + } else if (password.length > 50) { + _showInSnackBar(AppLocalizations.of(context)!.password_exceed); } setState(() { isLoggingIn = true; @@ -520,12 +525,12 @@ class _LoginPageState extends State { child: Center( child: isLoggingIn ? const CircularProgressIndicator( - color: Utils.appWhite, - ) + color: Utils.appWhite, + ) : Text( - 'LOGIN', - style: Utils.mobileButtonText, - ), + AppLocalizations.of(context)!.login_text, + style: Utils.mobileButtonText, + ), ), ), ), @@ -553,7 +558,7 @@ class _LoginPageState extends State { ), child: Center( child: Text( - 'BACK', + AppLocalizations.of(context)!.back_button, style: Utils.mobileBackButtonText, ), ), @@ -575,18 +580,18 @@ class _LoginPageState extends State { ); } - Widget _tabletView() { - return SingleChildScrollView( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _appCombinedTextComponent(), - SizedBox( - width: 41.w, - ), - _loginComponent(), - ], - ), - ); - } +// Widget _tabletView() { +// return SingleChildScrollView( +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// _appCombinedTextComponent(), +// // SizedBox( +// // width: 41.w, +// // ), +// _loginComponent(), +// ], +// ), +// ); +// } } diff --git a/lib/main.dart b/lib/main.dart index 05cb6837e..c990e49a9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,14 +13,21 @@ import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:registration_client/app_config.dart'; import 'package:registration_client/login_page.dart'; +import 'package:registration_client/provider/app_language.dart'; import 'package:registration_client/registration_client.dart'; import 'package:registration_client/provider/global_provider.dart'; import 'package:provider/provider.dart'; import 'package:registration_client/test.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; void main() async { await ScreenUtil.ensureScreenSize(); - runApp(const MyApp()); + final AppLanguage appLanguage = AppLanguage(); + await appLanguage.fetchLocale(); + runApp( + const MyApp(), + ); } class MyApp extends StatelessWidget { @@ -38,18 +45,16 @@ class MyApp extends StatelessWidget { return MultiProvider( providers: [ ChangeNotifierProvider( - lazy: false, create: (context) => GlobalProvider()) - ], - child: MaterialApp( - title: 'Flutter Demo', - debugShowCheckedModeBanner: false, - theme: ThemeData( - colorScheme: ColorScheme.light(primary: primarySolidColor1), - primaryColor: primarySolidColor1, + lazy: false, + create: (_) => GlobalProvider(), ), - home: MyHomePage(), - ), - ); + ChangeNotifierProvider( + lazy: false, + create: (_) => AppLanguage(), + ), + ], + child: BuildApp(), + ); } Future _callAppComponent() async { @@ -57,6 +62,27 @@ class MyApp extends StatelessWidget { } } +class BuildApp extends StatelessWidget { + const BuildApp({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + debugShowCheckedModeBanner: false, + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + locale: Provider.of(context).appLocal, + theme: ThemeData( + colorScheme: ColorScheme.light(primary: primarySolidColor1), + primaryColor: primarySolidColor1, + ), + home: MyHomePage(), + ); + } +} + + class MyHomePage extends StatefulWidget { @override State createState() => _MyHomePageState(); @@ -75,7 +101,6 @@ class _MyHomePageState extends State { minTextAdapt: true, splitScreenMode: true, ); - debugPrint("Font Size: ${16.sp} ${16.spMin} ${16.spMax}"); return const LoginPage(); } } diff --git a/lib/provider/app_language.dart b/lib/provider/app_language.dart new file mode 100644 index 000000000..abb5518ae --- /dev/null +++ b/lib/provider/app_language.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class AppLanguage extends ChangeNotifier { + Locale? _appLocale = Locale('en'); + + Locale get appLocal => _appLocale ?? Locale("en"); + + String _selectedLanguage = 'eng'; + String get selectedLanguage => this._selectedLanguage; + set selectedLanguage(String value) { + this._selectedLanguage = value; + notifyListeners(); + } + + fetchLocale() async { + var prefs = await SharedPreferences.getInstance(); + if (prefs.getString('language_code') == null) { + _appLocale = Locale('en'); + return null; + } + _appLocale = Locale(prefs.getString('language_code')!); + return null; + } + + void changeLanguage(Locale code) async { + var prefs = await SharedPreferences.getInstance(); + + if(_appLocale == code) { + return; + } + + if (code == Locale("eng")) { + _appLocale = Locale("en"); + await prefs.setString('language_code', 'en'); + await prefs.setString('countryCode', ''); + } else if(code == Locale("ara")) { + _appLocale = Locale("ar"); + await prefs.setString('language_code', 'ar'); + await prefs.setString('countryCode', ''); + } else if(code == Locale("fre")) { + _appLocale = Locale("fr"); + await prefs.setString('language_code', 'fr'); + await prefs.setString('countryCode', ''); + } + + notifyListeners(); + } +} diff --git a/lib/test.dart b/lib/test.dart index 363c125e5..5df29b8c9 100644 --- a/lib/test.dart +++ b/lib/test.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/placeholder.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class Test extends StatelessWidget { const Test({super.key}); @@ -12,10 +13,44 @@ class Test extends StatelessWidget { // ScreenUtil.init(context, designSize: const Size(390, 854)); return Scaffold( body: Container( - height: ScreenUtil().setHeight(50), - width: ScreenUtil().setHeight(50), - color: Colors.orangeAccent, + height: ScreenUtil().screenHeight, + width: ScreenUtil().screenWidth, + // color: Colors.orangeAccent, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + TextField( + decoration: InputDecoration( + labelText: 'Enter Text' + ), + onChanged: (v) { + + }, + ), + SizedBox(height: 20.h,), + + ], + ), + ), ), ); } +} + +class Language { + final int id; + final String name; + final String languageCode; + + Language(this.id, this.name, this.languageCode); + + static List languageList() { + return [ + Language(1, "English", "en"), + Language(2, "Hindi", "hi"), + Language(3, "Arabic", "ar"), + ]; + } } \ No newline at end of file diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index e777c67df..b8e2b22f7 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,7 +6,9 @@ import FlutterMacOS import Foundation import path_provider_foundation +import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index a5da98d3f..2b32e4a67 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -270,6 +270,11 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -440,6 +445,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.6.3" + intl: + dependency: "direct main" + description: + name: intl + sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + url: "https://pub.dev" + source: hosted + version: "0.17.0" io: dependency: transitive description: @@ -704,6 +717,62 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.2" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "16d3fb6b3692ad244a695c0183fca18cf81fd4b821664394a781de42386bf022" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "6478c6bbbecfe9aced34c483171e90d7c078f5883558b30ec3163cf18402c749" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: e014107bb79d6d3297196f4f2d0db54b5d1f85b8ea8ff63b8e8b391a02700feb + url: "https://pub.dev" + source: hosted + version: "2.2.2" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "9d387433ca65717bbf1be88f4d5bb18f10508917a8fa2fb02e0fd0d7479a9afa" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: fb5cf25c0235df2d0640ac1b1174f6466bd311f621574997ac59018a6664548d + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: "74083203a8eae241e0de4a0d597dbedab3b8fef5563f33cf3c12d7e93c655ca5" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "5e588e2efef56916a3b229c3bfe81e6a525665a454519ca51dbcc4236a274173" + url: "https://pub.dev" + source: hosted + version: "2.2.0" shelf: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 368a06a12..79fb870eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,6 +48,10 @@ dependencies: flutter_screenutil: ^5.7.0 path_provider: ^2.0.15 permission_handler: ^10.2.0 + flutter_localizations: + sdk: flutter + intl: any + shared_preferences: ^2.0.5 dev_dependencies: flutter_test: @@ -68,6 +72,7 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: + generate: true # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in diff --git a/test/widget_test.dart b/test/widget_test.dart index 51996ffed..44f284129 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + // This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester @@ -9,22 +11,59 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:registration_client/main.dart'; +import 'package:registration_client/test.dart'; void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { + testWidgets('Find Help Button', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); + await tester.pumpWidget(MyApp()); + + var helpButton = find.widgetWithText(InkWell, "HELP"); + expect(helpButton, findsOneWidget); + }); + + testWidgets('Find Welcome Text', (WidgetTester tester) async { + await tester.pumpWidget(MyApp()); + + var welcomeText = find.text('Welcome to'); + expect(welcomeText, findsOneWidget); + }); + + testWidgets('Find Community Text', (WidgetTester tester) async { + await tester.pumpWidget(MyApp()); - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); + var communityText = find.text('Community Registration Client!'); + expect(communityText, findsOneWidget); + }); - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); + testWidgets('Find Info Text', (WidgetTester tester) async { + await tester.pumpWidget(MyApp()); - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); + var infoText = find.text('Please login to access the features.'); + expect(infoText, findsOneWidget); }); + + testWidgets('Login Component', (WidgetTester tester) async { + await tester.pumpWidget(MyApp()); + + var loginText = find.text('Login'); + expect(loginText, findsOneWidget); + + var usernameText = find.text('Username'); + expect(usernameText, findsOneWidget); + + var usernameTF = find.widgetWithText(TextField, "Enter Username"); + expect(usernameTF, findsOneWidget); + + var nextButton = find.widgetWithText(InkWell, "NEXT"); + expect(nextButton, findsOneWidget); + + await tester.tap(find.text("NEXT")); + await tester.pumpAndSettle(); + + // expect(usernameText, findsNothing); + }); + + + }