diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml new file mode 100644 index 00000000..d8a01571 --- /dev/null +++ b/.github/workflows/flutter.yml @@ -0,0 +1,77 @@ +name: flutter + +on: + push: + branches: + - master + pull_request: + types: [ opened, labeled, unlabeled, synchronize ] + +jobs: + analysis: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - uses: subosito/flutter-action@v2 + with: + cache: true + - name: Version + run: flutter doctor -v + - name: Install dependencies + run: flutter pub get + - name: Linter + run: flutter analyze + # Min SDK is same as current SDK +# analysis_min_sdk: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-java@v3 +# with: +# java-version: 17 +# distribution: temurin +# - uses: subosito/flutter-action@v2.12.0 +# with: +# cache: true +# flutter-version: '3.13.9' +# channel: 'stable' +# - name: Version +# run: flutter doctor -v +# - name: Install dependencies +# run: flutter pub get +# - name: Linter +# run: flutter analyze + formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - uses: subosito/flutter-action@v2 + with: + cache: true + - name: Format + run: dart format --set-exit-if-changed . + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - uses: subosito/flutter-action@v2 + with: + cache: true + - name: Version + run: flutter doctor -v + - name: Install dependencies + run: flutter pub get + - name: Linter + run: flutter test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 84100bba..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Widget tests & code analysis - -on: [push, pull_request] - -# https://admcpr.com/continuous-integration-for-flutter-with-github-actions/ -jobs: - test: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '11' - # Use the community Action to install Flutter - - uses: subosito/flutter-action@v2 - - name: Version - run: flutter doctor -v - - name: Install dependencies - run: flutter pub get - - name: Format - run: dart format --set-exit-if-changed . - - name: Linter - run: dart analyze - - name: Test - run: flutter test diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c0fad35..6a11538f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 5.0.0 +Breaking Changes: +- [Android] Upgraded to Gradle 8. Due to a dependency update, the minimum Flutter version is changed to 3.16. + +Features: +- Added keyboardDismissBehavior parameter to select the behaviour of the keyboard when scrolling. +- Added initialIsoCode parameter to set the initial iso code for the widget [LoginUserType.intlPhone]. Defaults to ['US'] if not specified. +- The card surfaceTintColor can now be set using cardTheme.surfaceTintColor. + +Bugs fixed: +- Navigate to login page after pressing sign up confirm button when loginAfterSignUp is disabled and additionalSignupData is not null. +- Added context checks to prevent crashes when widget is not mounted anymore. + ## 4.2.1 - Added dynamic prefix-icon on recover card based on user type. (thanks @lucaloiacono !) diff --git a/example/.gitignore b/example/.gitignore index 2ddde2a5..29a3a501 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -8,6 +8,7 @@ .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml @@ -22,52 +23,21 @@ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins -.packages +.flutter-plugins-dependencies .pub-cache/ .pub/ /build/ -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java +# Symbolication related +app.*.symbols -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* +# Obfuscation related +app.*.map.json -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/lib/custom_route.dart b/example/lib/custom_route.dart index fd4b12f5..40ca19ba 100644 --- a/example/lib/custom_route.dart +++ b/example/lib/custom_route.dart @@ -1,15 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:login_example/login_screen.dart'; +import 'package:flutter_login_example/login_screen.dart'; class FadePageRoute extends MaterialPageRoute { FadePageRoute({ - required WidgetBuilder builder, - RouteSettings? settings, - }) : super( - builder: builder, - settings: settings, - ); + required super.builder, + super.settings, + }); @override Duration get transitionDuration => const Duration(milliseconds: 600); diff --git a/example/lib/dashboard_screen.dart b/example/lib/dashboard_screen.dart index 6d3349dd..fa75a4cc 100644 --- a/example/lib/dashboard_screen.dart +++ b/example/lib/dashboard_screen.dart @@ -2,17 +2,17 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_login/theme.dart'; import 'package:flutter_login/widgets.dart'; +import 'package:flutter_login_example/constants.dart'; +import 'package:flutter_login_example/transition_route_observer.dart'; +import 'package:flutter_login_example/widgets/animated_numeric_text.dart'; +import 'package:flutter_login_example/widgets/fade_in.dart'; +import 'package:flutter_login_example/widgets/round_button.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:login_example/constants.dart'; -import 'package:login_example/transition_route_observer.dart'; -import 'package:login_example/widgets/animated_numeric_text.dart'; -import 'package:login_example/widgets/fade_in.dart'; -import 'package:login_example/widgets/round_button.dart'; class DashboardScreen extends StatefulWidget { static const routeName = '/dashboard'; - const DashboardScreen({Key? key}) : super(key: key); + const DashboardScreen({super.key}); @override State createState() => _DashboardScreenState(); diff --git a/example/lib/login_screen.dart b/example/lib/login_screen.dart index 5c6ee76e..92eeaeb6 100644 --- a/example/lib/login_screen.dart +++ b/example/lib/login_screen.dart @@ -1,16 +1,16 @@ import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart' show timeDilation; import 'package:flutter_login/flutter_login.dart'; +import 'package:flutter_login_example/constants.dart'; +import 'package:flutter_login_example/custom_route.dart'; +import 'package:flutter_login_example/dashboard_screen.dart'; +import 'package:flutter_login_example/users.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:login_example/constants.dart'; -import 'package:login_example/custom_route.dart'; -import 'package:login_example/dashboard_screen.dart'; -import 'package:login_example/users.dart'; class LoginScreen extends StatelessWidget { static const routeName = '/auth'; - const LoginScreen({Key? key}) : super(key: key); + const LoginScreen({super.key}); Duration get loginTime => Duration(milliseconds: timeDilation.ceil() * 2250); @@ -280,7 +280,7 @@ class LoginScreen extends StatelessWidget { } class IntroWidget extends StatelessWidget { - const IntroWidget({Key? key}) : super(key: key); + const IntroWidget({super.key}); @override Widget build(BuildContext context) { diff --git a/example/lib/main.dart b/example/lib/main.dart index 1e1b58b3..5d85a717 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:login_example/dashboard_screen.dart'; -import 'package:login_example/login_screen.dart'; -import 'package:login_example/transition_route_observer.dart'; +import 'package:flutter_login_example/dashboard_screen.dart'; +import 'package:flutter_login_example/login_screen.dart'; +import 'package:flutter_login_example/transition_route_observer.dart'; void main() { SystemChrome.setSystemUIOverlayStyle( @@ -15,7 +15,7 @@ void main() { } class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { diff --git a/example/lib/transition_route_observer.dart b/example/lib/transition_route_observer.dart index 09c09e31..c29ee0eb 100644 --- a/example/lib/transition_route_observer.dart +++ b/example/lib/transition_route_observer.dart @@ -74,7 +74,7 @@ class TransitionRouteObserver?> /// /// This is used with [TransitionRouteObserver] to make a widget aware of changes to the /// [Navigator]'s session history. -abstract class TransitionRouteAware { +mixin TransitionRouteAware { /// Called when the top route has been popped off, and the current route /// shows up. void didPopNext() {} diff --git a/example/lib/widgets/animated_numeric_text.dart b/example/lib/widgets/animated_numeric_text.dart index 75e95855..95c14c91 100644 --- a/example/lib/widgets/animated_numeric_text.dart +++ b/example/lib/widgets/animated_numeric_text.dart @@ -3,7 +3,7 @@ import 'package:intl/intl.dart'; class AnimatedNumericText extends StatelessWidget { AnimatedNumericText({ - Key? key, + super.key, required this.initialValue, required this.targetValue, required this.controller, @@ -19,8 +19,7 @@ class AnimatedNumericText extends StatelessWidget { parent: controller, curve: curve, ), - ), - super(key: key); + ); final double initialValue; final double targetValue; diff --git a/example/lib/widgets/fade_in.dart b/example/lib/widgets/fade_in.dart index 217226b2..1e462b7d 100644 --- a/example/lib/widgets/fade_in.dart +++ b/example/lib/widgets/fade_in.dart @@ -9,7 +9,7 @@ enum FadeDirection { class FadeIn extends StatefulWidget { const FadeIn({ - Key? key, + super.key, this.fadeDirection = FadeDirection.startToEnd, this.offset = 1.0, this.controller, @@ -20,8 +20,7 @@ class FadeIn extends StatefulWidget { controller == null && duration != null || controller != null && duration == null, ), - assert(offset > 0), - super(key: key); + assert(offset > 0); /// [FadeIn] animation can be controlled via external [controller]. If /// [controller] is not provided, it will use the default internal controller @@ -66,19 +65,15 @@ class _FadeInState extends State with SingleTickerProviderStateMixin { case FadeDirection.startToEnd: begin = Offset(-offset, 0); end = Offset.zero; - break; case FadeDirection.endToStart: begin = Offset(offset, 0); end = Offset.zero; - break; case FadeDirection.topToBottom: begin = Offset(0, -offset); end = Offset.zero; - break; case FadeDirection.bottomToTop: begin = Offset(0, offset); end = Offset.zero; - break; } _slideAnimation = Tween( diff --git a/example/lib/widgets/round_button.dart b/example/lib/widgets/round_button.dart index 072319ce..0eeba527 100644 --- a/example/lib/widgets/round_button.dart +++ b/example/lib/widgets/round_button.dart @@ -2,14 +2,14 @@ import 'package:flutter/material.dart'; class RoundButton extends StatefulWidget { const RoundButton({ - Key? key, + super.key, required this.icon, required this.onPressed, required this.label, required this.loadingController, this.interval = const Interval(0, 1, curve: Curves.ease), this.size = 60, - }) : super(key: key); + }); final Widget? icon; final VoidCallback onPressed; diff --git a/example/pubspec.lock b/example/pubspec.lock index a2a26d07..aef109ae 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -92,7 +92,7 @@ packages: path: ".." relative: true source: path - version: "4.2.3" + version: "4.3.0" flutter_test: dependency: "direct dev" description: flutter diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 6cb6d6d9..f96ade90 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,10 +1,11 @@ -name: login_example -description: Example of flutter_login package. +name: flutter_login_example +description: "Example of flutter_login package." version: 1.0.0+1 -publish_to: none +publish_to: 'none' environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.2.0 <4.0.0" + flutter: ^3.16.0 dependencies: cupertino_icons: ^1.0.3 @@ -18,7 +19,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - lint: ^2.2.0 + lint: ^2.1.2 flutter: uses-material-design: true diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index ff1b5927..c81b74a7 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -6,10 +6,9 @@ // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; +import 'package:flutter_login_example/main.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:login_example/main.dart'; - void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. diff --git a/lib/src/widgets/cards/additional_signup_card.dart b/lib/src/widgets/cards/additional_signup_card.dart index 81230bd2..4d99242d 100644 --- a/lib/src/widgets/cards/additional_signup_card.dart +++ b/lib/src/widgets/cards/additional_signup_card.dart @@ -137,7 +137,6 @@ class _AdditionalSignUpCardState extends State<_AdditionalSignUpCard> additionalSignupData: auth.additionalSignupData, ), ); - break; case AuthType.userPassword: error = await auth.onSignup!( SignupData.fromSignupForm( @@ -147,7 +146,6 @@ class _AdditionalSignUpCardState extends State<_AdditionalSignUpCard> termsOfService: auth.getTermsOfServiceResults(), ), ); - break; } if (context.mounted) { diff --git a/lib/src/widgets/fade_in.dart b/lib/src/widgets/fade_in.dart index 025743fb..8b0c92db 100644 --- a/lib/src/widgets/fade_in.dart +++ b/lib/src/widgets/fade_in.dart @@ -65,19 +65,15 @@ class _FadeInState extends State with SingleTickerProviderStateMixin { case FadeDirection.startToEnd: begin = Offset(-offset, 0); end = Offset.zero; - break; case FadeDirection.endToStart: begin = Offset(offset, 0); end = Offset.zero; - break; case FadeDirection.topToBottom: begin = Offset(0, -offset); end = Offset.zero; - break; case FadeDirection.bottomToTop: begin = Offset(0, offset); end = Offset.zero; - break; } _slideAnimation = Tween( diff --git a/lib/src/widgets/hero_text.dart b/lib/src/widgets/hero_text.dart index 22175848..ee1826f1 100644 --- a/lib/src/widgets/hero_text.dart +++ b/lib/src/widgets/hero_text.dart @@ -77,11 +77,9 @@ class __HeroTextContentState extends State<_HeroTextContent> curve: Curves.easeInOut, ), ); - break; case ViewState.enlarged: fontSize = widget.largeFontSize; - break; case ViewState.shrink: _fontSizeTween = Tween( @@ -93,11 +91,9 @@ class __HeroTextContentState extends State<_HeroTextContent> curve: Curves.easeInOut, ), ); - break; case ViewState.shrunk: fontSize = widget.smallFontSize; - break; } } diff --git a/pubspec.yaml b/pubspec.yaml index 8e62aba1..b0c8b051 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,11 @@ name: flutter_login description: A login widget with login/signup functionalities to help speed up development -version: 4.2.3 +version: 5.0.0 repository: https://github.com/NearHuscarl/flutter_login environment: - sdk: ">=2.19.0 <4.0.0" + sdk: ">=3.2.0 <4.0.0" + flutter: ^3.16.0 dependencies: another_flushbar: ^1.10.29 @@ -22,7 +23,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - lint: ^2.2.0 + lint: ^2.1.2 mockito: ^5.0.16 flutter: