From 7b9c36fc4e0f7e0d43e95b0a2ff6f9ee2036b1f2 Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Fri, 16 Jun 2023 13:55:41 +0600 Subject: [PATCH 1/9] Clean yaml file --- ios/Podfile.lock | 2 +- pubspec.yaml | 49 +++--------------------------------------------- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 7f71095..c74adda 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1024,4 +1024,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 7ecc065bb3d503009b3e7892d5409a9d5882bb93 -COCOAPODS: 1.12.0 +COCOAPODS: 1.12.1 diff --git a/pubspec.yaml b/pubspec.yaml index 8d9c360..8462c84 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,31 +1,13 @@ name: pinext description: A new Flutter project. -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: 'none' -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+10 environment: sdk: ">=2.17.6 <3.0.0" -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: antdesign_icons: ^0.0.3 awesome_snackbar_content: ^0.1.3 @@ -74,29 +56,14 @@ dev_dependencies: flutter_test: sdk: flutter -# 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 packages. flutter: - # The following line ensures that the Material Icons font is - # 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: - assets/animations/ - assets/app_icon/ - # - 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 - # list giving the asset and other descriptors for the font. For - # example: + fonts: - family: SFPro fonts: @@ -110,13 +77,3 @@ flutter: - family: BakbakOne fonts: - asset: assets/fonts/BakbakOne-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages From 6dfce12c996a43388f40f73d38537e1819f250f4 Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Fri, 16 Jun 2023 13:56:08 +0600 Subject: [PATCH 2/9] Diabled github ci/cd --- .github/workflows/cicd_workflow.yml | 54 ++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/cicd_workflow.yml b/.github/workflows/cicd_workflow.yml index 57e0d6e..6857121 100644 --- a/.github/workflows/cicd_workflow.yml +++ b/.github/workflows/cicd_workflow.yml @@ -1,27 +1,27 @@ -name: CI/CD -on: - push: - branches: - - master -jobs: - build_and_deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-java@v1 - with: - java-version: '12.x' - - uses: subosito/flutter-action@v1 - with: - channel: 'stable' - - name: Build Gradle - run: flutter build apk --release - - run: ls build/app/outputs/flutter-apk - - name: Upload artifact to Firebase App Distribution - uses: wzieba/Firebase-Distribution-Github-Action@v1 - with: - appId: ${{secrets.APP_ID}} - serviceCredentialsFileContent: ${{secrets.CREDENTIAL_FILE_CONTENT}} - release_notes: "A new version has been released." - groups: testers - file: build/app/outputs/flutter-apk/app-release.apk \ No newline at end of file +# name: CI/CD +# on: +# push: +# branches: +# - master +# jobs: +# build_and_deploy: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v1 +# - uses: actions/setup-java@v1 +# with: +# java-version: '12.x' +# - uses: subosito/flutter-action@v1 +# with: +# channel: 'stable' +# - name: Build Gradle +# run: flutter build apk --release +# - run: ls build/app/outputs/flutter-apk +# - name: Upload artifact to Firebase App Distribution +# uses: wzieba/Firebase-Distribution-Github-Action@v1 +# with: +# appId: ${{secrets.APP_ID}} +# serviceCredentialsFileContent: ${{secrets.CREDENTIAL_FILE_CONTENT}} +# release_notes: "A new version has been released." +# groups: testers +# file: build/app/outputs/flutter-apk/app-release.apk \ No newline at end of file From 5d32a24e459a64dc20ba7474db8bc26edb75978a Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Fri, 16 Jun 2023 14:04:35 +0600 Subject: [PATCH 3/9] Replace about us fab with a button --- .../app_settings_screen.dart | 26 ++++++++----------- lib/app/screens/home/pages/budget_page.dart | 2 +- lib/app/screens/home/pages/home_page.dart | 2 +- lib/app/shared/widgets/bounce_icons.dart | 2 +- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/app/screens/home/pages/app_settings_screen/app_settings_screen.dart b/lib/app/screens/home/pages/app_settings_screen/app_settings_screen.dart index 5047fda..8625479 100644 --- a/lib/app/screens/home/pages/app_settings_screen/app_settings_screen.dart +++ b/lib/app/screens/home/pages/app_settings_screen/app_settings_screen.dart @@ -26,21 +26,6 @@ class AppSettingsScreen extends StatelessWidget { final width = MediaQuery.of(context).size.width; final height = MediaQuery.of(context).size.height; return Scaffold( - floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling, - floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, - floatingActionButton: FloatingActionButton( - onPressed: () { - context.read().showAboutDialog(context); - }, - backgroundColor: darkPurpleColor, - child: Text( - '?', - style: boldTextStyle.copyWith( - color: whiteColor, - fontSize: 16, - ), - ), - ), body: SizedBox( height: height, width: width, @@ -70,6 +55,17 @@ class AppSettingsScreen extends StatelessWidget { const SizedBox( height: 8, ), + GetSettingsButtonWithIcon( + onTapFunction: () { + context.read().showAboutDialog(context); + }, + label: 'About Pinext', + icon: Icons.question_mark, + iconSize: 18, + ), + const SizedBox( + height: 8, + ), GetSettingsButtonWithIcon( onTapFunction: () { Navigator.push( diff --git a/lib/app/screens/home/pages/budget_page.dart b/lib/app/screens/home/pages/budget_page.dart index 20e9f28..f84a2b4 100644 --- a/lib/app/screens/home/pages/budget_page.dart +++ b/lib/app/screens/home/pages/budget_page.dart @@ -68,7 +68,7 @@ class BudgetView extends StatelessWidget { ], child: Scaffold( floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling, - floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, + floatingActionButtonLocation: FloatingActionButtonLocation.endTop, floatingActionButton: FloatingActionButton( onPressed: () { Navigator.push( diff --git a/lib/app/screens/home/pages/home_page.dart b/lib/app/screens/home/pages/home_page.dart index cf756a5..afec19c 100644 --- a/lib/app/screens/home/pages/home_page.dart +++ b/lib/app/screens/home/pages/home_page.dart @@ -65,7 +65,7 @@ class HomepageView extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling, - floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, + floatingActionButtonLocation: FloatingActionButtonLocation.endTop, floatingActionButton: FloatingActionButton( onPressed: () { context.read().openAddTransactionsPage(context); diff --git a/lib/app/shared/widgets/bounce_icons.dart b/lib/app/shared/widgets/bounce_icons.dart index 1d29081..c60a4a3 100644 --- a/lib/app/shared/widgets/bounce_icons.dart +++ b/lib/app/shared/widgets/bounce_icons.dart @@ -31,7 +31,7 @@ class _BounceIconState extends State with SingleTickerProviderStateM vsync: this, duration: const Duration(milliseconds: 500), ); - _animation = Tween(begin: 0.2, end: 1).animate( + _animation = Tween(begin: 0.6, end: 1).animate( CurvedAnimation(parent: _controller, curve: Curves.fastEaseInToSlowEaseOut), ); _controller.forward(); From bb80630d10f8af752af5548ece084a5908e75e29 Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Fri, 16 Jun 2023 14:05:45 +0600 Subject: [PATCH 4/9] Removed extra padding --- lib/app/screens/home/pages/budget_page.dart | 2 +- lib/app/screens/home/pages/home_page.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/screens/home/pages/budget_page.dart b/lib/app/screens/home/pages/budget_page.dart index f84a2b4..be68d3c 100644 --- a/lib/app/screens/home/pages/budget_page.dart +++ b/lib/app/screens/home/pages/budget_page.dart @@ -125,7 +125,7 @@ class BudgetView extends StatelessWidget { ), const _GetSubscriptionWidget(), const SizedBox( - height: kToolbarHeight * 1.5, + height: 30, ), ], ), diff --git a/lib/app/screens/home/pages/home_page.dart b/lib/app/screens/home/pages/home_page.dart index afec19c..98c7d2f 100644 --- a/lib/app/screens/home/pages/home_page.dart +++ b/lib/app/screens/home/pages/home_page.dart @@ -177,7 +177,7 @@ class HomepageView extends StatelessWidget { ), const HomepageGetYourCardsWidget(), const SizedBox( - height: kToolbarHeight * 1.5, + height: 30, ), ], ), From c2a2c6483084b64662cd1e5d756bf6c5a54bd656 Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Fri, 16 Jun 2023 14:09:32 +0600 Subject: [PATCH 5/9] Code refactoring --- lib/app/shared/widgets/pinext_card.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/app/shared/widgets/pinext_card.dart b/lib/app/shared/widgets/pinext_card.dart index 5115faa..3a67f1c 100644 --- a/lib/app/shared/widgets/pinext_card.dart +++ b/lib/app/shared/widgets/pinext_card.dart @@ -14,15 +14,15 @@ import 'package:timeago/timeago.dart' as timeago; class PinextCard extends StatelessWidget { PinextCard({ + required this.cardId, + required this.cardDetails, + required this.lastTransactionDate, super.key, this.isSelected = false, this.cardColor = 'Midnight Indigo', this.title = 'Test Title', - required this.cardId, this.balance = 0.00, this.cardModel, - required this.cardDetails, - required this.lastTransactionDate, }); bool isSelected; From 39550b04ca175ea71e59740050edeb899945dfa4 Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Fri, 16 Jun 2023 14:26:19 +0600 Subject: [PATCH 6/9] Adjusted card size --- .../add_and_edit_pinext_card.dart | 11 ++++++----- .../add_and_view_transaction.dart | 12 ++++++------ .../home/widgets/homepage_your_cards_widget.dart | 2 +- lib/app/shared/widgets/pinext_card.dart | 16 ++++++++++++---- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/app/screens/add_and_edit_pinext_card/add_and_edit_pinext_card.dart b/lib/app/screens/add_and_edit_pinext_card/add_and_edit_pinext_card.dart index 35fe032..8bb5743 100644 --- a/lib/app/screens/add_and_edit_pinext_card/add_and_edit_pinext_card.dart +++ b/lib/app/screens/add_and_edit_pinext_card/add_and_edit_pinext_card.dart @@ -76,10 +76,10 @@ class _AddAndEditPinextCardViewState extends State { descriptionController = TextEditingController(); balanceController = TextEditingController(); if (widget.isEditCardScreen) { - titleController.text = widget.isDemoMode ? 'Bank' : widget.pinextCardModel!.title.toString().capitalize(); + titleController.text = widget.isDemoMode ? 'Bank' : widget.pinextCardModel!.title.capitalize(); descriptionController.text = widget.isDemoMode ? "The purpose of lorem ipsum is to create a natural looking block of text (sentence, paragraph, page, etc.) that doesn't distract from the layout." - : widget.pinextCardModel!.description.toString().capitalize(); + : widget.pinextCardModel!.description.capitalize(); balanceController.text = widget.isDemoMode ? '55000' : widget.pinextCardModel!.balance.toString(); isEditCardColor = widget.pinextCardModel!.color; } @@ -221,7 +221,7 @@ class _AddAndEditPinextCardViewState extends State { ), ), const SizedBox( - height: 8, + height: 10, ), ], ), @@ -303,6 +303,7 @@ class _AddAndEditPinextCardViewState extends State { ), SizedBox( width: getWidth(context), + height: getCardHeight(context) + 10, child: Row( children: [ const SizedBox( @@ -324,7 +325,7 @@ class _AddAndEditPinextCardViewState extends State { cardColor: widget.isEditCardScreen ? isEditCardColor! : state.color, title: widget.isEditCardScreen ? widget.pinextCardModel!.title : 'Example card', balance: widget.isEditCardScreen ? widget.pinextCardModel!.balance : 1233456, - lastTransactionDate: widget.isEditCardScreen ? widget.pinextCardModel!.lastTransactionData.toString() : DateTime.now().toString(), + lastTransactionDate: widget.isEditCardScreen ? widget.pinextCardModel!.lastTransactionData : DateTime.now().toString(), cardDetails: widget.isEditCardScreen ? widget.pinextCardModel!.description : ' ', ); }, @@ -401,7 +402,7 @@ class _AddAndEditPinextCardViewState extends State { } if (state is AddCardSuccessState) { final newPinextCard = PinextCardModel( - cardId: const Uuid().v4().toString(), + cardId: const Uuid().v4(), title: state.title, description: state.description, balance: state.balance, diff --git a/lib/app/screens/add_and_view_transaction/add_and_view_transaction.dart b/lib/app/screens/add_and_view_transaction/add_and_view_transaction.dart index 79ee74a..4d1f3b8 100644 --- a/lib/app/screens/add_and_view_transaction/add_and_view_transaction.dart +++ b/lib/app/screens/add_and_view_transaction/add_and_view_transaction.dart @@ -63,10 +63,10 @@ class AddAndViewTransactionScreen extends StatelessWidget { class AddAndViewTransactionView extends StatefulWidget { AddAndViewTransactionView({ - super.key, required this.isAQuickAction, required this.isViewOnly, required this.pinextTransactionModel, + super.key, }); bool isAQuickAction; @@ -372,7 +372,7 @@ class _AddAndViewTransactionViewState extends State { (index) { return GestureDetector( onTap: () { - final selectedTag = transactionTags[index].toString(); + final selectedTag = transactionTags[index]; if (state.selectedTag != selectedTag) { context.read().changeSelectedTag(selectedTag); } else { @@ -381,7 +381,7 @@ class _AddAndViewTransactionViewState extends State { }, child: Chip( label: Text( - transactionTags[index].toString(), + transactionTags[index], style: regularTextStyle.copyWith( color: transactionTags[index] == state.selectedTag ? whiteColor : customBlackColor.withOpacity(.6), fontWeight: transactionTags[index] == state.selectedTag ? FontWeight.w600 : FontWeight.normal, @@ -645,7 +645,7 @@ class _AddAndViewTransactionViewState extends State { context.read().add(RefreshUserStateEvent(context: context)); final date = DateTime.parse(widget.pinextTransactionModel!.transactionDate); - final month = date.month.toString().length == 1 ? '0${date.month.toString()}' : date.month.toString(); + final month = date.month.toString().length == 1 ? '0${date.month}' : date.month.toString(); if (month == currentMonth && date.year.toString() == currentYear) { context.read().getCurrentMonthTransactionArchive(context); @@ -844,7 +844,7 @@ class _GetCardListWidget extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - height: 185, + height: getCardHeight(context) + 10, child: SingleChildScrollView( physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, @@ -910,7 +910,7 @@ class _GetCardListWidget extends StatelessWidget { return BlocBuilder( builder: (context, state) { - Widget pinextCardWidget = GestureDetector( + final Widget pinextCardWidget = GestureDetector( onTap: () { if (!isViewOnly) { if (state.selectedCardNo == pinextCardModel.cardId) { diff --git a/lib/app/screens/home/widgets/homepage_your_cards_widget.dart b/lib/app/screens/home/widgets/homepage_your_cards_widget.dart index 8cb8646..f04fdc0 100644 --- a/lib/app/screens/home/widgets/homepage_your_cards_widget.dart +++ b/lib/app/screens/home/widgets/homepage_your_cards_widget.dart @@ -70,7 +70,7 @@ class HomepageGetYourCardsWidget extends StatelessWidget { ); } return SizedBox( - height: 185, + height: getCardHeight(context) + 10, child: ListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), diff --git a/lib/app/shared/widgets/pinext_card.dart b/lib/app/shared/widgets/pinext_card.dart index 3a67f1c..c3c5b0a 100644 --- a/lib/app/shared/widgets/pinext_card.dart +++ b/lib/app/shared/widgets/pinext_card.dart @@ -68,8 +68,8 @@ class PinextCard extends StatelessWidget { padding: const EdgeInsets.all( 15, ), - height: 210, - width: getWidth(context) * .85, + height: getCardHeight(context), + width: getCardWidth(context), decoration: BoxDecoration( // color: cardColor, borderRadius: BorderRadius.circular( @@ -88,8 +88,8 @@ class PinextCard extends StatelessWidget { padding: const EdgeInsets.all( 15, ), - height: 210, - width: getWidth(context) * .85, + height: getCardHeight(context), + width: getCardWidth(context), decoration: BoxDecoration( color: Colors.black.withOpacity(.10), borderRadius: BorderRadius.circular( @@ -322,3 +322,11 @@ class PinextCard extends StatelessWidget { ); } } + +double getCardHeight(BuildContext context) { + return (getWidth(context) * .85) / 1.7; +} + +double getCardWidth(BuildContext context) { + return getWidth(context) * .85; +} From d5c1516a285bd96e942b84d3c36b645d8fc8d4d9 Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Mon, 19 Jun 2023 12:22:00 +0600 Subject: [PATCH 7/9] Added dialCodeHandler --- lib/country_data/country_data.dart | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib/country_data/country_data.dart b/lib/country_data/country_data.dart index b74ba96..e43ac31 100644 --- a/lib/country_data/country_data.dart +++ b/lib/country_data/country_data.dart @@ -210,24 +210,6 @@ class CountryHandler { ]; void _setUpCountryList() { - // for (final country in _countryMap) { - // countryList.add(CountryData.fromMap(country)); - // } - - // // Sort the list based on country name - // countryList.sort((a, b) => a.name.compareTo(b.name)); - - // // Remove duplicates based on country name - // final uniqueCountries = []; - // var previousName = ''; - - // for (final country in countryList) { - // if (country.name != previousName) { - // uniqueCountries.add(country); - // previousName = country.name; - // } - // } - // countryList = uniqueCountries; for (final country in _countryMap) { countryList.add(CountryData.fromMap(country)); } From 73b97ff95aafe90b4d2b385387c16463f1d3522f Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Mon, 19 Jun 2023 12:22:24 +0600 Subject: [PATCH 8/9] Added dialCodeHandler --- lib/country_data/country_dial_codes.dart | 215 +++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 lib/country_data/country_dial_codes.dart diff --git a/lib/country_data/country_dial_codes.dart b/lib/country_data/country_dial_codes.dart new file mode 100644 index 0000000..1b16175 --- /dev/null +++ b/lib/country_data/country_dial_codes.dart @@ -0,0 +1,215 @@ +class DialCodeHandler { + factory DialCodeHandler() { + _instance = DialCodeHandler._internal(); + return _instance; + } + DialCodeHandler._internal(); + static late DialCodeHandler _instance; + + final countryDialCodes = { + 'Afghanistan': '+93', + 'Albania': '+355', + 'Algeria': '+213', + 'Andorra': '+376', + 'Angola': '+244', + 'Antigua and Barbuda': '+1-268', + 'Argentina': '+54', + 'Armenia': '+374', + 'Australia': '+61', + 'Austria': '+43', + 'Azerbaijan': '+994', + 'Bahamas': '+1-242', + 'Bahrain': '+973', + 'Bangladesh': '+880', + 'Barbados': '+1-246', + 'Belarus': '+375', + 'Belgium': '+32', + 'Belize': '+501', + 'Benin': '+229', + 'Bhutan': '+975', + 'Bolivia': '+591', + 'Bosnia and Herzegovina': '+387', + 'Botswana': '+267', + 'Brazil': '+55', + 'Brunei': '+673', + 'Bulgaria': '+359', + 'Burkina Faso': '+226', + 'Burundi': '+257', + 'Cabo Verde': '+238', + 'Cambodia': '+855', + 'Cameroon': '+237', + 'Canada': '+1', + 'Central African Republic': '+236', + 'Chad': '+235', + 'Chile': '+56', + 'China': '+86', + 'Colombia': '+57', + 'Comoros': '+269', + 'Congo': '+242', + 'Costa Rica': '+506', + 'Croatia': '+385', + 'Cuba': '+53', + 'Cyprus': '+357', + 'Czech Republic': '+420', + 'Denmark': '+45', + 'Djibouti': '+253', + 'Dominica': '+1-767', + 'Dominican Republic': '+1-809, +1-829, +1-849', + 'East Timor': '+670', + 'Ecuador': '+593', + 'Egypt': '+20', + 'El Salvador': '+503', + 'Equatorial Guinea': '+240', + 'Eritrea': '+291', + 'Estonia': '+372', + 'Eswatini': '+268', + 'Ethiopia': '+251', + 'Fiji': '+679', + 'Finland': '+358', + 'France': '+33', + 'Gabon': '+241', + 'Gambia': '+220', + 'Georgia': '+995', + 'Germany': '+49', + 'Ghana': '+233', + 'Greece': '+30', + 'Grenada': '+1-473', + 'Guatemala': '+502', + 'Guinea': '+224', + 'Guinea-Bissau': '+245', + 'Guyana': '+592', + 'Haiti': '+509', + 'Honduras': '+504', + 'Hungary': '+36', + 'Iceland': '+354', + 'India': '+91', + 'Indonesia': '+62', + 'Iran': '+98', + 'Iraq': '+964', + 'Ireland': '+353', + 'Israel': '+972', + 'Italy': '+39', + 'Jamaica': '+1-876', + 'Japan': '+81', + 'Jordan': '+962', + 'Kazakhstan': '+7', + 'Kenya': '+254', + 'Kiribati': '+686', + 'Korea, North': '+850', + 'Korea, South': '+82', + 'Kosovo': '+383', + 'Kuwait': '+965', + 'Kyrgyzstan': '+996', + 'Laos': '+856', + 'Latvia': '+371', + 'Lebanon': '+961', + 'Lesotho': '+266', + 'Liberia': '+231', + 'Libya': '+218', + 'Liechtenstein': '+423', + 'Lithuania': '+370', + 'Luxembourg': '+352', + 'Madagascar': '+261', + 'Malawi': '+265', + 'Malaysia': '+60', + 'Maldives': '+960', + 'Mali': '+223', + 'Malta': '+356', + 'Marshall Islands': '+692', + 'Mauritania': '+222', + 'Mauritius': '+230', + 'Mexico': '+52', + 'Micronesia': '+691', + 'Moldova': '+373', + 'Monaco': '+377', + 'Mongolia': '+976', + 'Montenegro': '+382', + 'Morocco': '+212', + 'Mozambique': '+258', + 'Myanmar': '+95', + 'Namibia': '+264', + 'Nauru': '+674', + 'Nepal': '+977', + 'Netherlands': '+31', + 'New Zealand': '+64', + 'Nicaragua': '+505', + 'Niger': '+227', + 'Nigeria': '+234', + 'North Macedonia': '+389', + 'Norway': '+47', + 'Oman': '+968', + 'Pakistan': '+92', + 'Palau': '+680', + 'Panama': '+507', + 'Papua New Guinea': '+675', + 'Paraguay': '+595', + 'Peru': '+51', + 'Philippines': '+63', + 'Poland': '+48', + 'Portugal': '+351', + 'Qatar': '+974', + 'Romania': '+40', + 'Russia': '+7', + 'Rwanda': '+250', + 'Saint Kitts and Nevis': '+1-869', + 'Saint Lucia': '+1-758', + 'Saint Vincent and the Grenadines': '+1-784', + 'Samoa': '+685', + 'San Marino': '+378', + 'Sao Tome and Principe': '+239', + 'Saudi Arabia': '+966', + 'Senegal': '+221', + 'Serbia': '+381', + 'Seychelles': '+248', + 'Sierra Leone': '+232', + 'Singapore': '+65', + 'Slovakia': '+421', + 'Slovenia': '+386', + 'Solomon Islands': '+677', + 'Somalia': '+252', + 'South Africa': '+27', + 'South Sudan': '+211', + 'Spain': '+34', + 'Sri Lanka': '+94', + 'Sudan': '+249', + 'Suriname': '+597', + 'Sweden': '+46', + 'Switzerland': '+41', + 'Syria': '+963', + 'Taiwan': '+886', + 'Tajikistan': '+992', + 'Tanzania': '+255', + 'Thailand': '+66', + 'Togo': '+228', + 'Tonga': '+676', + 'Trinidad and Tobago': '+1-868', + 'Tunisia': '+216', + 'Turkey': '+90', + 'Turkmenistan': '+993', + 'Tuvalu': '+688', + 'Uganda': '+256', + 'Ukraine': '+380', + 'United Arab Emirates': '+971', + 'United Kingdom': '+44', + 'United States': '+1', + 'Uruguay': '+598', + 'Uzbekistan': '+998', + 'Vanuatu': '+678', + 'Vatican City': '+379', + 'Venezuela': '+58', + 'Vietnam': '+84', + 'Yemen': '+967', + 'Zambia': '+260', + 'Zimbabwe': '+263', + }; + + String? getDialCode(String phoneNumber) { + for (final dialCode in countryDialCodes.values) { + if (phoneNumber.startsWith(dialCode)) { + return dialCode; + } + } + + return null; + } +} From de81b17125ea3d93dc299a34f1f0c19710edd807 Mon Sep 17 00:00:00 2001 From: Khondakar Afridi Date: Mon, 19 Jun 2023 13:12:24 +0600 Subject: [PATCH 9/9] Modified dialcode handler --- lib/country_data/country_dial_codes.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/country_data/country_dial_codes.dart b/lib/country_data/country_dial_codes.dart index 1b16175..7e7bd17 100644 --- a/lib/country_data/country_dial_codes.dart +++ b/lib/country_data/country_dial_codes.dart @@ -205,7 +205,9 @@ class DialCodeHandler { String? getDialCode(String phoneNumber) { for (final dialCode in countryDialCodes.values) { - if (phoneNumber.startsWith(dialCode)) { + if (phoneNumber.startsWith(dialCode) || phoneNumber.startsWith(dialCode.substring(1, dialCode.length))) { + return dialCode; + } else if (phoneNumber.endsWith(dialCode)) { return dialCode; } }