Skip to content

Commit

Permalink
fix: minor formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
slightfoot committed Nov 19, 2024
1 parent f859c0e commit ce981a3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 28 deletions.
44 changes: 22 additions & 22 deletions packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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<ClerkAuth> createState() => _ClerkAuthState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ce981a3

Please sign in to comment.