diff --git a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart index 33b880b..bf6d410 100644 --- a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart +++ b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart @@ -7,37 +7,16 @@ import 'package:webview_flutter/webview_flutter.dart'; /// Control widget initialising Clerk Auth system class ClerkAuth extends StatefulWidget { - /// Clerk public key from dashboard - final String? publicKey; - - /// Clerk publishable key from dashboard - final String? publishableKey; - - /// Persistence service for caching tokens - final clerk.Persistor? persistor; - - /// Injectable translations for strings - final ClerkTranslator translator; - - /// child widget tree - final Widget child; - - /// Loading widget - final Widget? loading; - - /// auth instance from elsewhere - final ClerkAuthProvider? auth; - /// Constructor that constructs a construct constructingly const ClerkAuth({ super.key, - required this.child, this.publicKey, this.publishableKey, this.auth, this.translator = const DefaultClerkTranslator(), this.persistor, this.loading, + required this.child, }) : assert( (publicKey is String) != (auth is ClerkAuthProvider), 'Either publicKey or an auth instance must be provided, but not both', @@ -47,6 +26,27 @@ class ClerkAuth extends StatefulWidget { 'Both publicKey and publishableKey must be provided, or neither', ); + /// Clerk public key from dashboard + final String? publicKey; + + /// Clerk publishable key from dashboard + final String? publishableKey; + + /// auth instance from elsewhere + final ClerkAuthProvider? auth; + + /// Persistence service for caching tokens + final clerk.Persistor? persistor; + + /// Injectable translations for strings + final ClerkTranslator translator; + + /// Loading widget + final Widget? loading; + + /// child widget tree + final Widget child; + @override State createState() => _ClerkAuthState(); diff --git a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart index c3eeeca..40ad617 100644 --- a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart +++ b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart @@ -7,12 +7,17 @@ import 'clerk_auth.dart'; typedef AuthWidgetBuilder = Widget Function(BuildContext context, ClerkAuthProvider auth); class ClerkAuthBuilder extends StatelessWidget { + const ClerkAuthBuilder({ + super.key, + this.signedInBuilder, + this.signedOutBuilder, + this.builder, + }); + final AuthWidgetBuilder? signedInBuilder; final AuthWidgetBuilder? signedOutBuilder; final AuthWidgetBuilder? builder; - const ClerkAuthBuilder({super.key, this.signedInBuilder, this.signedOutBuilder, this.builder}); - @override Widget build(BuildContext context) { final auth = ClerkAuth.of(context); diff --git a/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_in.dart b/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_in.dart index deac264..069bcf9 100644 --- a/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_in.dart +++ b/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_in.dart @@ -6,9 +6,12 @@ import 'clerk_auth.dart'; /// A widget that builds its child only if we are signed in /// i.e. a user is present on the client class ClerkSignedIn extends StatelessWidget { - final Widget child; + const ClerkSignedIn({ + super.key, + required this.child, + }); - const ClerkSignedIn({super.key, required this.child}); + final Widget child; @override Widget build(BuildContext context) { diff --git a/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_out.dart b/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_out.dart index 60d0a1d..fb983bc 100644 --- a/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_out.dart +++ b/packages/clerk_flutter/lib/src/widgets/control/clerk_signed_out.dart @@ -6,9 +6,12 @@ import 'clerk_auth.dart'; /// A widget that builds its child only if we are signed out /// i.e. a user is not present on the client class ClerkSignedOut extends StatelessWidget { - final Widget child; + const ClerkSignedOut({ + super.key, + required this.child, + }); - const ClerkSignedOut({super.key, required this.child}); + final Widget child; @override Widget build(BuildContext context) {